Skip to content

cdscan path needs a patch #71

@painter1

Description

@painter1

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions