Skip to content
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

Scale offset pack #15

Merged
merged 3 commits into from
May 1, 2024
Merged

Conversation

mo-marqh
Copy link
Member

@mo-marqh mo-marqh commented May 1, 2024

new demonstration code of netCDF scale+offset packing using XIOS in-built functionality

@mo-marqh mo-marqh requested a review from harry-shepherd May 1, 2024 09:56
@mo-marqh
Copy link
Member Author

mo-marqh commented May 1, 2024

there are some interesting facets here, it's worth checking out the code and having a look at the output file

different tools have different levels of awareness, by design, so an ncdump of the output file will show a variable of type short with integer values and metadata attributes defining a scale_factor and add_offset, as defined in the XIOS XML:
https://github.com/MetOffice/tcd-XIOS-demonstration/pull/15/files#diff-069187adc21ab09db30167612038510675baba4c7e4c33f2a048f0b10a7281b5R21

reading in the file with netcdf4python:
https://github.com/MetOffice/tcd-XIOS-demonstration/pull/15/files#diff-e84aaa3e4c21c186a5938c66cd4238b2b864d7259121ff57306dae204f806623R44
automagically recognises this configuration and provides an array in memory of floating point values, unpacked from the integers to the encoded precision

Copy link
Collaborator

@harry-shepherd harry-shepherd left a comment

Choose a reason for hiding this comment

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

Hi Mark, this looks good - I have just one comment:

I think there needs to be an __init__.py file in packing_scale_offset, to allow the test to be discoverable.

@mo-marqh
Copy link
Member Author

mo-marqh commented May 1, 2024

related to #16 (only addressing part of these requirements)

Hi Mark, this looks good - I have just one comment:

I think there needs to be an __init__.py file in packing_scale_offset, to allow the test to be discoverable.

yikes
yes indeed, all the tests passed as the new one wasn't discovered /o\

@harry-shepherd harry-shepherd merged commit 58bac13 into MetOffice:main May 1, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants