welcome guest
login or register

22nd of March 2015

dual screen programming
157 users have voted, including you.


The laptop display shows real world weather statistics from recent days. The monitor on the right shows my code, as I'm working on how sunshine affects temperature. Sure, in the night the temperature is lower, and on a sunny day it gets warmer - but how much? And, if the night sky is overcast, the temperature doesn't drop as much as it does if the sky is clear. All this has to be turned into functions and variables in my weather engine.

OK, I found a real world graph, which shows the average difference of night / day temperatures, per month. The blue line shows the values in Southern Finland, the red line is for Lapland. The graph on the left shows temperature difference when the sky is clear. And the graph on the right has values for cloudy weather. So, now I need to figure out an algorithm which would produce about same kind of curves.

I like to use this online regression calculator to help find equations that approximate real-world collections of data.


Wow! That one seems pretty interesting, thanks for the link!

Any luck? This sounds like a very interesting problem...

I have written code to generate land masses, but when it comes to populating them with biomes, I get all stuck trying to do it "properly" (taking rain shadows and trade winds into account, etc, etc) and end up just "faking" it, lol. And then I steal the tables out of the AD&D 1st Edition Wilderness Survival Guide for generating temperature and weather, haha.

I guess it gets easier when you have a virtual land mass based on a real-world one like y'all do! That is cool. I need to make more time for writing code again... Maybe when my house is fixed up a little more... ... ...

Ah, yes - actually I solved this soon after posting the picture. It was relatively simple:

I already have simulation for sun position, which takes observer latitude and time of the year into account. So, days get shorter in winter and longer in summer - the more so, the norther you go. Then I only needed to make it so that when sun is down, temperature goes slightly lower - and when sun is properly up, the temperature gets warmer. Which then naturally leads to the desired effect : in the winter sun doesn't rise very high, so it only has a tiny effect on temperature. In the spring time the base temperature is still low, but increased amount of sunlight makes the temperature rise during the day (and fall again in the night). Then, in the summer sun hardly sets, so once again there isn't that much difference in day / night temperatures. Simple as that =)

(well, to make it even more detailed it should be so that the warming effect of sunlight is increased if there is snow on the ground, as white snow reflects the sunlight, warming the air above it. In the south snow melts sooner in the spring, but in the norht there is more snow - thus there is more dramatic change in day / night temperature, especially in March / April. But I was too lazy to implement this - maybe later on =) )


Add new comment

Please reply with a single word.
Fill in the blank.