Skip to content

Conversation

@DPeterK
Copy link
Member

@DPeterK DPeterK commented Jun 13, 2018

Add save support for Grid Definition Template 20 - Polar Stereographic.

Stereographic,
LambertConformal,
AlbersEqualArea)
from iris.cube import Cube
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports...

@coveralls
Copy link

coveralls commented Jun 13, 2018

Coverage Status

Coverage increased (+0.06%) to 86.072% when pulling cfea683 on DPeterK:save_gdt20 into 8344a57 on SciTools:master.

# 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...
Copy link
Member

@corinnebosley corinnebosley Jun 14, 2018

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.

Copy link
Member

@pp-mo pp-mo Jun 14, 2018

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'.

Copy link
Member Author

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...

Copy link
Member

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 🤣

Copy link
Member

@corinnebosley corinnebosley left a 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.

@pp-mo
Copy link
Member

pp-mo commented Jun 14, 2018

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.
That's a good reason for adding one before merging this.

@bjlittle
Copy link
Member

bjlittle commented Mar 7, 2019

@DPeterK Fancy re-basing? 😄

@DPeterK
Copy link
Member Author

DPeterK commented Mar 11, 2019

@bjlittle on it!

@bjlittle
Copy link
Member

@pp-mo Do you fancy taking this PR on, and getting across the finish line?
🚗 🏁

@lbdreyer lbdreyer modified the milestones: v0.15, v0.16.0 Dec 9, 2019
@pp-mo pp-mo added the Type: Technical Debt known issues left over from incomplete work label Mar 20, 2024
@CLAassistant
Copy link

CLAassistant commented Apr 8, 2024

CLA assistant check
All committers have signed the CLA.

@trexfeathers trexfeathers self-assigned this Apr 9, 2024
@pp-mo pp-mo self-assigned this Apr 11, 2024
@pp-mo pp-mo removed the request for review from kaedonkers April 11, 2024 09:04
@pp-mo pp-mo closed this in #405 Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants