I have been using the nujan library to create HDF files. That works for floats and ints
as I followed the examples.
Now I would like to add an array of strings in order to insert some METADATA into the file.
The got the following error
// the following does not work
idtype = HdfGroup.DTYPE_STRING_FIX;
int [] dimsstr = {3};
String [] stra = {doi, esdt, long_esdt};
trad[5] = rootGroup.addVariable(
"METADATA", // variable name
idtype, //
0, // stgFieldLen
dimsstr, // dimension lengths
null, // chunk lengths
null, // fill value or null
0); // compression: 0 is none, 9 is max
// error appears on the line trad[5] =
// this is what the error looks like:
/*
edu.ucar.ral.nujan.hdf.HdfException: Invalid stgFieldLen for DTYPE_STRING_FIX: must be > 0
at edu.ucar.ral.nujan.hdf.BaseBlk.throwerr(BaseBlk.java:155)
at edu.ucar.ral.nujan.hdf.MsgDataType.<init>(MsgDataType.java:233)
at edu.ucar.ral.nujan.hdf.HdfGroup.<init>(HdfGroup.java:560)
at edu.ucar.ral.nujan.hdf.HdfGroup.addVariable(HdfGroup.java:704)
at ArcHDFmeta.writeHdf(ArcHDFmeta.java:371)
at ArcHDFmeta.doFile(ArcHDFmeta.java:183)
at FileDialogN.doDir(FileDialogN.java:255)
at ArcHDFmeta.doDir(ArcHDFmeta.java:34)
at FileDialogN.doDir(FileDialogN.java:240)
at ArcHDFmeta.doDir(ArcHDFmeta.java:34)
at FileDialogN.doDir(FileDialogN.java:240)
at ArcHDFmeta.doDir(ArcHDFmeta.java:34)
at FileDialogN.doDir(FileDialogN.java:240)
at ArcHDFmeta.doDir(ArcHDFmeta.java:34)
at FileDialogN.proc(FileDialogN.java:84)
at ArcHDFmeta.proc(ArcHDFmeta.java:34)
at ArcHDFmeta.main(ArcHDFmeta.java:104)
*/
(The full code is attached).
Any help would be appreciated.
ArcHDFmeta.java (19.2 KB)
···
--
G. Garrett Campbell
NSIDC
303 492 5194