hubflow Raster.metadataWavelength does not support valid ENVI wavelength units

Issue #532 resolved
Benjamin Jakimow created an issue

The following wavelenght units are supported in ENVI images:

Micrometers
um
Nanometers
nm
Millimeters
mm
Centimeters
cm
Meters
m
Wavenumber
Angstroms
GHz
MHz
Index
Unknown

However, hubflow.core.Raster supports only two string: “Nanometers” and “Micrometers” and therefore even fails when “nm”, “um” or the SI-conform “μm” (hello utf-8) are used.

Comments (5)

  1. Benjamin Jakimow reporter

    What about datasets that, for example, use temporal units like date-time or day of year into “wavelength” domain?
    I also think that meanwhile (2020) utf-encoded textfiles with “μm” are not that common. metadataWavelength() should not crash or, if so, print at least a list of the wavelenght unit strings it supports.

  2. Andreas Janz

    The Raster.metadataWavelength will always give you nanometers, so it is only useful if you have spectral information.

    If you want to use temporal or other arbitrary units, you need to use Raster.dataset().metadata(key='wavelength_units', domain='ENVI') syntax.

  3. Andreas Janz

    print at least a list of the wavelenght unit strings it supports.

    Isn’t the assert specifying all the valid units? The line of code should be available inside the traceback.

    assert unit.lower() in ['nanometers', 'nm', 'micrometers', 'um']
    

  4. Log in to comment