[ncl-talk] Bug report, named dimensions and Netcdf-4

David Brown dbrown at ucar.edu
Mon Dec 7 14:53:39 MST 2015


Hi Dave,
I have created a ticket for this issue -- NCL-2319.
 -dave

On Mon, Dec 7, 2015 at 1:49 PM, David Brown <dbrown at ucar.edu> wrote:
> Hi Dave,
> Thanks for the report. We will look into it.
>  -dave
>
> On Mon, Dec 7, 2015 at 1:31 PM, Dave Allured - NOAA Affiliate
> <dave.allured at noaa.gov> wrote:
>> 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
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>


More information about the ncl-talk mailing list