-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GRIB-2/ICON geolocation unknown or invalid for western hemisphere #1224
Comments
Looks like the data is probably 0 to 360 longitude instead of -180 to 180. There is some special handling this for lon/lat projections, but not eqc. There is even some |
What is a "lon/lat" projection? EQC = equirectangular = Plate Carrée? The |
I confirm that the longitudes go from 0 to 360, at least that's what |
"Lon/lat" is how I refer to |
When you say "special handling code", do you mean this part? Lines 145 to 147 in ab17a71
That seems to be called in any case. I don't quite understand what happens in the rest of this method. |
Ha yes, sorry, I meant to link directly to that but forgot the link. There's this part: Line 167 in ab17a71
and this part: Line 185 in ab17a71
All to handle data not being in the right order or at least not in the expected order. Since everyone uses GRIB the way they want, it was really hard to come up with something simple that worked for every file. This was as far as I got for the files I needed to support. I think if the below lines were updated: Lines 149 to 150 in ab17a71
to:
Your case might work. |
Thanks for the suggestion. Unfortunately the image still have half of the coastlines missing just like in the image I posted before. |
That could be a separate pycoast issue that I think there is an issue for but can't find it right now. Depends what the AreaDefinition is now. |
The
and it still won't let me get the |
It does enter the block starting with the comment |
Could it be a problem in ar1 = AreaDefinition("test", "test", "test", {'a': 6371229, 'b': 6371229, 'proj': 'eqc', 'over': True}, 1440, 721, (-13899.865431068225, -10021802.97580019, 40017712.576045424, 10021802.97580019))
ar2 = AreaDefinition("test", "test", "test", {'a': 6371229, 'b': 6371229, 'proj': 'eqc', 'over': False}, 1440, 721, (-13899.865431068225, -10021802.97580019, 40017712.576045424, 10021802.97580019))
print(ar1 == ar2) which gives It looks like the |
That's likely PROJ removing it. Older versions of PROJ used it as a hack. The best long term solution may be to cut the array up and reorder it to correspond to the projection. Right now the data is going from 0 to 360. The projection space though goes from -180 to 180. So in the AreaDefinition you have a non-contiguous Area: 0 to 180, -180 to 0. In meters this is probably something like ~0 to 20000000, -20000000 to 0. If the two halves of the data switched places in the array then it would work. I'm not sure there is a standard way in PROJ nowadays to be in a 0 to 360 degree space. Additionally, pyresample may have some limitations right now regarding lon/lat -> lon/lat (see pytroll/pyresample#267 and point 1). |
So probably this affect any GRIB data that has longitudes 0 to 360, not only ICON? |
I don't know what ICON is, but yes probably. Now that I think about it this probably effects the GRIB files that I was using for my SIFT project with newer PROJ versions. |
ICON is the global model developed and used by the German Weather Service (see https://www.dwd.de/SharedDocs/downloads/DE/modelldokumentationen/nwv/icon/icon_dbbeschr_aktuell.pdf) but I suspect the problem described here shouldn't be specific to ICON (i.e. there's probably nothing wrong with the ICON files; the NWCSAF software can interpret them apparently correctly). |
I have noticed a similar problem for ECMWF forecasts, which also use 0-360 for longitude. |
I've run in to this issue affecting my SIFT application. I'll see if I can come up with a fix that works with newer versions of PROJ/pyproj. |
Describe the bug
When reading ICON data in GRIB-2 format using the
grib
reader, and showing it along with coastlines, there are no coastlines for the western hemisphere. Geolocation appears to accept only longitudes between 0 and 180 degrees.To Reproduce
Expected behavior
I expect a world map with the field displayed and worldwide coastlines. This map would probably be centered on the meridian.
Actual results
The map is centered on the antimeridian and coastlines are shown for the eastern hemisphere only.
Environment Info:
Readers and writers dependencies
Additional context
The
AreaDefinition
is:The
get_xy_from_lonlat
method appears to accept only longitudes between 0 and 180. For any longitude smaller than 0 or larger than 180, it throws an exceptionValueError: Point outside area
(or issuesNaN
when passed an array).The text was updated successfully, but these errors were encountered: