[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HDF SDS data attributes

William B. Clodius <wclodius@lanl.gov> wrote in message
> > Let me see if I understand your problem. You have a dimension named
> > 'Band_Number', which is used for image SDS arrays. However you'd also
> > to record the actual band numbers which correspond to the 'Band_Number'
> > dimension.
> Not quite, we would like to record the band names, which for historical
> reasons are not always in a logical sequence. In explanation, most of
> the names are single characters in alphabetical order increasing with
> wavelength, A (blue), B (green), C (red), ..., but one (low signal) band
> is duplicated twice as a means of improving S/N (a form of time delayed
> integration) and after much of the design work was done and publicized
> an additional band was added at an intermediate wavelength without
> renaming the other bands. As a result various users of our data
> currently get confused as to whether the data are stored in alphabetical
> or wavelength order. This confusion was made worse by the implementors
> providing wrapper routines that by default returns the data in a
> different order from how they are actually stored. (If I remember
> correctly, this was sort of the fault of the rest of the team that
> decided how data was to be stored and accessed at different meetings
> without checking as to whether they were being consistent.) Soon we may
> have the question as to whether both versions of the duplicated band are
> present or only one combined image.
> It would also be useful for our users if the data included the center
> wavelengths and band widths for each band and directly associated that
> with the array dimension.

It seems to me you need several SDS arrays for this purpose. Let's say you
have 10 bands:

  Band_Number = 10

  long Band_Number(Band_Number)
  float Band_Center(Band_Number)
  float Band_Width(Band_Number)
  char Band_Name

  Band_Number = 1, 2, 3, 3, 4, 5, 6, 7, 8, 9
    long_name: 'Band Numerical Identifier'
  Band_Center = 0.40, 0.45, 0.50, 0.50, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85
    long_name: 'Band Central Wavelength'
    units: 'microns'
  Band_Width = 0.05, 0.05, 0.05, 0.05, 0.05, 0.02, 0.02, 0.02, 0.05, 0.05
    long_name: 'Band Width'
    units: 'microns'
  Band_Name = 'A, B, C, C, D, E, F, G, H, I'

Band_Name is a comma-delimited string because I don't believe HDF supports
arrays of strings.

As you said, you can only have one coordinate variable (aka dimension scale)
per dimension. I prefer the multiple-array approach over having multiple
non-standard attributes for a single coordinate variable (i.e. Band_Number
with attributes Band_Center, Band_Width, Band_Name).