[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDFJava #LUX-868625]: From ncML to netCDF file using netCDF-Java: FillValue is not handled properly
- Subject: [netCDFJava #LUX-868625]: From ncML to netCDF file using netCDF-Java: FillValue is not handled properly
- Date: Thu, 22 Feb 2018 01:00:04 -0700
Hi Daniel,
I've answered this question on GitHub. See
https://github.com/Unidata/thredds/issues/1036.
Cheers,
Christian
> Full Name: Daniel Risquez
> Package Version: 4.6.11
> Operating System: Linux version 3.1.10-1.29-desktop (SUSE)
> Hardware:
> Description of problem: I am generating an empty netCDF file using the ncML
> description as input. However, I cannot define a FillValue for these
> variables.
>
> This issue could be related to "Ncml mishandling signedness" #923.
>
> I follow these steps:
>
> The following ncML code is the input description. It only defines 2 variables
> (short and unsigned short), and tries to set their FillValue attribute to
> "1". Note: the same problem is applicable to other data types as double,
> float, int, etc).
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ncml:netcdf
> xmlns:ncml="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
> <ncml:variable name="my_short" shape="" type="short">
> <ncml:attribute name="_FillValue" type="short" value="1"/>
> </ncml:variable>
> <ncml:variable name="my_ushort" shape="" type="short">
> <ncml:attribute name="_Unsigned" value="true" />
> <ncml:attribute name="_FillValue" type="short" value="1" isUnsigned="true" />
> </ncml:variable>
> </ncml:netcdf>
>
> I generate the netCDF file using this command:
>
> java -Xmx1g -classpath netcdfAll-4.6.11.jar ucar.nc2.write.Nccopy --input
> test_FillValue.ncml --output test_FillValue.nc --format netcdf4
>
> (Note: I am using the latest netCDF-Java library, 4.6.11 from 4/Dec/2017; and
> Java 1.8.0).
>
> I dump the netCDF file with the usual command (netCDF-C version 4.3.2):
>
> ncdump -s test_FillValue.nc
>
> and the output is:
>
> netcdf test_FillValue {
> variables:
> short my_short ;
> my_short:_FillValue = 1s ;
> my_short:_Endianness = "little" ;
> ushort my_ushort ;
> my_ushort:_Unsigned = "true" ;
> my_ushort:_Endianness = "little" ;
> // global attributes:
> :_Format = "netCDF-4" ;
> data:
> my_short = -32767 ;
> my_ushort = 32769 ;
> }
>
> The data value for the "short" data type equals NC_FILL_SHORT=-32767, ok, its
> default value (NC_FILL_SHORT). However, I defined it equal to "1"!).
> In addition, the value for the "ushort" is 32769. It is not "1" (what I
> defined as FillValue), neither 65535 (default FillValue, NC_FILL_USHORT).
> https://www.unidata.ucar.edu/software/netcdf/docs/netcdf_8h_source.html
>
> Summarizing:
> * FillValue attributes cannot be defined for any data type using the
> netCDF-Java library and ncML as an input (no problem with other attributes,
> or attributes starting by underscore like "_example"). Is this a bug?
> * When the FillValue is defined, automatically all data should be populated
> with that value (and therefore it requires some processing time). Am I
> correct?
> * Default FillValue attributes for unsigned data types do not match their
> default values.
>
> Note: this requested was initially posted here:
> https://github.com/Unidata/thredds/issues/1036
Ticket Details
===================
Ticket ID: LUX-868625
Department: Support netCDF Java
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata
inquiry tracking system and then made publicly available through the web. If
you do not want to have your interactions made available in this way, you must
let us know in each email you send to us.