Tuesday, January 26, 2021

Rain shadows in the regions

 Consider this regional map from an earlier version of Undiscovered Worlds:


There is rain coming in from the north and east of that mountain range. The mountains are stopping it, creating desert beyond - but the rain extends for some way past them, as if it hasn't quite realised it's hit the mountains.

This is caused by two things. First, precipitation at the global level was being calculated several cells at at time: every "splash" of precipitation covered an area. That meant that when precipitation fell on mountains, it would fall around them too, on both sides. Second, when the precipitation maps were smoothed, no account was taken of mountains, which meant that precipitation was effectively smeared over the map into places it shouldn't have been.

In my recent climate overhaul, both of these issues have been addressed. Global precipitation is now calculated with a much finer grain. And the smoothing routines now take mountains into account: precipitation from one cell can be averaged with precipitation from another cell only if there is a route between them that isn't blocked by mountain ranges. This means that when mountains block precipitation, they really do block it. As a result, we get regional maps like this:


Here, you can see a clear difference between the wetter land to the west of the mountains and the drier to the east, without any jarring bleed over from one side to the other. (I'm aware, by the way, that it's not tremendously realistic to have rivers flowing parallel to mountain ranges or even edging towards them like that, and doing some tinkering to prevent it is on the to-do list.) Here's what the precipitation map looks like of this region:


That shows the difference, and the sharpness of the transition, even more clearly.

Now you'll notice on that precipitation map that the mountains themselves experience higher precipitation even than the coastal strip to the west, as they should. But those areas of higher precipitation on the mountains look quite blocky. That's an inevitable consequence of the changes I made to the global precipitation model: precipitation over mountains isn't being smoothed any more, for fear of messing up the rain shadows, and so there are sharp transitions from one cell to the next. That is reflected on the regional map with these square blocks of precipitation.

When I was reworking the global precipitation, I anticipated that this would happen, and I was worried that it would look dreadful on the regional map. I was pleased to see that, although the precipitation map does display the expected blockiness, this isn't reflected in the regional map, or indeed the climate map. That's because these blocks of precipitation are over mountains, which have dramatically varying elevation, which disrupts any visual artefacts that the blocky precipitation areas might create.

But on lower mountain ranges, the effect is much more noticeable:


In this region the mountains are lower and there is only a fairly slight rain shadow, but there is still higher precipitation in the mountains, and you can see there are blocks of heavy precipitation on tiles where the mountain ridges aren't as high or extensive as those in the previous examples. As a result, the heavy precipitation is visible on the flat land around, creating those ugly green splodges. So, annoyingly, I'm going to have to do something about this.

The first step is this. As things currently stand, the precipitation in the relief map is calculated by means of a diamond-square algorithm over the whole map. This is seeded using the precipitation values in the global map for the relevant tiles. It's fairly straightforward to change things so that for any tile containing mountains, the precipitation map for that tile is instead seeded using the precipitation value that is the average of all surrounding tiles that don't contain mountains. If there are none (i.e. if this is a tile entirely surrounded by mountainous tiles), it uses the average of all of the seeds being used by its neighbouring mountainous tiles. In this way, every tile that has mountains in has its precipitation calculated as if it didn't, effectively. That means the precipitation will be lower. 

That yields this:


This is much better. There are a couple of rather annoying straight artefacts there, with the greener areas around some of the mountains in the middle, but it's much better than what we had. I'm not sure what's causing those - there isn't substantially higher rainfall there - I think that the algorithms I'm using to blend the colours in the relief maps have become a bit too sensitive to higher rainfall and are too enthusiastic about making it show greener. Some tinkering will need to be done there too.

Now we need to put the mountain precipitation back again, but only on the actual mountains themselves. For each tile where we've reduced the precipitation in the way described above, we'll assume that the wind is blowing from the neighbouring tile with the most precipitation that isn't a mountain tile. Then all we have to do is go through our tile, and wherever there's a slope going upwards in the direction that the wind is blowing, we'll increase the precipitation.

Here's the resulting precipitation map for that region:


Compare that to the elevation map for the same region:


As always, it's not perfect, but I think it's much better than what we had before.

The effect isn't as good on more substantial mountain ranges, where the precipitation looks a bit of a mess:


Here, though, the mountains themselves are craggy enough to mask all this, so the relief map looks OK:


You'll notice that there's still some bleeding of rainfall going over these mountains - some green areas to the northeast, and around that massif that extends out into the drier plains. I think this is caused by the fact that there are gaps in this range, and so the rainfall smoothing routines at the global level are allowing some tiles on one side of the range to be influenced by the rainfall in tiles on the other, as there's a clear (though not straight) path between them. Maybe that's OK. And only some ranges are having this effect - you can see on the others I've posted it's happening far less. And even more importantly, I think it's still far better than what I had to start with - compare this to the first picture up above!

1 comment: