Correlation coefficient vs distance plot for weather stations

I’ve looked everywhere but didn’t find any answer, hope someone can help me here.

I need to make a Correlation Coefficient VS Distance (in Km) plot between 9 weather stations. It would look looks like the following figure:

enter image description here

To do this, I have a time series of daily minimum temperature on 9 weather stations between the period 1980-2016. The .csv file with the data looks like this:

enter image description here

And the location of all the weather stations is in another .csv file that looks like this:

enter image description here

Is there some way to do it easly?


Is Levenshtein distance related to largest common subsequence?

I don’t have proof but i have gut feeling that , suppose s1 is string which needs to be converted to s2 then we can keep the largest common subsequence in s1 as it is and edit distance is number of elements we need to replace to add .

For example : s1 = "adjsjvnejnv"               s2 = "djpppne"  

Here LCS is “djne” , now we need to remove 3 element string “jnv” at right side of “djne” ,we can replace “sjv” with “ppp” in s1 and and we can delete “a” from s1. so total edit distance is 3+3+1 = 7 .

Idea is to replace or delete elements inbetween the elements of LCS and add or remove elements from right and left part of LCS .

I am not able to prove it . Can someone provide counterexample or proof ?

Walk around a coordinate in circular order to a distance of N

For my development purpose, I need to work on all the 2D coordinates (in whole number) around [0,0] from 0 to N distance. For example, with N=1, I need

N0: [0, 0] N1: [-1, -1] [0, -1] [1, -1] [1, 0] [1, 1] [0, 1] [-1, 1] [-1, 0] 

The order is important. I want to walk these values in a circular way, starting from 0, incrementing the distance each round.

I first created two for-loops, from -N to N on each axes, but the resulting order is the one as you read a book: from top left to bottom right.

Here’s the order I aim (the first coordinate to walk on each circle is not important):

walking order

Here’s a first algorithm I tried, in pseudo code

int totalSize = (2*N+1, 2)*(2*N+1, 2) Vector2[] coordinates = new Vector2[totalSize] int index = 0 coordinates[index++] = new Vector2(0, 0) for (int d = 1; d <= N; d++) {     for (int x = -d; x <= d; x++) {         coordinates[index++] = new Vector2(x, -d)         coordinates[index++] = new Vector2(x, d)     }     for (int y = -d+1; y <= d-1; y++) {         coordinates[index++] = new Vector2(-d, y)         coordinates[index++] = new Vector2(d, y)     } } for (int i=0; i<coordinates.Length; i++) {     print(coordinates[i]) } 


  • It seems too cumbersome. I don’t like the creation of a scructure that retains the coordinates. And 4 for-loops seems not optimized.

  • The order of the circles is ok, but the order inside each circle is not the one I described.

  • I have the feeling trigonometry can help me, but I can’t see how to implement it on discrete values

Any idea?

Is there anything that lets me quickly figure out the distance from a safe jump point to the starport?

I realised something.

While reading the core rulebook I always assumed that the relevant distance for jumping into a system was the diameter of the systems star times one hundred, and I got the impression that it would take a few days to get from safe jump distance to the spaceport. However, while I was doing some calculations based on @paul-gilfedder great answer to this question I realised that Earth is orbiting outside of our stars diameter times one hundred.


I had been assuming that if Earth had a spaceport it would take 68h with a G1 drive to get from the spaceport to a safe jump distance, and that that was pretty standard for any solar system. However, if I understand this correctly it should take only 6h 20min to get from the jump point to Earths potential starport since it is only 1.276.000 km and not 140.000.000 that I assumed.

After this longwinded intro I get to my question: When the source material talks about a system and it’s main planet/starport is there any information included that lets me know what the travel time from safe jump distance to the spaceport is, or a way to infer it from the UPW? Makes a huge difference if the planets orbit is inside our outside of the stars 100D. For instance safe jump distance to Venus would be 32.000.000 km, which is 25 times that of Earth, because of this.

D&D5 Character throw distance [duplicate]

In my campaign, there is one player that play a Goliath Runic Knight, and has a 20 in Strength. Having the possibilty to get a size bigger with Gigantism, and counting another size bigger that he really is for pushing, draging and lifting things with Powerful Build.

Rules tells he can possibly lift something that weight around 900kg/2000lbs (or 1200kg/2600lbs, not 100% sure about the math on this one), and with this power house of a man, i’m 100% sure that the question “how far can i throw this character/monster/object/Hot-dog stand” is going to pop up.

The problem is, i don’t have an answer for that, for specific object, like weapons or throwable, it’s usually written in the rules, but i find nothing on throwing the party’s dwarf, so i require a bit of help there.

Also, does anyone know if there is a chart or something for damage taken if this man throw a creature on, say a tree (or a tree on a creature), or i will just have to guess ?

Thanks a lot.

Why does this BFS solution work for this question about euclidean distance and what’s its complexity?

Given a matrix of 1s and 0s where 0 represents houses and 1 represents stores, find the square of minimum Euclidean distance of every house to nearest store. Return it as a vector of vector.

[[1, 1, 0],  [0, 0, 0],    [0, 0, 0]] 

should return

[[0, 0, 1],  [1, 1, 2],     [4, 4, 5]]  

Basic BFS: ( approach-1)

If there are N elements in the matrix, one could do BFS starting every house to solve this. The worst case complexity of this approach is: Worst number of BFSes * O(E+V), where E is the number of edges in the matrix and V number of nodes = N * O(N + 4N) as number of edges is a constant factor of 4N. Time complexity: O(N*N)

multi-source BFS (approach-2)

  • Initialize the queue with all nodes (i, j) where i is the row number and j is the column for all stores. For each node (i, j) in the queue also store its corresponding (si, sj) node for the store that gives it the minimum square of euclidean distance (call it sqDist). For each store node (i, j), (si, sj) would be same as (i, j)

  • Initialize the distance answer that we are looking for each house with -1

  • During multi-source BFS, for a node (i, j) and it’s best store (si, sj) in the queue, look at each of 8 adjacent nodes (since it’s euclidean distance, we need to consider all 8 nodes not only 4 of left, right, top, down). If the current distance value for any of those nodes (nexti, nextj) is > the sqDist if (si, sj) is chosen as the best store for (nexti, nextj), then

    • update distance of (nexti, nextj) with the lower value
    • add (nexti,nextj) along with its best store as (si, sj) to the queue
  • Keep doing this until queue is empty

My question:

1) why does this work? Since we’re looking at euclidean distance it’s possible that (nexti, nextj) may not be added to the queue (or have their distance updated) for a certain (si, sj) but that (si, sj) node may still update the distance for nodes that are farther to it than (nexti, nextj) due to nature of euclidean distance. So (si, sj) may still need to be in the queue. How does this solution work inspite of this issue or what’s the intuitive conceptual idea of why this works despite this issue as it’s not obvious?

2) What’s the time complexity?

it seems in the worst case you could add a node in the queue N times. So it becomes N * O(N *4N) where 4N is the number of edges in the matrix. So is it not any better than doing BFS individually for each house?

Does a ranged casting distance include touch?

Can a ranged cast also count as a touch if done right next to it?

Example where this came up: My wizard player wants to have their owl familiar cast floating disk so the wizard can sit on the disk and have the owl fly along the ground with the disk following it 20 ft away like a magical floating sled. They know you can cast a spell through the familiar as though the familiar had cast it so long as it’s a touch spell, I point out it’s not a touch spell, it has a casting range of 30ft. They say sure, but the owl is casting it right underneath it’s feet which is touch distance. Any ranged distance includes all ranges shorter than that distance, so it would have to include touch wouldn’t it?

It’s kind of hard to fault that logic, does that work under RAW?

How to overcome the distance limit on a Dedicated Wright?

In D&D 3.5 there are a number of types of homunculi that can be crafted by characters with the Craft Construct feat. Among these are Dedicated Wrights, which are specifically called out in their description as being an atypical type of homunculi that “does not go out on missions or accompany its master on adventures. Instead, it stays home working while its master adventures. (Eberron Campaign Setting, p. 285).” However, they are specifically mentioned as a subtype of the standard homunculus template laid out in the monster manual, meaning they have an innate telepathic bond with their creator that reaches 1,500 feet out. Also, “A homunculus never travels beyond this range willingly, though it can be removed forcibly. If this occurs, the creature does everything in its power to regain contact with its master (Eberron Campaign Setting, p. 285).”

Dedicated Wrights, being intelligent constructs, are exceptional for passively generating money using crafting skills, especially when outfitted with equipment to boost their skill checks. My goal is to craft a group of them and take advantage of their tireless nature to keep a forge running 24/7 while my character is off adventuring. However, the 1,500 foot limit seems to make this impossible. Out of the box they seem incapable of fulfilling their stated purpose. Is there an exception to this rule that I have missed somewhere?

Assuming there is not I need a solution that will allow me to travel about without my workforce grinding to a halt whenever I go on campaign. I see three options for handling this issue. A) Replace or upgrade the telepathic bond, B) “Spoof” the telepathic bond so the homunculus believes it is still functional even when it isn’t, or C) Otherwise convince the homunculi that not having the telepathic bond is acceptable, such as through an enchantment spell.

If at all possible, I would prefer a solution that costs 5000 gp or less. Also, my character will be taking Leadership at level 6 and is moderately invested in charisma, so using followers with obscure classes for the solution is completely acceptable.

Additional qualifiers:

  • While upgrading the innate telepathic bond in each wright via the “Improved Homunculus” feat is possible, that triples their cost and only extends the range to 1 mile per character level. Since I doubt every campaign will be within a 4 to 20 mile radius this is not enough.
  • As clever as the idea seems, I’d prefer to avoid playing a Dvati (I’d rather have a solution that works for any race).
  • I’d prefer something cheaper than paying a wizard to cast Telepathic Bond and Permanency on each one. Also, avoiding any spell with a “permanent” duration would be desirable so that my workforce won’t grind to a halt whenever my character walks into an antimagic field.