RadTransforms#

class geowombat.radiometry.RadTransforms[source]#

Bases: MetaData

A class for radiometric transformations.

Methods

dn_to_radiance(dn, gain, bias)

Converts digital numbers to radiance.

dn_to_sr(dn, solar_za, solar_az, sensor_za, ...)

Converts digital numbers to surface reflectance.

dn_to_toar(dn, gain, bias[, solar_za, ...])

Converts digital numbers to top-of-atmosphere reflectance.

get_landsat_coefficients(meta_file)

Gets coefficients from a Landsat metadata file.

get_sentinel_coefficients(meta_file)

Gets coefficients from a Sentinel metadata file.

radiance_to_toar(radiance, solar_za, global_args)

Converts radiance to top-of-atmosphere reflectance.

toar_to_rad(toar, meta)

Converts top of atmosphere reflectance to top of atmosphere radiance.

toar_to_sr(toar, solar_za, solar_az, ...[, ...])

Converts top-of-atmosphere reflectance to surface reflectance.

Methods Documentation

dn_to_radiance(dn, gain, bias)[source]#

Converts digital numbers to radiance.

Parameters:
  • dn (DataArray) – The digital number data to calibrate.

  • gain (DataArray) – A gain value.

  • bias (DataArray) – A bias value.

Returns:

xarray.DataArray

dn_to_sr(dn, solar_za, solar_az, sensor_za, sensor_az, src_nodata=-32768, dst_nodata=-32768, sensor=None, method='srem', angle_factor=0.01, meta=None, interp_method='fast', **kwargs)[source]#

Converts digital numbers to surface reflectance.

Parameters:
  • dn (DataArray) – The digital number data to calibrate.

  • solar_za (DataArray) – The solar zenith angle.

  • solar_az (DataArray) – The solar azimuth angle.

  • sensor_za (DataArray) – The sensor, or view, zenith angle.

  • sensor_az (DataArray) – The sensor, or view, azimuth angle.

  • src_nodata (Optional[int or float]) – The input ‘no data’ value.

  • dst_nodata (Optional[int or float]) – The output ‘no data’ value.

  • sensor (Optional[str]) – The data’s sensor.

  • method (Optional[str]) – The correction method to use. Choices are [‘srem’, ‘6s’].

  • angle_factor (Optional[float]) – The scale factor for angles.

  • meta (Optional[namedtuple]) – A metadata object with gain and bias coefficients.

  • interp_method (Optional[str]) – The LUT interpolation method if method = ‘6s’. Choices are [‘fast’, ‘slow’]. ‘fast’: Uses nearest neighbor lookup with scipy.interpolate.NearestNDInterpolator. ‘slow’: Uses linear interpolation with scipy.interpolate.LinearNDInterpolator.

  • kwargs (Optional[dict]) – Extra keyword arguments passed to radiometry.sixs.SixS().rad_to_sr.

References

https://www.usgs.gov/land-resources/nli/landsat/using-usgs-landsat-level-1-data-product

Returns:

Data range: 0-1

Return type:

xarray.DataArray

Examples

>>> from geowombat.radiometry import RadTransforms
>>>
>>> sr = RadTransforms()
>>> meta = sr.get_landsat_coefficients('file.MTL')
>>>
>>> # Convert DNs to surface reflectance using Landsat metadata
>>> with gw.open('dn.tif') as ds:
>>>     sr_data = sr.dn_to_sr(ds, solar_za, sensor_za, meta=meta)
dn_to_toar(dn, gain, bias, solar_za=None, angle_factor=0.01, sun_angle=True)[source]#

Converts digital numbers to top-of-atmosphere reflectance.

Parameters:
  • dn (DataArray) – The digital number data to calibrate.

  • gain (DataArray | dict) – A gain value.

  • bias (DataArray | dict) – A bias value.

  • solar_za (DataArray) – The solar zenith angle.

  • angle_factor (Optional[float]) – The scale factor for angles.

  • sun_angle (Optional[bool]) – Whether to correct for the sun angle.

Returns:

xarray.DataArray

static radiance_to_toar(radiance, solar_za, global_args)[source]#

Converts radiance to top-of-atmosphere reflectance.

Parameters:
  • radiance (DataArray) – The radiance data to calibrate.

  • solar_za (DataArray) – The solar zenith angle.

  • global_args (namedtuple) – Global arguments.

Returns:

xarray.DataArray

toar_to_sr(toar, solar_za, solar_az, sensor_za, sensor_az, sensor=None, src_nodata=-32768, dst_nodata=-32768, method='srem', angle_factor=0.01, meta=None, interp_method='fast', **kwargs)[source]#

Converts top-of-atmosphere reflectance to surface reflectance.

Parameters:
  • toar (DataArray) – The top-of-atmosphere reflectance (0-1).

  • solar_za (float | DataArray) – The solar zenith angle.

  • solar_az (DataArray) – The solar azimuth angle.

  • sensor_za (DataArray) – The sensor zenith angle.

  • sensor_az (DataArray) – The sensor azimuth angle.

  • sensor (Optional[str]) – The data’s sensor.

  • src_nodata (Optional[int or float]) – The input ‘no data’ value.

  • dst_nodata (Optional[int or float]) – The output ‘no data’ value.

  • method (Optional[str]) –

    The method to use. Choices are [‘srem’, ‘6s’].

    Choices:

    ’srem’: A Simplified and Robust Surface Reflectance Estimation Method (SREM)

  • angle_factor (Optional[float]) – The scale factor for angles.

  • meta (Optional[namedtuple]) – A metadata object with gain and bias coefficients.

  • interp_method (Optional[str]) – The LUT interpolation method if method = ‘6s’. Choices are [‘fast’, ‘slow’]. ‘fast’: Uses nearest neighbor lookup with scipy.interpolate.NearestNDInterpolator. ‘slow’: Uses linear interpolation with scipy.interpolate.LinearNDInterpolator.

  • kwargs (Optional[dict]) – Extra keyword arguments passed to radiometry.sixs.SixS().toar_to_sr.

References

See [BNN+19] for the SREM method.

See [PFRS10] and [LLS+20] for the 6S method.

Returns:

Data range: 0-1

Return type:

xarray.DataArray

dn_to_radiance(dn, gain, bias)[source]#

Converts digital numbers to radiance.

Parameters:
  • dn (DataArray) – The digital number data to calibrate.

  • gain (DataArray) – A gain value.

  • bias (DataArray) – A bias value.

Returns:

xarray.DataArray

dn_to_sr(dn, solar_za, solar_az, sensor_za, sensor_az, src_nodata=-32768, dst_nodata=-32768, sensor=None, method='srem', angle_factor=0.01, meta=None, interp_method='fast', **kwargs)[source]#

Converts digital numbers to surface reflectance.

Parameters:
  • dn (DataArray) – The digital number data to calibrate.

  • solar_za (DataArray) – The solar zenith angle.

  • solar_az (DataArray) – The solar azimuth angle.

  • sensor_za (DataArray) – The sensor, or view, zenith angle.

  • sensor_az (DataArray) – The sensor, or view, azimuth angle.

  • src_nodata (Optional[int or float]) – The input ‘no data’ value.

  • dst_nodata (Optional[int or float]) – The output ‘no data’ value.

  • sensor (Optional[str]) – The data’s sensor.

  • method (Optional[str]) – The correction method to use. Choices are [‘srem’, ‘6s’].

  • angle_factor (Optional[float]) – The scale factor for angles.

  • meta (Optional[namedtuple]) – A metadata object with gain and bias coefficients.

  • interp_method (Optional[str]) – The LUT interpolation method if method = ‘6s’. Choices are [‘fast’, ‘slow’]. ‘fast’: Uses nearest neighbor lookup with scipy.interpolate.NearestNDInterpolator. ‘slow’: Uses linear interpolation with scipy.interpolate.LinearNDInterpolator.

  • kwargs (Optional[dict]) – Extra keyword arguments passed to radiometry.sixs.SixS().rad_to_sr.

References

https://www.usgs.gov/land-resources/nli/landsat/using-usgs-landsat-level-1-data-product

Returns:

Data range: 0-1

Return type:

xarray.DataArray

Examples

>>> from geowombat.radiometry import RadTransforms
>>>
>>> sr = RadTransforms()
>>> meta = sr.get_landsat_coefficients('file.MTL')
>>>
>>> # Convert DNs to surface reflectance using Landsat metadata
>>> with gw.open('dn.tif') as ds:
>>>     sr_data = sr.dn_to_sr(ds, solar_za, sensor_za, meta=meta)
dn_to_toar(dn, gain, bias, solar_za=None, angle_factor=0.01, sun_angle=True)[source]#

Converts digital numbers to top-of-atmosphere reflectance.

Parameters:
  • dn (DataArray) – The digital number data to calibrate.

  • gain (DataArray | dict) – A gain value.

  • bias (DataArray | dict) – A bias value.

  • solar_za (DataArray) – The solar zenith angle.

  • angle_factor (Optional[float]) – The scale factor for angles.

  • sun_angle (Optional[bool]) – Whether to correct for the sun angle.

Returns:

xarray.DataArray

static radiance_to_toar(radiance, solar_za, global_args)[source]#

Converts radiance to top-of-atmosphere reflectance.

Parameters:
  • radiance (DataArray) – The radiance data to calibrate.

  • solar_za (DataArray) – The solar zenith angle.

  • global_args (namedtuple) – Global arguments.

Returns:

xarray.DataArray

static toar_to_rad(toar, meta)[source]#

Converts top of atmosphere reflectance to top of atmosphere radiance.

Parameters:
  • toar (DataArray) – The top of atmosphere reflectance (0-1).

  • sza (float | DataArray) – The solar zenith angle (in degrees).

  • meta (Optional[namedtuple]) – A metadata object with gain and bias coefficients.

Returns:

xarray.DataArray

toar_to_sr(toar, solar_za, solar_az, sensor_za, sensor_az, sensor=None, src_nodata=-32768, dst_nodata=-32768, method='srem', angle_factor=0.01, meta=None, interp_method='fast', **kwargs)[source]#

Converts top-of-atmosphere reflectance to surface reflectance.

Parameters:
  • toar (DataArray) – The top-of-atmosphere reflectance (0-1).

  • solar_za (float | DataArray) – The solar zenith angle.

  • solar_az (DataArray) – The solar azimuth angle.

  • sensor_za (DataArray) – The sensor zenith angle.

  • sensor_az (DataArray) – The sensor azimuth angle.

  • sensor (Optional[str]) – The data’s sensor.

  • src_nodata (Optional[int or float]) – The input ‘no data’ value.

  • dst_nodata (Optional[int or float]) – The output ‘no data’ value.

  • method (Optional[str]) –

    The method to use. Choices are [‘srem’, ‘6s’].

    Choices:

    ’srem’: A Simplified and Robust Surface Reflectance Estimation Method (SREM)

  • angle_factor (Optional[float]) – The scale factor for angles.

  • meta (Optional[namedtuple]) – A metadata object with gain and bias coefficients.

  • interp_method (Optional[str]) – The LUT interpolation method if method = ‘6s’. Choices are [‘fast’, ‘slow’]. ‘fast’: Uses nearest neighbor lookup with scipy.interpolate.NearestNDInterpolator. ‘slow’: Uses linear interpolation with scipy.interpolate.LinearNDInterpolator.

  • kwargs (Optional[dict]) – Extra keyword arguments passed to radiometry.sixs.SixS().toar_to_sr.

References

See [BNN+19] for the SREM method.

See [PFRS10] and [LLS+20] for the 6S method.

Returns:

Data range: 0-1

Return type:

xarray.DataArray

[BNN+19] (1,2)

Muhammad Bilal, Majid Nazeer, Janet E Nichol, Max P Bleiweiss, Zhongfeng Qiu, Evelyn Jäkel, James R Campbell, Luqman Atique, Xiaolan Huang, and Simone Lolli. A simplified and robust surface reflectance estimation method (SREM) for use over diverse land surfaces using multi-sensor data. Remote Sensing, 11(11):1344, 2019.

[KWR+97]

Yoram J Kaufman, Andrew E Wald, Lorraine A Remer, Bo-Cai Gao, Rong-Rong Li, and Luke Flynn. The modis 2.1-/spl mu/m channel-correlation with visible reflectance for use in remote sensing of aerosol. IEEE transactions on Geoscience and Remote Sensing, 35(5):1286–1298, 1997.

[LLS+20] (1,2)

Kyeong-Sang Lee, Chang Suk Lee, Minji Seo, Sungwon Choi, Noh-Hun Seong, Donghyun Jin, Jong-Min Yeom, and Kyung-Soo Han. Improvements of 6S look-up-table based surface reflectance employing minimum curvature surface method. Asia-Pacific Journal of Atmospheric Sciences, pages 1–14, 2020.

[MVS+06]

Jeffrey G Masek, Eric F Vermote, Nazmi E Saleous, Robert Wolfe, Forrest G Hall, Karl Fred Huemmrich, Feng Gao, Jonathan Kutler, and Teng-Kui Lim. A landsat surface reflectance dataset for north america, 1990-2000. IEEE Geoscience and Remote Sensing Letters, 3(1):68–72, 2006.

[OV99]

Hassan Ouaidrari and Eric F Vermote. Operational atmospheric correction of landsat tm data. Remote Sensing of Environment, 70(1):4–15, 1999.

[PFRS10] (1,2)

Simon Richard Proud, Rasmus Fensholt, Mads Olander Rasmussen, and Inge Sandholt. A comparison of the effectiveness of 6S and SMAC in correcting for atmospheric interference of Meteosat Second Generation images. Journal of Geophysical Research: Atmospheres, 2010.