[GRASS-user] Problems using i.worldview.toar

Nikos Alexandris nik at nikosalexandris.net
Fri Sep 9 17:12:56 PDT 2016


William Hudspeth:

>>> I am using i.worldview.toar with the latest version of GRASS 7.3. I was
>>> able to successfully download and install this extension. I have tried
>>> using the module with the following input and error. All of the input
>>> files exist, and I get an error stating that "No data base element files
>>> found". Help appreciated...
>>>
>>> i.worldview.toar
>>> band=worldview2_b1_RED at worldview2,worldview2_b2_GREEN at worldview2,worldview2_b3_BLUE at worldview2,worldview2_b4_NIR at worldview2
>>> outputsuffix=toar utc=2010-04-11T18:07:06.558405Z doy=101 sea=60.3

Nikos Alexandris:

>> Do you really need the 'worldview2' prefix for your band names? It's
>> identical to your Mapset's name. This is what a mapset is meant (or can
>> be used) for: a set of maps.  In this case, it's a set of 'worldview2'
>> "maps".
>>
>> Would you rename your bands and try again?
>>
>> i.worldview.toar band=b1_RED,b2_GREEN,b3_BLUE,b4_NIR outputsuffix=toar
>> utc=2010-04-11T18:07:06.558405Z doy=101 sea=60.3

William Hudspeth:
>
>I have given the bands simpler names, have re-run i.worldview.toar, and
>am getting the same error:
>
>i.worldview.toar
>band=b1_red at worldview2,b2_green at worldview2,b3_blue at worldview2,b4_nir at worldview2
>outputsuffix=toar utc=2010-04-11T18:07:06.558405Z doy=101 sea=60.3
>|! Using Day of Year to calculate Earth-Sun distance.
>
>|! Region matching the b1_red at worldview2 spectral band
>
>|* Processing the b1_red at worldview2 band
>Traceback (most recent call last):
>   File
>"/home/wilbur/.grass7/addons/scripts/i.worldview.toar", line
>416, in <module>
>     sys.exit(main())
>   File
>"/home/wilbur/.grass7/addons/scripts/i.worldview.toar", line
>320, in main
>     acf = float(CF_BW_ESUN[band][2])
>KeyError: 'b1_red'
>WARNING: No data base element files found

William,

apologies for the inconvenience. I now had a better look and remember what is
what. Comments from the code itself:

"""
Factors for Conversion to Top-of-Atmosphere Spectral Radiance
    (absolute radiometric calibration factors)

Structure of the dictionary:
- Key: Name of band
- Items in tupple(s):
    - 1st: Absolute Calibration Factors
    - 2nd: Spectral Band's Effective Bandwidth, Δλ
    - 3rd: Band-Averaged Solar Spectral Irradiance [W/sq.m./micro-m]

Retrieving values:
    band = <Name of Band>
    K[band][0]  # for Effective Bandwidth
    K[band][1]  # for Esun
    K[band][2]  # for Absolute Conversion Factor
"""

which are stored in the following python dictionary:

CF_BW_ESUN = {
    'Pan':     (0.28460000, 1580.8140, 0.056783450),
    'Coastal': (0.04730000, 1758.2229, 0.009295654),
    'Blue':    (0.05430000, 1974.2416, 0.012608250),
    'Green':   (0.06300000, 1856.4104, 0.009713071),
    'Yellow':  (0.03740000, 1738.4791, 0.005829815),
    'Red':     (0.05740000, 1559.4555, 0.011036230),
    'RedEdge': (0.03930000, 1342.0695, 0.005188136),
    'NIR1':    (0.09890000, 1069.7302, 0.012243800),
    'NIR2':    (0.09960000,  861.2866, 0.009042234)}


The module is flexible to request for any of the bands to be
converted. Yet, it has the disatvanage that requires the very name(s) of the
corresponding "key(s)" to access the respective calibration factors.

In short, rename your bands to exactly 'Red', 'Green', 'Blue', 'NIR'. Maybe this can be
changed, but I wouldn't have the time at the moment for it.

If you have any changes, already, please make a pull request in the github repository.

Nikos

Nikos


More information about the grass-user mailing list