-
Notifications
You must be signed in to change notification settings - Fork 11
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
ordered
errors for all but cell method constructs
#122
Comments
ordered
method not processing constructs other than cell methodsordered
method errors for all but cell method constructs
ordered
method errors for all but cell method constructsordered
errors for all but cell method constructs
Hi @sadielbartholomew, the short answer is that in the current CF data model, cell method constructs must be orderable but there is no defined ordering for any other type of construct (such as dimension coordinate constructs). Would this change to the docstring work?
|
Just had a look around the code a bit more .... (e.g. Lines 256 to 257 in e908dc8
I'm reminded that some of this logic stems from the fact that pre Python3.7 we needed to use How does that sound? |
Thanks for the clarification @davidhassell. That makes sense, though as it is currently I don't think that context is clear (I certainly got confused as you can see!).
That makes it much clearer, thanks. Would you like to make that change or shall I (I guess we can't drop 3.6 support immediately for the next release)?
Brilliant, let's do that. Simple and means we don't need to treat cell methods as the one orderable special case. |
Hi @sadielbartholomew - great, sounds like we have a plan, then. I'm happy to make the suggested change to the docstring for now, and we'll refactor the |
Great, thanks @davidhassell. |
On the latest
master
theordered
method on aConstructs
class appears to successfully return only for cell methods, returning aValueError
for aConstruct
object containing any other valid and same-type constructs, e.g:where the output lines before the tracebacks are emerging because I added the following
print
call into the method for debugging:and the first print item is always
{'cell_method'}
, demonstrating that only cell method constructs seem to be able to be ordered by the method. But that doesn't seem right, especially as this is a generic construct method as implied by the docstring?It appears that, once same-type constructs are input, it reaches final logic that only deals with cell method constructs because only they get added to the
_ordered_constructs
instance attribute dict in the line:cfdm/cfdm/core/constructs.py
Line 248 in e908dc8
Note that this behaviour gets passed downstream and also manifests in cf-python (the initial code snippet above has the same results when
cf
is substituted forcfdm
).@davidhassell it would be useful to hear you thoughts: should other types of constructs be processed and if they should, is it the case, as I suspect and as implied by this line in the docstring:
cfdm/cfdm/core/constructs.py
Lines 1205 to 1206 in e908dc8
that cell methods should be treated as a special case such that some logic is missing to handle the ordering of all other constructs? Thanks.
The text was updated successfully, but these errors were encountered: