pySTEPS / pysteps

Python framework for short-term ensemble prediction systems.
https://pysteps.github.io/
BSD 3-Clause "New" or "Revised" License
441 stars 160 forks source link

Fix for projections using a spherical earth #336

Closed mpvginde closed 1 year ago

mpvginde commented 1 year ago

Some projections use a spherical earth. This is indicated in the proj4-string by either
the +R=... identifier or
by setting the +a= and +b= equal.

In both cases the parse_proj4_string returns a dict with the R-key, but this key is not checked by proj4_to_cartopy resulting in the default WGS84 globe for the cartopy CRS, giving small differences in the locations of the gridpoints.

This is now fixed by explicitly checking for the R-key in proj4_to_cartopy and defining the correct globe keywords.

I needed this to take advantage of the plot_precip_fields function for plotting precipitation coming from the ALARO NWP model.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 33.33% and project coverage change: -0.02% :warning:

Comparison is base (57ece43) 83.34% compared to head (8856d5c) 83.33%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #336 +/- ## ========================================== - Coverage 83.34% 83.33% -0.02% ========================================== Files 161 161 Lines 12355 12358 +3 ========================================== + Hits 10297 10298 +1 - Misses 2058 2060 +2 ``` | Flag | Coverage Δ | | |---|---|---| | unit_tests | `83.33% <33.33%> (-0.02%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pySTEPS#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/pySTEPS/pysteps/pull/336?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pySTEPS) | Coverage Δ | | |---|---|---| | [pysteps/visualization/utils.py](https://app.codecov.io/gh/pySTEPS/pysteps/pull/336?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pySTEPS#diff-cHlzdGVwcy92aXN1YWxpemF0aW9uL3V0aWxzLnB5) | `56.42% <33.33%> (-0.51%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dnerini commented 1 year ago

Hi @mpvginde thanks for the contribution! @pulkkins do you want to take this?