-
Notifications
You must be signed in to change notification settings - Fork 44
Save GDT20 - Polar Stereographic #122
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
| Stereographic, | ||
| LambertConformal, | ||
| AlbersEqualArea) | ||
| from iris.cube import Cube |
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.
Unused imports...
| # Is this a north or south polar stereographic projection? | ||
| if cs.central_lat == -90.0: | ||
| # XXX: is this the correct value? We read bit 0x80 in load, but set bit | ||
| # 0x1 when saving GDT30... |
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.
I don't know, is it the correct value? This is a very unnerving comment.
I reckon it is though. At any rate, it seems to line up with GDT3.30, so I'm good with that.
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.
Hot News
short version : No, this isn't the correct value, it should be 0x80.
long version : because in GRIB terminology "bit 1" is the most-significant (top) bit, i.e. 0x80, and "bit 8" is the least(bottom) i.e. 0x01.
So, this is already wrong in the existing code here, where it has
centre_flag = 0x0 if poliest_sec > 0 else 0x1
Whereas, just above that here the code uses the magic global _RESOLUTION_AND_COMPONENTS_GRID_WINDS_BIT to set a value, and checking where that value is defined, this one is correct
-- i.e. for grib 'bit 5' we use '1 << 3'.
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.
This is a very unnerving comment
Yup, it is. I assumed that it should be 0x80 but it was a bit odd that the GDT30 saver did not set that value...
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.
it was a bit odd that the GDT30 saver did not set that value
Bugs in existing implementation -- doesn't sound that unusual to me 🤣
corinnebosley
left a comment
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.
Looks good to me. I'm happy with it.
|
I'm not happy with this as-is, 'cos I think we have some outstanding problems + we want some more real(er) testing. Given the bug uncovered above, I'm thinking that at least one of NorthPolar/SouthPolar will currently fail a save-then-load roundtrip check. |
|
@DPeterK Fancy re-basing? 😄 |
|
@bjlittle on it! |
|
@pp-mo Do you fancy taking this PR on, and getting across the finish line? |
Add save support for Grid Definition Template 20 - Polar Stereographic.