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

Include the UM version as a field property when reading UM files #778

Merged
merged 6 commits into from
Jun 11, 2024

Conversation

davidhassell
Copy link
Collaborator

Fixes #777

Changes to:

  • cf/weights.py
  • cf/field.py
  • cf/test/test_Data.py

are not relevant to this PR, but are just some linting that crept in from somewhere else.

@davidhassell davidhassell added enhancement New feature or request um/pp Relating to UM or PP format files netCDF read Relating to reading netCDF datasets labels May 30, 2024
@davidhassell davidhassell added this to the NEXT VERSION milestone May 30, 2024
Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

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

One small code-related suggestion, but overall this is all good. Please merge when ready.

# Convert the UM version to a string and provide it as a
# CF property. E.g. 405 -> '4.5', 606.3 -> '6.6.3', 1002
# -> '10.2'
a, b = divmod(int(self.um_version), 100)
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering why, for the fraction component, you didn't just accept the raw numeric and then seeing this I realise it is to do with the floating point conversion:

>>> divmod(606.3, 100)
(6.0, 6.2999999999999545)

Might be worth a one-line comment, since I was curious enough to look into that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea: b0119f5

@davidhassell davidhassell merged commit e367231 into NCAS-CMS:main Jun 11, 2024
@davidhassell davidhassell deleted the um-version branch June 11, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request netCDF read Relating to reading netCDF datasets um/pp Relating to UM or PP format files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request UM version to be passed through pp conversion
2 participants