-
Notifications
You must be signed in to change notification settings - Fork 298
Add GRIB save GDT12 (Transverse Mercator) #1477
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aah. Removing these wasn't strictly accurate - it's not that GDT12 doesn't set these, it's more that GDT12 calls these keys something different to what GDT0/1 do. I'll push a fix for this presently...
There's no need for the test coverage to be limited by the bug in the ECMWF GRIB API. Just as you've patched |
Have you raised this on the ECMWF's bug tracker? |
Good point, I'll add a commit soon that addresses this.
Not yet but I will. |
I have a work-around on its way... |
|
|
This commit fixes an issue with the horizontal grid not being set and adds some tests for saving GDT12. While I'm waiting for the dust to settle around casting floats as signed ints and casting signed ints as unsigned ints, I've replaced the exception raised when setting the key I've also adjusted the function |
2119b9b to
ab6baf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you generalised it, I think the names here are now rather misleading -- they are now really "X and Y" rather than "latitude and longitude".
You should rename the variables, and edit the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
|
All good I think
|
|
Review actions - hitting @pp-mo's comments above. |
80d94b1 to
983f8af
Compare
983f8af to
c0decef
Compare
Add GRIB save GDT12 (Transverse Mercator)
|
Sorted !! |
|
🎉 |
This adds functionality to Iris that allows cubes on a Transverse Mercator grid to be saved to a GRIB2 message. This functionality is contained in a new
_save_rulesfunction calledgrid_definition_template_12.Please note however that this does not currently work due to a bug in GRIBAPI that means the only key in GDT12 that is specified as being a
float32by the GRIB spec is set as a signed int by the GRIBAPI template. On account of this,_save_rulesraises aTranslationErrorwhen trying to save a cube with a Transverse Mercator grid to GRIB.The other changes I've made to get this "working" are:
fileformats/grib/__init__that locates the horizontal dim coords of the cubes to find any horizontal dim coords rather than onlyLatitudeandLongitude.ellipsoidthat defines the shape of the earth for the saved GRIB message has been improved. This was done because the previous logic did not cater for a non-Rotated Pole coord system with an ellipsoid defined.latlon_commonas it turned out they weren't common to GDT12. Specifically, GDT12 does not define lat/lon for first and last grid points or dx/dy.gribapi.grib_setfor writing GRIB message key values, I've added a trap for calling this function to the grib save rules tests__init__. The test module itself for this change is very short as callinggrid_definition_template_12will currently always result in aTranslationError.