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
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.
The text was updated successfully, but these errors were encountered:
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.