NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdf-java] Problem reading HDF files

Thank you,

A temporary hack
   path = path.replaceAll(" ", "_");
now works for me.

there are also troubles reading some NetCDF4 files (I posted the question
in November 2014):
http://www.unidata.ucar.edu/support/help/MailArchives/netcdf-java/msg02075.html

Initially I thought that was NCO issue since I get this error (see below)
after applying ncks for chunking NetCDF3 file and get NetCDF4 as output.

NetCDF-Java output:
[ucar.nc2.NetcdfFile] DEBUG Using IOSP ucar.nc2.iosp.hdf5.H5iosp
[ucar.nc2.iosp.hdf5.H5header] ERROR bad version 72 at filePos 22386

But it could be the NetCDF-Java library issue: Charlie worked hard on the
discovering the problem with NCO but seems like we were digging at the
wrong direction.

Any ideas?

2015-01-13 23:59 GMT+03:00 Ryan May <rmay@xxxxxxxx>:

> Hi,
>
> So in discussions with John Caron, the change of spaces to underscores is
> intentional. From our perspective, supporting spaces for identifiers for
> the CDM was just too much trouble for too little gain, so in mapping the
> HDF5 data model to the CDM, spaces get converted.
>
> One solution (as I suggested earlier) is to convert all spaces in the hard
> coded paths you're using to underscores. The other is to walk the groups in
> the file to find the actual group name from the HDF5 file.
>
> Ryan
>
> On Tue, Jan 13, 2015 at 9:03 AM, Joe Lee <hyoklee@xxxxxxxxxxxx> wrote:
>
>>  Yes, I had the same issue when I was writing Minecraft World map
>> generation code from HDF-EOS [1]:
>>
>>
>>
>>             nc = NetcdfDataset.openFile(filename, null);
>>
>>             // Variable v = nc.findVariable("l3m_data"); // for Aquarius
>> product
>>
>>             // Please note that "Data Fields" have underscore. HDF5 does
>> not have it.
>>
>>             // Variable v =
>> nc.findVariable("/HDFEOS/GRIDS/ColumnAmountO3/Data_Fields/TerrainHeight");
>>
>>             Variable v = nc.findVariable(
>> "/Northern_Hemisphere/Data_Fields/Extent");
>>
>>             Variable v2 = nc.findVariable(
>> "/Southern_Hemisphere/Data_Fields/Extent");
>>
>>
>>
>>
>>
>> [1]
>> https://github.com/hyoklee/Glowstone/blob/master/src/main/java/net/glowstone/GlowWorld.java
>>
>>
>>
>>
>>
>> *From:* netcdf-java-bounces@xxxxxxxxxxxxxxxx [mailto:
>> netcdf-java-bounces@xxxxxxxxxxxxxxxx] *On Behalf Of *Ryan May
>> *Sent:* Tuesday, January 13, 2015 9:44 AM
>> *To:* Antonio Rodriges
>> *Cc:* netcdf-java@xxxxxxxxxxxxxxxx
>> *Subject:* Re: [netcdf-java] Problem reading HDF files
>>
>>
>>
>> (Sending again to make sure the list gets it).
>>
>>
>>
>> Antonio,
>>
>>
>>
>> Thanks for the information, and sorry it's taken so long to get back--I
>> blame the holidays and the AMS meeting.
>>
>>
>>
>> I've found the cause of the problem: the "Data Fields" group in the hdf5
>> file is getting converted in netcdf-java to "Data_Fields". So as a
>> workaround, you could get it working by making sure any spaces in the path
>> variable (or at least the groups) are replaced with "_". I still need to
>> find out if this is deliberate behavior in netcdf-java for some reason, or
>> just a bug.
>>
>>
>>
>> On Tue, Dec 30, 2014 at 1:13 PM, Antonio Rodriges <antonio.rrz@xxxxxxxxx>
>> wrote:
>>
>> Ryan,
>>
>> The path is
>>
>> /HDFEOS/GRIDS/ColumnAmountNO2/Data
>> Fields//ColumnAmountNO2TropCloudScreened
>>
>> and the HDF5 file is attached. There are also HDF4 files with the same
>> problem
>>
>> This worked fine under netcdf-4.2 but now I need new features
>> introduced in later versions so I consider switching to 4.3 at least
>> or higher
>>
>>
>> 2014-12-30 20:57 GMT+03:00 Ryan May <rmay@xxxxxxxx>:
>> > Antonio,
>> >
>> > It would be helpful to see a sample file as well as the value of the
>> path
>> > variable in order to understand the problem.
>> >
>> > Ryan
>> >
>> > On Sun, Dec 28, 2014 at 9:25 AM, Antonio Rodriges <
>> antonio.rrz@xxxxxxxxx>
>> > wrote:
>> >>
>> >> Hello,
>> >>
>> >> the code
>> >>
>> >>         String path = groupInFile + SUBDATASETS_GROUP_DELIMITER +
>> >> nameInGroup;
>> >>         Variable findVariable = file.findVariable(path);
>> >>
>> >> Worked with netcdf-4.2 Java lib but does not with netcdf-4.3 and 4.5
>> >> (returns findVariable = null)
>> >> What is the problem?
>> >>
>> >> _______________________________________________
>> >> netcdf-java mailing list
>> >> netcdf-java@xxxxxxxxxxxxxxxx
>> >> For list information or to unsubscribe, visit:
>> >> http://www.unidata.ucar.edu/mailing_lists/
>> >>
>> >
>> >
>> >
>> > --
>> > Ryan May
>> > Software Engineer
>> > UCAR/Unidata
>> > Boulder, CO
>>
>>
>>
>>
>>
>> --
>>
>> Ryan May
>>
>> Software Engineer
>>
>> UCAR/Unidata
>>
>> Boulder, CO
>>
>
>
>
> --
> Ryan May
> Software Engineer
> UCAR/Unidata
> Boulder, CO
>
  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: