Re: HDF_SD_ADDDATA with strings [message #60477] |
Tue, 20 May 2008 18:06 |
kostya
Messages: 3 Registered: May 2008
|
Junior Member |
|
|
thanks a lot,
the HDF files were created with Java NEXUS library so there is not
much I can do in regards to creating the files. I looked at the Java
code that we use to create and modify HDF files and it looks pretty
easy there (changing string size is straightforward), I thought I
could do similar things with IDL but it looks like it's not the case.
|
|
|
Re: HDF_SD_ADDDATA with strings [message #60480 is a reply to message #60477] |
Tue, 20 May 2008 17:14  |
jameskuyper
Messages: 79 Registered: October 2007
|
Member |
|
|
kostya wrote:
> Hi everybody,
>
> I'm having trouble modifying a string in SD dataset in HDF4 file.
> Basically I'm trying to overwrite 'true' with 'false' and this is what
> I get: HDF_SD_ADDDATA: Cannot write 5 elements. The data area is not
> that big.
>
> I could not find any option to modify the string size in SD using IDL.
> Another option would be to delete this dataset and create a new one
> with the same name but I can't seem to find this option either. Any
> ideas?
HDF SDSs have a length that can be modified, only if they were initially
created with that option. Using the IDL HDF_SD_* interface, this can be
done by setting the dimension length to a number less than 1 in the call
to HDF_SD_Create(). This can only be done on the last dimension. If that
option was selected when the SDS was created, the SDS automatically
gets extended when you write beyond it's current length; otherwise, the
length is fixed. The SD that you're writing to apparently has a fixed
length.
That's why it's generally a better idea to make strings HDF attributes.
When you write a new value for an attribute which is bigger than the
original value, the old value remains in the file, but it's marked to
indicate that it's no longer in use. The new value is written to the
file, and the appropriate parts of the file are changed to indicate that
the new location is where the current value for the specified attribute
is stored. I'm not sure whether this is also done if the new value is
shorter.
An HDF attribute can be attached to many kinds of HDF construct: Files,
Scientific Datasets, Raster images, Vdatas, or Vdata fields.
|
|
|
|