Note that there are some explanatory texts on larger screens.

plurals
  1. PODetermining signed state for HDF5 variables in NetCDF
    primarykey
    data
    text
    <p>My team has been given HDF5 files to read. They contain structured data with unsigned variables. I and my team were overjoyed to find the NetCDF library, which allows pure-Java reading of HDF5 files, albeit using the NetCDF data model.</p> <p>No problem---we thought we'd just translate from the NetCDF data model to whatever model we wanted. As long as we get the data out. Then we tried to read an unsigned 32-bit integer from the HDF5 file. We can load up HDFView 2.9 and see that the variable is an unsigned 32-bit integer. But... it turns out that <a href="http://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html#Unsigned%20Data" rel="nofollow">NetCDF-3 doesn't support unsigned values</a>!</p> <p>To add insult to injury, NetCDF-3 recommends that you "widen the data type" or use an <code>_Unsigned = "true"</code> attribute (I am not making this up) to indicate that the 32 bits should be treated as an unsigned value.</p> <p>Well, maybe those kludges would be effective if I were creating NetCDF data from scratch, but <strong>how can I detect using NetCDF that a 32-bit value in an existing HDF5 file should be interpreted as unsigned?</strong></p> <p><em>Update:</em> Apparently <a href="http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/NetCDF_002d4-Atomic-Types.html" rel="nofollow">NetCDF-4 does support unsigned data types</a>. So this begs the question: <strong>How can I determine whether a value is signed or unsigned from the NetCDF Java library?"</strong> I don't see any unsigned types in <code>ucar.ma2.DataType</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload