Re: [netcdf-java] Problem reading HDF files

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<mailto: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<mailto: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<mailto: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<mailto: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
  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: