Skip to content
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

cdscan path needs a patch #71

Closed
painter1 opened this issue Jan 5, 2017 · 1 comment

Comments

@painter1
Copy link
Contributor

commented Jan 5, 2017

Some time ago, I had encountered a problem where cdscan was dropping some small axes needed for cloud variables. I had fixed it by adding a dummy variable which used the axes, all_axes_dummy.

Of course, all_axes_dummy is a TransientVariable. But all the other variables are FileVariables, hence DatasetVariables. A TransientVariable is a numpy masked array, and hence contains an integer-valued variable 'size'. A DatasetVariable isn't, but contains a method size() which returns an integer. This could become a problem somewhere around line 1180:
sepname = disambig(var.id, vardict, var.size(), compareVarDictValues, (tempdomain, None))

And it really does become a problem on ERBE obs data. This has a little axis date, length 1, which looks to the other code like one of those cloud axes. So all_axes_dummy is created, and then eventually fails at that sepname computation.

There are many ways around this problem. The simplest to replace
var.size()
with
numpy.ma.size(var)
The only qualm I have is that FileVariable doesn't inherit from numpy, so I'm not sure that we can rely on numpy.ma.size(var) to always work. Maybe we can, but if we can't there are alternative solutions.

@doutriaux1 doutriaux1 added the bug label Jan 5, 2017

@doutriaux1 doutriaux1 added this to the 3.0 milestone Jan 5, 2017

@painter1

This comment has been minimized.

Copy link
Contributor Author

commented Jan 5, 2017

On further investigation, I see that the array method of FileVariable makes a FileVariable an "array-like" object: numpy.ma.array() can convert a FileVariable to a numpy array, and thus we can count on numpy.ma.size(var) (which indirectly calls numpy.ma.array) to work on a FileVariable.

@doutriaux1 doutriaux1 assigned dnadeau4 and unassigned dnadeau4 May 5, 2017

dnadeau4 added a commit that referenced this issue Oct 12, 2017

@dnadeau4 dnadeau4 closed this in b149676 Oct 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.