-
Notifications
You must be signed in to change notification settings - Fork 286
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
[FB] [PI-3585] Change default loading unit from "1" to "unknown" (correct branch) #3709
Changes from 4 commits
58f2509
63001bf
0a21653
17ea646
b30b0c6
b0f23a5
e568742
c0190d4
c051bb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* NetCDF files containing variables without units will be given a unit of "unknown" rather than "1" | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1651,9 +1651,9 @@ fc_extras | |
|
||
################################################################################ | ||
def get_attr_units(cf_var, attributes): | ||
attr_units = getattr(cf_var, CF_ATTR_UNITS, cf_units._UNIT_DIMENSIONLESS) | ||
attr_units = getattr(cf_var, CF_ATTR_UNITS, cf_units._UNKNOWN_UNIT_STRING) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see no need here to reference private bits of cf_units There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to change all the other references to private bits of cf_units to something similar? i.e. cf_units._NO_UNIT_STRING. |
||
if not attr_units: | ||
attr_units = '1' | ||
attr_units = cf_units._UNKNOWN_UNIT_STRING | ||
|
||
# Sanitise lat/lon units. | ||
if attr_units in UD_UNITS_LAT or attr_units in UD_UNITS_LON: | ||
|
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 needs fleshing out to make it clearer how it may affect the user.
Something like ...
"When loading data from netcdf-CF files, where a variable has no "units" property, the corresponding Iris object will have ".units='unknown'". Prior to Iris 3.0, these cases defaulted to "units=1".
This applies to cubes, coordinates, and ancillary data."