Re: [netcdf-java] Issue writing Netcdf4 unsigned int

Hi Mike,

Yep, this is a bug. I've put together a fix [1] that will appear in
NetCDF-Java v4.6.9 (and 5.0.0).

Thanks for the report!
-Christian

[1] https://github.com/Unidata/thredds/pull/771

On Wed, Mar 1, 2017 at 5:26 PM, Gangl, Michael E (398H) <
Michael.E.Gangl@xxxxxxxxxxxx> wrote:

> Hi all,
>
>
>
> I’ve got a program that takes multiple files (HDF, NetCDF) and merges them
> into a single file. While this works for most files I’ve encountered, there
> is an issue I run into when I’m writing unsigned integer types (unsigned
> bytes are ok for now):
>
>
>
> java.io.IOException: Unknown userType == 9
>
>                 at ucar.nc2.jni.netcdf.Nc4Iosp.
> readDataSection(Nc4Iosp.java:1578) ~[netcdf4-4.6.8.jar:4.6.8]
>
>                 at ucar.nc2.jni.netcdf.Nc4Iosp.readData(Nc4Iosp.java:1488)
> ~[netcdf4-4.6.8.jar:4.6.8]
>
>                 at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:2020)
> ~[cdm-4.6.8.jar:4.6.8]
>
>                 at ucar.nc2.Variable.reallyRead(Variable.java:913)
> ~[cdm-4.6.8.jar:4.6.8]
>
>                 at ucar.nc2.Variable._read(Variable.java:898)
> ~[cdm-4.6.8.jar:4.6.8]
>
>                 at ucar.nc2.Variable.read(Variable.java:709)
> ~[cdm-4.6.8.jar:4.6.8]
>
>                 at ucar.nc2.Variable.read(Variable.java:655)
> ~[cdm-4.6.8.jar:4.6.8]
>
>                 at gov.nasa.jpl.podaac.subsetter.netcdf.NetCDFSubsetter.
> mergeNetCDFFiles(NetCDFSubsetter.java:780) [l2ss.jar:?]
>
>                 at gov.nasa.jpl.podaac.queue.SubsettingJobIT.
> testMergeAquarius(SubsettingJobIT.java:226) [test-classes/:?]
>
>
>
> Looking through some of the open source code, I don’t know why userType ==
> 9 is giving a problem, as that should be the unsigned int type. I’m getting
> this issue when I’m reading out an array of the data:
>
>
>
> Array copyTo = newVar.read(origin, arrayFrameSize);
>
>
>
> The header of the variable I’m writing _*to*_ causing the error is as
> follows:
>
>
>
> group: Aquarius_Flags {
>
>   dimensions:
>
>                 phony_dim_13 = 178 ;
>
>                 phony_dim_14 = 3 ;
>
>                 phony_dim_15 = 2 ;
>
>                 phony_dim_16 = 12 ;
>
>                 phony_dim_17 = 4 ;
>
>   variables:
>
> …
>
>                 uint radiometer_flags(subset_index, phony_dim_13,
> phony_dim_14, phony_dim_17) ;
>
>                                 radiometer_flags:Cold_water = "COLDWATER" ;
>
>                                 
> radiometer_flags:Direct_solar_flux_contamination
> = "FLUXD" ;
>
>                                 radiometer_flags:Galactic_contamination =
> "GALACTIC" ;
>
>                                 radiometer_flags:Land_contamination =
> "LAND" ;
>
>                                 radiometer_flags:Moon_contamination =
> "MOON" ;
>
>                                 radiometer_flags:Moon_Galaxy_contamination
> = "REFL_1STOKES" ;
>
>                                 radiometer_flags:Non-nominal_navigation =
> "NAV" ;
>
>                                 radiometer_flags:Pointing_anomaly =
> "POINTING" ;
>
>                                 radiometer_flags:RFI_contamination =
> "RFI" ;
>
>                                 radiometer_flags:RFI_level = "TFTADIFF" ;
>
>                                 radiometer_flags:RFI_regional_contamination
> = "RFI_REGION" ;
>
>                                 radiometer_flags:Rain_in_main_beam =
> "RAIN" ;
>
>                                 
> radiometer_flags:Reflected_solar_flux_contamination
> = "FLUXR" ;
>
>                                 radiometer_flags:Roughness_correction_failure
> = "ROUGH" ;
>
>                                 radiometer_flags:SA_overflow =
> "SAOVERFLOW" ;
>
>                                 radiometer_flags:Sea_ice_contamination =
> "ICE" ;
>
>                                 radiometer_flags:Solar_flare_contamination
> = "FLARE" ;
>
>                                 radiometer_flags:Sun_glint = "SUNGLINT" ;
>
>                                 radiometer_flags:Tb_consistency =
> "TBCONS" ;
>
>                                 radiometer_flags:Unusual_brighness_temperature
> = "TEMP" ;
>
>                                 radiometer_flags:Wind_foam_contamination
> = "WIND" ;
>
>                                 radiometer_flags:long_name = "Radiometer
> data quality flags" ;
>
>                                 radiometer_flags:valid_max = 0U ;
>
>                                 radiometer_flags:valid_min = 0U ;
>
>                                 radiometer_flags:_Unsigned = "true" ;
>
>
>
> Any help or guidance would be great. I’m using netcdf4-4.6.8 and netcdf
> 4.3.3.1
>
>
>
> Thanks,
>
> Mike
>
>
>
>
>
> _______________________________________________
> NOTE: All exchanges posted to Unidata maintained email lists are
> recorded in the Unidata inquiry tracking system and made publicly
> available through the web.  Users who post to any of the lists we
> maintain are reminded to remove any personal information that they
> do not want to be made public.
>
>
> netcdf-java mailing list
> netcdf-java@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
  • 2017 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: