![]() |
| January |
Showing posts with label Temperature. Show all posts
Showing posts with label Temperature. Show all posts
August 1, 2020
Temperature VI: PET
I have previously addressed potential evapotranspiration here, so I don't really need to address it again beyond a few minor updates.
July 31, 2020
Temperature V: Big Picture
To find the temperature, I created functions that more or less followed the guidelines from this post. The best way I found was to have slightly different functions for each category.
Then I just flip it around (reverse the latitude) in the opposite season. The common theme remains: the important thing is that this code exists and can be easily applied.
'normal': lambda x: -42.5 * (x / 90) ** 2 + 25 if x >=0 else -20 * (-x / 90) ** 2 + 25,
'hot': lambda x: -42.5 * (x / 90) ** 2 + 25 if x >=0 else -20 * (-x / 90) ** 4 + 25,
'cold': lambda x: -42.5 * (x / 90) ** 1.5 + 25 if x >=0 else -20 * (-x / 90) ** 1 + 25,
'cont': lambda x: -63 * (x / 90) ** 2 + 25 if x >=0 else -56.5 * (-x / 90) ** 2 + 25,
'cont+': lambda x: -63 * (x / 90) ** 2 + 25 if x >=0 else -20 * (-x / 90) ** 2 + 25
'hot': lambda x: -42.5 * (x / 90) ** 2 + 25 if x >=0 else -20 * (-x / 90) ** 4 + 25,
'cold': lambda x: -42.5 * (x / 90) ** 1.5 + 25 if x >=0 else -20 * (-x / 90) ** 1 + 25,
'cont': lambda x: -63 * (x / 90) ** 2 + 25 if x >=0 else -56.5 * (-x / 90) ** 2 + 25,
'cont+': lambda x: -63 * (x / 90) ** 2 + 25 if x >=0 else -20 * (-x / 90) ** 2 + 25
The next step is a small blur to smooth out the transitions, and then I lapse the temperature up based on height (-3.5 F per 1000 ft).
![]() |
| January |
Looks reasonable to me, although I probably should fiddle with the map colors so that the hot and cold areas pop a bit more.
July 27, 2020
Temperature IV: Coastal Influence
Coastal and continental influences help make the temperature distribution more interesting.
With winds and current temperatures well in hand, should be easy enough to find these areas where cold and hot temperatures (here defined simply where the current is colder or warmer than the default temperature) are distributed near the coast.
In these plots, blue and red represent cold and hot influences. Yellow represents continental influence (large landmasses) and dark yellow is "continental plus."
...Quite a lot of cold current influence, to be perfectly honest. I was expecting more of a mix. This tells me I might need to do some work on my current temperature algorithm.
![]() |
| January |
![]() |
| July |
For now, however, this part of the code works. Garbage in, garbage out, so I will need to return to the "in garbage" at some point soon.
The other explanation is that the large landmass across the equator prevents true recirculation of the warmest waters. The poles, which generate the cold currents, are relatively unchallenged. So perhaps there is an explanation here where the code remains ok.
July 17, 2020
Currents VI: The Hand of Franklin
With the current code updated, I tackled water temperature and icecap formation.
Warm water from one region will move to a colder region, and vice versa. Where does this happen?
First, I assign a temperature to all water cells based on season and latitude $\ell$. Compared to some of my other functions, it's a little boring: \[T_\ell = \begin{cases}-50 & \text{if $\ell < 0$} \\ -57 & \text{otherwise}\end{cases}\cdot\left(\frac{\ell}{90}\right)^{\begin{cases}4 & \text{if $\ell<0$} \\ 2 & \text{otherwise}\end{cases}}\] This is different from my calculation of air temperature.
Once that is done, I "push" that water around for 80 hexes - an arbitrary number, but whatever. Then I take the average of all the water that has entered a new cell, and there we have the new temperature.
![]() |
| light blue: water that is colder than expected |
My next move is to check where the water temperature is below freezing, to see how the ice caps look. I have to do a bit of cleaning here because otherwise I get a whole bunch of unconnected floating bergs - which ain't terribly realistic. But after convincing the water of what I think it should be really doing instead, I get a nice permanent ice cap (dark blue), with a seasonal glaciation shown in light blue.
![]() |
| North Pole |
![]() |
| South Pole |
The shapes aren't mindblowingly realistic but they'll do for my purposes. Of particular interest are potential harbors which become walled off by icebergs during the cold season, as well as any effects the caps might have on navigational routes: it might be quicker to tempt the poles, but depending on the level of sailing technology it might be wise to steer well clear of even the temporary caps.
Next, I'll revisit wind generation, then return to sea temperature to see where the cold water is affecting coastal climate.
September 10, 2018
Temperature III: Generating Temperature
Now I'm really on a kick. I want to move away from manually drawing anything I can, so I can focus my creative efforts to the greatest effect. Temperature will be a fun one to work on.
The baseline proved tricky to try and match to Earth values, So I made my own:
\[ T = \frac{T_{max} - T_{min}}{2} \cos\left(2 \frac{\pi}{180^\circ} \ell \right) + \frac{T_{max} + T_{min}}{2} \], where $T_{max}=90$, $T_{min}=1$ if the latitude $\ell$ is below the equator ($\ell < 0$) and $T_{min}=41$ otherwise.
The equator stays roughly the same, but the baseline will shift back and forth between January (blue) and July (red).
January
This color scale is a bit misleading, I think. But it does show the general plan.
July 6, 2018
Temperature II: Interpolating Temperatures and Rain
I'm using mostly this guide on Cartographer's Guild. It's extremely helpful. One thing, though, that I've extended is the use of exact numbers for altitude, rain, temperatures, etc, rather than the use of categories. This gives me way more granular control over the result (but also introduces more problems, so YMMV).
For every climatic input, two maps are produced: summer and winter. The seasons are always reversed between hemispheres.
However, the problem (for my purposes) is that the climate undergoes a gradual change between those two points in the year. I approximate this as a sine curve, which is good enough. I've found several places where there is more than one local maximum or minimum, so even the process I'll explain here is a bit simplistic.
Let's take a hypothetical place (I'll just grab a random hex).
\[y = A \sin\left(k x + \phi\right) + D, k = {2 \pi \over \lambda}\]
The amplitude is given by $A = {|t_w - t_s| \over 2}$, and the average is given by $D = {t_w + t_s \over 2}$. Since we're looking at a 12 month year, $\lambda = 12$, and so $k = {\pi \over 6}$.
The last variable, then, is $\phi$. This one is just a bit trickier. The minimum of a sine wave is at $\pi \over 4$. If we think about this in terms of 12 months, this is the 3rd month. Therefore, we need to find a value of $\phi$ such that the minimum of the sine wave matches up with the actual minimum of the data. The simple way to do this is just $\phi = 4 \textrm{ if } t_w \equiv \min(t_w,t_s) \textrm{ else } 10$.
Plugging all that in:
\[y_t(m) = {25 \over 2} \sin\left({\pi \over 6} \left(m - 4\right)\right) + 44.5^\circ\textrm{F}\]
\[y_p(m) = {205 \over 2} \sin\left({\pi \over 6} \left(m - 10\right)\right) + 358.5\textrm{ mm}\]
To do: this assumes that, for example, the "winter" value is the lowest value. This is not necessarily the case. Perhaps the map merely shows a snapshot of January, regardless of whether January is the coldest month. So there is room for improvement. However, I took a quick look at data at various latitudes, and outside of a short transition zone around the equator, January is usually the coldest month in the northern hemisphere and the hottest in the southern, and July is the hottest in the northern and coldest in the southern. I didn't expect the transition to be as sharp as it was. Obviously, local conditions will vary. I did not do this analysis for precipitation.
For every climatic input, two maps are produced: summer and winter. The seasons are always reversed between hemispheres.
However, the problem (for my purposes) is that the climate undergoes a gradual change between those two points in the year. I approximate this as a sine curve, which is good enough. I've found several places where there is more than one local maximum or minimum, so even the process I'll explain here is a bit simplistic.
Let's take a hypothetical place (I'll just grab a random hex).
>>> h = choice(list(hexes))The basic equation we'll fit is:
>>> h
'98S-7W'
>>> hexes[h].temperature
{'Jul': 32, 'Jan': 57} # F
>>> hexes[h].precipitation
{'Jul': 461, 'Jan': 256} # mm
\[y = A \sin\left(k x + \phi\right) + D, k = {2 \pi \over \lambda}\]
The amplitude is given by $A = {|t_w - t_s| \over 2}$, and the average is given by $D = {t_w + t_s \over 2}$. Since we're looking at a 12 month year, $\lambda = 12$, and so $k = {\pi \over 6}$.
The last variable, then, is $\phi$. This one is just a bit trickier. The minimum of a sine wave is at $\pi \over 4$. If we think about this in terms of 12 months, this is the 3rd month. Therefore, we need to find a value of $\phi$ such that the minimum of the sine wave matches up with the actual minimum of the data. The simple way to do this is just $\phi = 4 \textrm{ if } t_w \equiv \min(t_w,t_s) \textrm{ else } 10$.
Plugging all that in:
\[y_t(m) = {25 \over 2} \sin\left({\pi \over 6} \left(m - 4\right)\right) + 44.5^\circ\textrm{F}\]
\[y_p(m) = {205 \over 2} \sin\left({\pi \over 6} \left(m - 10\right)\right) + 358.5\textrm{ mm}\]
There are two major improvements for using this equation. First of all, I can get a much more accurate value for the total rainfall in a year (merely adding the two numbers I had gives a laughably incorrect number). The second is that (for purposes of climate) only liquid rainfall counts. That means that if the temperature in a given month is less than 32 (and here, that's the minimum, so we'd still get some freezing rain), then there is no liquid rainfall. It could still fall as snow, of course, but that has no effect on climate in Koppen or Holdridge.
With a wet winter and mild summer (not really that dry), the Koppen classification is Cfb. That's a "maritime mild winter"; think France. The Holdridge classification is perhumid subtropical wet forest, and I'm a bit skeptical of that. It'd be odd if both of those were true. I'm more inclined to believe the Koppen version, but we'll see.
To do: this assumes that, for example, the "winter" value is the lowest value. This is not necessarily the case. Perhaps the map merely shows a snapshot of January, regardless of whether January is the coldest month. So there is room for improvement. However, I took a quick look at data at various latitudes, and outside of a short transition zone around the equator, January is usually the coldest month in the northern hemisphere and the hottest in the southern, and July is the hottest in the northern and coldest in the southern. I didn't expect the transition to be as sharp as it was. Obviously, local conditions will vary. I did not do this analysis for precipitation.
June 15, 2018
Temperature I: Turn Up the Heat
I'm using the guidelines here, but I'm still looking for better ways to formulate the temperature. There is a lot of cold on my world, and a lot of hot, and not a lot of in-between. This has the potential to be pretty interesting, so I'm going to leave it for now. In such a world, control of the habitable zone would be very important.
However, most of the land is already in the southern hemisphere. I have a very deliberate north-south orientation. Many maps I see have a bias to show a vast sea to the west, no doubt tapping into cultural memories of the medieval period, or Cantre'r Gwaelod-type legends. Of course, Tolkien did us no favors with Lost NĂºmenor.
I'd post more of these maps, but opening in Inkscape gives my computer a heart attack, since Inkscape refuses to render using the GPU. WHY? (I hear it's a planned feature...).
Black is cold, grey is warmer. Yes, it's confusing, but I map the value of the pixel to the temperature. So 0 (black) is -47 F, all the way up to ~147 (grey) for 100 F. That makes the programming a little easier.
I do work on the rough map in color to make it easier to parse in my head.
However, most of the land is already in the southern hemisphere. I have a very deliberate north-south orientation. Many maps I see have a bias to show a vast sea to the west, no doubt tapping into cultural memories of the medieval period, or Cantre'r Gwaelod-type legends. Of course, Tolkien did us no favors with Lost NĂºmenor.
I'd post more of these maps, but opening in Inkscape gives my computer a heart attack, since Inkscape refuses to render using the GPU. WHY? (I hear it's a planned feature...).
![]() |
| Summer temperatures |
Black is cold, grey is warmer. Yes, it's confusing, but I map the value of the pixel to the temperature. So 0 (black) is -47 F, all the way up to ~147 (grey) for 100 F. That makes the programming a little easier.
I do work on the rough map in color to make it easier to parse in my head.
![]() |
| Summer temperatures |
Subscribe to:
Posts (Atom)












