Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cdscan path needs a patch #71
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:
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
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.