diff --git a/docs/conf.py b/docs/conf.py index 43138d673f5..b4d68d41c98 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,6 +38,7 @@ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.intersphinx", + "sphinx.ext.mathjax", "sphinx.ext.napoleon", "sphinx.ext.todo", "sphinx.ext.viewcode", diff --git a/torchgeo/transforms/indices.py b/torchgeo/transforms/indices.py index 40aab4bbd95..63a45ae517f 100644 --- a/torchgeo/transforms/indices.py +++ b/torchgeo/transforms/indices.py @@ -23,7 +23,13 @@ class AppendNormalizedDifferenceIndex(Module): - """Append normalized difference index as channel to image tensor. + r"""Append normalized difference index as channel to image tensor. + + Computes the following index: + + .. math:: + + \text{NDI} = \frac{A - B}{A + B} .. versionadded:: 0.2 """ @@ -76,7 +82,13 @@ def forward(self, sample: Dict[str, Tensor]) -> Dict[str, Tensor]: class AppendNBR(AppendNormalizedDifferenceIndex): - """Normalized Burn Ratio (NBR). + r"""Normalized Burn Ratio (NBR). + + Computes the following index: + + .. math:: + + \text{NBR} = \frac{\text{NIR} - \text{SWIR}}{\text{NIR} + \text{SWIR}} If you use this index in your research, please cite the following paper: @@ -96,7 +108,13 @@ def __init__(self, index_nir: int, index_swir: int) -> None: class AppendNDBI(AppendNormalizedDifferenceIndex): - """Normalized Difference Built-up Index (NDBI). + r"""Normalized Difference Built-up Index (NDBI). + + Computes the following index: + + .. math:: + + \text{NDBI} = \frac{\text{SWIR} - \text{NIR}}{\text{SWIR} + \text{NIR}} If you use this index in your research, please cite the following paper: @@ -114,7 +132,13 @@ def __init__(self, index_swir: int, index_nir: int) -> None: class AppendNDSI(AppendNormalizedDifferenceIndex): - """Normalized Difference Snow Index (NDSI). + r"""Normalized Difference Snow Index (NDSI). + + Computes the following index: + + .. math:: + + \text{NDSI} = \frac{\text{G} - \text{SWIR}}{\text{G} + \text{SWIR}} If you use this index in your research, please cite the following paper: @@ -132,7 +156,13 @@ def __init__(self, index_green: int, index_swir: int) -> None: class AppendNDVI(AppendNormalizedDifferenceIndex): - """Normalized Difference Vegetation Index (NDVI). + r"""Normalized Difference Vegetation Index (NDVI). + + Computes the following index: + + .. math:: + + \text{NDVI} = \frac{\text{R} - \text{NIR}}{\text{R} + \text{NIR}} If you use this index in your research, please cite the following paper: @@ -150,7 +180,13 @@ def __init__(self, index_red: int, index_nir: int) -> None: class AppendNDWI(AppendNormalizedDifferenceIndex): - """Normalized Difference Water Index (NDWI). + r"""Normalized Difference Water Index (NDWI). + + Computes the following index: + + .. math:: + + \text{NDWI} = \frac{\text{G} - \text{NIR}}{\text{G} + \text{NIR}} If you use this index in your research, please cite the following paper: @@ -168,7 +204,13 @@ def __init__(self, index_green: int, index_nir: int) -> None: class AppendSWI(AppendNormalizedDifferenceIndex): - """Standardized Water-Level Index (SWI). + r"""Standardized Water-Level Index (SWI). + + Computes the following index: + + .. math:: + + \text{SWI} = \frac{\text{R} - \text{SWIR}}{\text{R} + \text{SWIR}} If you use this index in your research, please cite the following paper: @@ -186,7 +228,13 @@ def __init__(self, index_red: int, index_swir: int) -> None: class AppendGNDVI(AppendNormalizedDifferenceIndex): - """Green Normalized Difference Vegetation Index (GNDVI). + r"""Green Normalized Difference Vegetation Index (GNDVI). + + Computes the following index: + + .. math:: + + \text{GNDVI} = \frac{\text{NIR} - \text{G}}{\text{NIR} + \text{G}} If you use this index in your research, please cite the following paper: @@ -204,7 +252,13 @@ def __init__(self, index_nir: int, index_green: int) -> None: class AppendBNDVI(AppendNormalizedDifferenceIndex): - """Blue Normalized Difference Vegetation Index (BNDVI). + r"""Blue Normalized Difference Vegetation Index (BNDVI). + + Computes the following index: + + .. math:: + + \text{BNDVI} = \frac{\text{NIR} - \text{B}}{\text{NIR} + \text{B}} If you use this index in your research, please cite the following paper: @@ -224,7 +278,13 @@ def __init__(self, index_nir: int, index_blue: int) -> None: class AppendNDRE(AppendNormalizedDifferenceIndex): - """Normalized Difference Red Edge Vegetation Index (NDRE). + r"""Normalized Difference Red Edge Vegetation Index (NDRE). + + Computes the following index: + + .. math:: + + \text{NDRE} = \frac{\text{NIR} - \text{VRE1}}{\text{NIR} + \text{VRE1}} If you use this index in your research, please cite the following paper: