[ncl-talk] Bug report, named dimensions and Netcdf-4
Dave Allured - NOAA Affiliate
dave.allured at noaa.gov
Mon Dec 7 13:31:05 MST 2015
NCL team,
I found this problem with named dimensions in NCL 6.3.0 on both Linux and
Mac OS. The dimension name reference operator "!" gets the wrong dim name
when used with a Netcdf-4 file variable, under some circumstances. Can you
please fix this for the next release? Thank you.
Sample input file:
> ncdump -hs test5.nc
netcdf test5 {
dimensions:
lat = 3 ;
lon = 4 ;
time = 2 ;
variables:
float time(time) ;
time:_Storage = "contiguous" ;
float lon(lon) ;
lon:_Storage = "contiguous" ;
float lat(lat) ;
lat:_Storage = "contiguous" ;
float precip(time, lat, lon) ;
precip:_Storage = "contiguous" ;
// global attributes:
:_Format = "netCDF-4" ;
}
Bug demonstration. The correct answer, "time", is obtained with the second
and third methods shown:
NCAR Command Language Version 6.3.0
ncl 0> f = addfile ("test5.nc", "r")
ncl 1> print (f->precip!0)
(0) lat ******** WRONG RESULT
ncl 2> x = f->precip
ncl 3> print (x!0)
(0) time
ncl 4> dims = getfilevardims (f, "precip")
ncl 5> print (dims(0)+"")
(0) time
Notes:
1. The problem seems specific to only the full Netcdf-4 format. I did not
see this problem with Netcdf-3 or Netcdf-4 classic. My testing was limited.
2. The problem depends on the order of dimensions as originally defined in
the Netcdf-4 file. In the demo above, notice that time is the first
dimension in the data variable, but it is NOT the first defined dimension
in the file. When time is the first defined dimension, the problem goes
away.
3. It does not make any difference whether the storage mode is contiguous
or chunked.
--Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151207/30671128/attachment.html
More information about the ncl-talk
mailing list