NetCDF variable names and merging

61 views
Skip to first unread message

marqh

unread,
May 3, 2013, 8:50:21 AM5/3/13
to scitoo...@googlegroups.com
recently variable names from imported NetCDF files have been added to Cubes by default, as a top level attribute on a cube

cube.var_name

I was slightly surprised to find this at the cube level, rather than in the attributes dictionary.  I also found a functional issue which surprised me and caused me a few issues.

When I come to merge Cubes, the var_name is compared and if it does not match, the cubes do not merge  This is a surprising result for me.  Additionally, it is not just the cube that exhibits this, it is also all the coordinates.

I think that the NetCDF var_name is not a CF semantic container

To get merge to operate how I expected it to I had to iterate through my Cubes and all of their coordinates and delete the var_name attribute before the Cubes would merge.

This doesn't seem right to me

Richard Hattersley

unread,
May 3, 2013, 11:24:55 AM5/3/13
to scitoo...@googlegroups.com
> I was slightly surprised to find this at the cube level, rather than in the attributes dictionary.

Essentially we made it separate because it is separate in CF-netCDF. For example, it's quite possible in CF-netCDF to have a variable with an attribute of "var_name" which bears no relation to the variable name.


> When I come to merge Cubes, the var_name is compared and if it does not match, the cubes do not merge.

This looks like a bug to me too. As far as CF is concerned, the var_name doesn't mean anything so it should not be used as part of the identity of a Cube. However, if all the source Cubes for a merge operation share the same var_name (and there are often cases where there is only a single Cube, so this is definitely true) then it makes sense for the result to maintain the same var_name.

Richard

Phil Elson

unread,
Oct 14, 2013, 11:59:37 AM10/14/13
to scitoo...@googlegroups.com
For the record, there is a github issue for this https://github.com/SciTools/iris/issues/512.

Reply all
Reply to author
Forward
0 new messages