You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hadn't pulled from the develop branch in a while, but I just did this morning. In doing some calculations involving surface area I noticed some things were off. In printing a sum of the surface area returned I got a value of:
This is too large by a factor of 180.0 / pi, hinting that it stems from not converting from degrees to radians.
I think the issue stems from line 194 in model.py:
dlon=to_radians(cls.diff_bounds(lon_bounds, lon))
In my case, but I think in most cases, the width of gridboxes in longitude in degrees is less than 4 pi. This causes utils.to_radians to pass the widths back unchanged. I think a solution here would be to just apply to_radians to lon_bounds (instead of after diff_bounds):
dlon=cls.diff_bounds(to_radians(lon_bounds), lon)
Luckily this shouldn't change any results from area averaging (since it's off by a constant factor), but important to get right nonetheless.
The text was updated successfully, but these errors were encountered:
02a8a8f should resolve this. I implemented the switch you suggested and also improved the to_radians function itself, both the threshold for conversion and by trying to use the embedded 'units' metadata.
This and the other conversion methods could definitely be improved, potentially even a conversions class or module created.
(Yet another reminder of the need for formal automated tests, both so that we would have caught this in the first place and that I should have added some for the new code in order to be sure it actually works! One day...)
Let me know if there's still any problems, otherwise please close.
I hadn't pulled from the develop branch in a while, but I just did this morning. In doing some calculations involving surface area I noticed some things were off. In printing a sum of the surface area returned I got a value of:
This is too large by a factor of 180.0 / pi, hinting that it stems from not converting from degrees to radians.
I think the issue stems from line 194 in model.py:
In my case, but I think in most cases, the width of gridboxes in longitude in degrees is less than 4 pi. This causes
utils.to_radians
to pass the widths back unchanged. I think a solution here would be to just applyto_radians
tolon_bounds
(instead of afterdiff_bounds
):Luckily this shouldn't change any results from area averaging (since it's off by a constant factor), but important to get right nonetheless.
The text was updated successfully, but these errors were encountered: