-
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
Default units #3585
Comments
Ping @SciTools/iris-devs |
My initial reaction is that they should all be "unknown", as it currently is for cubes, for similar reasons that the name is "unknown" unless otherwise specified. Are there any cases where it would be reasonable for the user to expect a default unit? |
@lbdreyer I'm not 100% confident, but I don't think so... To me it seems sensible to assume a default of I can't recall the history behind this decision, and I'm sure that it must have been debated at some point. It's probably goes way, way back to the origin of I can only assume that the default of Otherwise, at the moment I'm erring on the blanket default of |
IIRC it comes from section "3.1. Units" that states:
That said, that statement in the CF conventions strikes me as decidedly questionable! It would have been safer to define a missing units attribute as "the units have not been defined" / "the file is not CF-compliant"... but as you know, that kind of sloppy pattern is all too common in the CF conventions. 😑 Sorry... no more whinging about the conventions, I promise! My 2p ... the defaults for the in-memory objects should be |
Just looking at some AuxCoords I have where the points are strings. In this case it doesn't really make sense that the units are |
Just to put this on the table. |
From further on in "3.1. Units"...
Two examples of dimensionless units are then given: "1" and "1e-6". I think it is incorrect to equate "dimensionless" with "having '1' as a unit". By my understanding of the CF conventions, I believe it is acceptable (and probably correct) to apply a unit of |
After an offline conversation with @stephenworsley, we tended towards the following
for saving:
for loading:
In general:
|
Nice summary! ( I just deleted previous comments on "units is None". Re-reading, I think you ruled that out. ) |
In view of the now proposed #3705, are we happy that the Coord constructors still give a default units='1' ? |
Just to add some fuel. I think all of these problems stem from that questionable CF statement :
This is quoted by both @rhattersley and @stephenworsley above, and I must agree here with @rhattersley that "that statement in the CF conventions strikes me as decidedly questionable" !! The problem as I see it, is that when in a scientific context you say that a numeric value is "dimensionless", this normally only means that it has no physical unit (e.g. length or time), and is equivalent in dimensional analysis to a "pure ratio" : That doesn't mean it has no scale reference -- it could be a fraction, a percentage, an angle, an angle cosine ... So, in addition to what @stephenworsley has said -- that dimensionless is not simply the same as '1', I would add that "unitless" is not at all the same as "dimensionless" ! CF has managed to confuse these things by stating that no stated unit is equivalent to "dimensionless", which is practically the same as saying it defaults to a unit of '1'. So, if we try to rationalise the "unreasonable" CF rule, our interpretation will break, for any file data that doesn't specify a unit but "expects" to be interpreted as a dimensionless numeric value, like a factor or proportion. E.G. it could be fractional measures, or even percentages. Whereas, the CF approach is pragmatically safer, because for calculations it will "do less harm" to assign a unit to something that doesn't have one, than to treat something as unitless when that might not have been intended : I think we have a conflict here, between what is sensible for our internal logic and operations, and the desire to preserve logical distinctions for "roundtrip" of data, i.e. saving what was in the original file. We need to be able to argue that the problem cases will be rare and acceptable. This a lot like the problems we have had with fill-value, and masking : More logical interpretations often cause practical problems, because the rest of the world is not sufficiently logical 😉 |
Quote of the year 👍 😁 |
I personally think that no matter what we do, something will definitely break for someone; hence why this needs to be resolved for In light of the logical pea soup that is CF, we just need to give clarity through being opinionated. Otherwise there is a very really danger that this is all going to be really quite confusing, and personally I'd rather err on the side of clarity through keeping things really simple (just like myself). Remember we need to explain all this nonsense to the user. Occam's Razor, and all that. So, one persons sensible default is not necessarily another's, and yet we need to square that circle... and that's not really possible, unless I'm missing something totally obvious (which wouldn't be the first time). For what it's worth, I'd naively opt for a blanket You could argue that it's lazy to rely on implementation defaults particularly if you care about your metadata. So if you really care i.e., really, really care, then be explicit. The user knows their data, we don't, so the simple message is, "if you care about the |
Just to add another case to consider. iris.coord_categorisation.add_categorised_coord() also has a default unit (currently "1") which will have to be decided on. |
See #3708 for the initial progress implementing these changes. A summary based on the above discussion as to how we are interpreting the differing "unite types" is also included (see the "Context" section in the issue description). |
Currently
iris
implements the following defaultunits
for its containers (ignoringAuxCoordFactory
here, as theunits
of the resultant derived coordinate is determined from theunits
ofAuxCoordFactory
coordinate dependencies)_DimensionalMetadata
no-unit
AncillaryVariable
no-unit
AuxCoord
1
CellMeasure
1
Coord
1
Cube
unknown
DimCoord
1
Are these sensible defaults?
I think that we should answer this question as part of the MVP of
3.0.0
.Checkout these related issues/PRs :
The text was updated successfully, but these errors were encountered: