Topo#

class geowombat.radiometry.Topo[source]#

Bases: object

A class for topographic normalization.

Methods

norm_topo(data, elev, solar_za, solar_az[, ...])

Applies topographic normalization.

Methods Documentation

norm_topo(data, elev, solar_za, solar_az, slope=None, aspect=None, method='empirical-rotation', slope_thresh=2, nodata=0, elev_nodata=-32768, scale_factor=1, angle_scale=0.01, n_jobs=1, robust=False, min_samples=100, slope_kwargs=None, aspect_kwargs=None, band_coeffs=None)[source]#

Applies topographic normalization.

Parameters:
  • data (2d or 3d DataArray) – The data to normalize, in the range 0-1.

  • elev (2d DataArray) – The elevation data.

  • solar_za (2d DataArray) – The solar zenith angles (degrees).

  • solar_az (2d DataArray) – The solar azimuth angles (degrees).

  • slope (2d DataArray) – The slope data. If not given, slope is calculated from elev.

  • aspect (2d DataArray) – The aspect data. If not given, aspect is calculated from elev.

  • method (Optional[str]) – The method to apply. Choices are [‘c’, ‘empirical-rotation’].

  • slope_thresh (Optional[float or int]) – The slope threshold. Any samples with values < slope_thresh are not adjusted.

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

  • elev_nodata (Optional[float or int]) – The ‘no data’ value for elev.

  • scale_factor (Optional[float]) – A scale factor to apply to the input data.

  • angle_scale (Optional[float]) – The angle scale factor.

  • n_jobs (Optional[int]) – The number of parallel workers for LinearRegression.fit.

  • robust (Optional[bool]) – Whether to fit a robust regression.

  • min_samples (Optional[int]) – The minimum number of samples required to fit a regression.

  • slope_kwargs (Optional[dict]) – Keyword arguments passed to gdal.DEMProcessingOptions to calculate the slope.

  • aspect_kwargs (Optional[dict]) – Keyword arguments passed to gdal.DEMProcessingOptions to calculate the aspect.

  • band_coeffs (Optional[dict]) – Slope and intercept coefficients for each band.

References

See [TGG82] for the C-correction method. See [TWM+10] for the Empirical Rotation method.

Returns:

xarray.DataArray

Examples

>>> import geowombat as gw
>>> from geowombat.radiometry import Topo
>>>
>>> topo = Topo()
>>>
>>> # Example where pixel angles are stored in separate GeoTiff files
>>> with gw.config.update(sensor='l7', scale_factor=0.0001, nodata=0):
>>>
>>>     with gw.open('landsat.tif') as src,
>>>         gw.open('srtm') as elev,
>>>             gw.open('solarz.tif') as solarz,
>>>                 gw.open('solara.tif') as solara:
>>>
>>>         src_norm = topo.norm_topo(src, elev, solarz, solara, n_jobs=-1)
norm_topo(data, elev, solar_za, solar_az, slope=None, aspect=None, method='empirical-rotation', slope_thresh=2, nodata=0, elev_nodata=-32768, scale_factor=1, angle_scale=0.01, n_jobs=1, robust=False, min_samples=100, slope_kwargs=None, aspect_kwargs=None, band_coeffs=None)[source]#

Applies topographic normalization.

Parameters:
  • data (2d or 3d DataArray) – The data to normalize, in the range 0-1.

  • elev (2d DataArray) – The elevation data.

  • solar_za (2d DataArray) – The solar zenith angles (degrees).

  • solar_az (2d DataArray) – The solar azimuth angles (degrees).

  • slope (2d DataArray) – The slope data. If not given, slope is calculated from elev.

  • aspect (2d DataArray) – The aspect data. If not given, aspect is calculated from elev.

  • method (Optional[str]) – The method to apply. Choices are [‘c’, ‘empirical-rotation’].

  • slope_thresh (Optional[float or int]) – The slope threshold. Any samples with values < slope_thresh are not adjusted.

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

  • elev_nodata (Optional[float or int]) – The ‘no data’ value for elev.

  • scale_factor (Optional[float]) – A scale factor to apply to the input data.

  • angle_scale (Optional[float]) – The angle scale factor.

  • n_jobs (Optional[int]) – The number of parallel workers for LinearRegression.fit.

  • robust (Optional[bool]) – Whether to fit a robust regression.

  • min_samples (Optional[int]) – The minimum number of samples required to fit a regression.

  • slope_kwargs (Optional[dict]) – Keyword arguments passed to gdal.DEMProcessingOptions to calculate the slope.

  • aspect_kwargs (Optional[dict]) – Keyword arguments passed to gdal.DEMProcessingOptions to calculate the aspect.

  • band_coeffs (Optional[dict]) – Slope and intercept coefficients for each band.

References

See [TGG82] for the C-correction method. See [TWM+10] for the Empirical Rotation method.

Returns:

xarray.DataArray

Examples

>>> import geowombat as gw
>>> from geowombat.radiometry import Topo
>>>
>>> topo = Topo()
>>>
>>> # Example where pixel angles are stored in separate GeoTiff files
>>> with gw.config.update(sensor='l7', scale_factor=0.0001, nodata=0):
>>>
>>>     with gw.open('landsat.tif') as src,
>>>         gw.open('srtm') as elev,
>>>             gw.open('solarz.tif') as solarz,
>>>                 gw.open('solara.tif') as solara:
>>>
>>>         src_norm = topo.norm_topo(src, elev, solarz, solara, n_jobs=-1)

[TWM+10] (1,2)

Bin Tan, Robert Wolfe, Jeffrey Masek, Feng Gao, and Eric F Vermote. An illumination correction algorithm on Landsat-TM data. In 2010 IEEE International Geoscience and Remote Sensing Symposium, 1964–1967. IEEE, 2010.

[TGG82] (1,2)

PM Teillet, B Guindon, and DG Goodenough. On the slope-aspect correction of multispectral scanner data. Canadian Journal of Remote Sensing, 8(2):84–106, 1982.