Closed jlegewie closed 11 months ago
Thanks for noticing. Why one Earth do we have that if/else statement one line 747...? It has to do with negative coordinates but there is something strange here...
I checked. I think the if statement can be removed. I will approve this and remove the if/else-statement later.
I didn't get the if/else either... and looked 5 times for a difference... 😆 But I also didn't think through negative coordinates...
I think the
poisxy
is not calculated correctly insolweig_algorithm.py
and is off by 1 in many cases in both the x and y dimension. As a result, the POI calculation uses the wrong cell for thetmrt
value and other things are probably off as well.Currently, the cell number in the x-dimension is calculated like this:
However, the rounding leads to wrong cell numbers in some situations.
Take the following raster:
And a point right in the middle at
x = 3
,y = 3
, which should be in cell 1, 1. However, solweig gets the wrong point:This pull request instead uses the following code to calculate the point location and a similar logic for the y-dimension.