-
Notifications
You must be signed in to change notification settings - Fork 300
Stashcubelist #2230
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
Stashcubelist #2230
Conversation
lib/iris/cube.py
Outdated
| units=self.units) | ||
| # If all unknown and a STASH attribute exists, use it. | ||
| if (nameunit == 'unknown / (unknown)' and | ||
| 'STASH' in self.attributes): |
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 line can be joined to the above and it'll still only be 78 characters long.
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.
And remember not to keep the parentheses.
lib/iris/cube.py
Outdated
| # If all unknown and a STASH attribute exists, use it. | ||
| if (nameunit == 'unknown / (unknown)' and | ||
| 'STASH' in self.attributes): | ||
| nameunit = '{}'.format(self.attributes.get('STASH')) |
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.
self.attributes['STASH'] ... if you wanna, as you've already checked that the STASH key is available.
|
minor changes, as per review comments |
lib/iris/cube.py
Outdated
| nameunit = '{name} / ({units})'.format(name=self.name(), | ||
| units=self.units) | ||
| # If all unknown and a STASH attribute exists, use it. | ||
| if (nameunit == 'unknown / (unknown)' and 'STASH' in self.attributes): |
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.
No need for parentheses when on one line.
|
Does this affect how |
this doesn't change cube print I think this is a reasonable change, as most code will use print and this will still say the aim is to improve the printing of cube lists, where there is unknown name and unknown unit |
|
OK great, thanks for clarifying @marqh. |
|
One last thing then: did you consider |
I did consider this; in principal we shouldn't have a name without a unit, so if we're falling back to STASH, we already don't have a unit i do wonder whether |
|
I guess the current strategy is fine, and really shines when someone knows what a STASH is and realises it probably tells them everything they need to know (or equips them with what they need to query with their data provider). |
|
@marqh Did you consider something like Would that be more meaningful/helpful to those users who are not stash savvy? |
|
It would certainly make it clear that the presented information was different somehow from the normal presentation of name and unit. |
I am content to do this, if you think it helps, though I don't like the I'm keen to converge on one solution, so far we have
please vote for your favorite or nominate another representation. I'll code up the preferred solution |
|
I don't like 3, there are too many colons already in cubelist printouts. Number 2 is my next least favourite (I know, I brought this up...). I'd go with number 4, but if there are objections to this then my next choice is plain old number 1 (i.e. no change). |
|
Apologies, I've been distracted ... Okay, so I'm kinda in agreement with @ajdawson ... but I don't want this to be a thing, so old number 1 it is. By golly I think we have a quorum! |
usability tweak to
CubeList.__str__to print a STASH code, if it exists and otherwiseunknown / (unknown)would otherwise be returned