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.
This line can be joined to the above and it'll still only be 78 characters long.
There was a problem hiding this comment.
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.
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.
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