v2
darts_preprocessing.v2
¶
PLANET scene based preprocessing.
calculate_aspect
¶
Calculate the aspect of the terrain surface from an ArcticDEM Dataset.
Parameters:
Returns:
-
xarray.Dataset
–xr.Dataset: The input Dataset with the calculated aspect added as a new variable 'aspect'.
Source code in darts-preprocessing/src/darts_preprocessing/engineering/arcticdem.py
calculate_curvature
¶
Calculate the curvature of the terrain surface from an ArcticDEM Dataset.
Parameters:
Returns:
-
xarray.Dataset
–xr.Dataset: The input Dataset with the calculated curvature added as a new variable 'curvature'.
Source code in darts-preprocessing/src/darts_preprocessing/engineering/arcticdem.py
calculate_hillshade
¶
calculate_hillshade(
arcticdem_ds: xarray.Dataset,
azimuth: int = 225,
angle_altitude: int = 25,
) -> xarray.Dataset
Calculate the hillshade of the terrain surface from an ArcticDEM Dataset.
Parameters:
-
arcticdem_ds
(xarray.Dataset
) –The ArcticDEM Dataset containing the 'dem' variable.
-
azimuth
(int
, default:225
) –The azimuth angle of the light source in degrees. Defaults to 225.
-
angle_altitude
(int
, default:25
) –The altitude angle of the light source in degrees. Defaults to 25.
Returns:
-
xarray.Dataset
–xr.Dataset: The input Dataset with the calculated hillshade added as a new variable 'hillshade'.
Source code in darts-preprocessing/src/darts_preprocessing/engineering/arcticdem.py
calculate_ndvi
¶
Calculate NDVI from an xarray Dataset containing spectral bands.
This function will clip the NIR and Red bands to the range [0, 1] before calculating NDVI to avoid potential numerical instabilities from negative reflections.
Parameters:
Returns:
Notes
NDVI (Normalized Difference Vegetation Index) is calculated using the formula: NDVI = (NIR - Red) / (NIR + Red)
Source code in darts-preprocessing/src/darts_preprocessing/engineering/indices.py
calculate_slope
¶
Calculate the slope of the terrain surface from an ArcticDEM Dataset.
Parameters:
Returns:
-
xarray.Dataset
–xr.Dataset: The input Dataset with the calculated slope added as a new variable 'slope'.
Source code in darts-preprocessing/src/darts_preprocessing/engineering/arcticdem.py
calculate_topographic_position_index
¶
calculate_topographic_position_index(
arcticdem_ds: xarray.Dataset,
outer_radius: int,
inner_radius: int,
) -> xarray.Dataset
Calculate the Topographic Position Index (TPI) from an ArcticDEM Dataset.
Parameters:
-
arcticdem_ds
(xarray.Dataset
) –The ArcticDEM Dataset containing the 'dem' variable.
-
outer_radius
(int
) –The outer radius of the annulus kernel in m.
-
inner_radius
(int
) –The inner radius of the annulus kernel in m.
Returns:
-
xarray.Dataset
–xr.Dataset: The input Dataset with the calculated TPI added as a new variable 'tpi'.
Source code in darts-preprocessing/src/darts_preprocessing/engineering/arcticdem.py
get_azimuth_and_elevation
¶
Get the azimuth and elevation from the optical dataset attributes.
Parameters:
Returns:
Source code in darts-preprocessing/src/darts_preprocessing/v2.py
preprocess_arcticdem
¶
preprocess_arcticdem(
ds_arcticdem: xarray.Dataset,
tpi_outer_radius: int,
tpi_inner_radius: int,
azimuth: int,
angle_altitude: int,
) -> xarray.Dataset
Preprocess the ArcticDEM data with mdoern (DARTS v2) preprocessing steps.
Parameters:
-
ds_arcticdem
(xarray.Dataset
) –The ArcticDEM dataset.
-
tpi_outer_radius
(int
) –The outer radius of the annulus kernel for the tpi calculation in number of cells.
-
tpi_inner_radius
(int
) –The inner radius of the annulus kernel for the tpi calculation in number of cells.
-
azimuth
(int
) –The azimuth angle of the light source in degrees for hillshade calculation.
-
angle_altitude
(int
) –The altitude angle of the light source in degrees for hillshade
Returns:
Source code in darts-preprocessing/src/darts_preprocessing/v2.py
preprocess_v2
¶
preprocess_v2(
ds_optical: xarray.Dataset,
ds_arcticdem: xarray.Dataset,
ds_tcvis: xarray.Dataset,
tpi_outer_radius: int = 100,
tpi_inner_radius: int = 0,
device: typing.Literal["cuda", "cpu"]
| int = darts_utils.cuda.DEFAULT_DEVICE,
) -> xarray.Dataset
Preprocess optical data with modern (DARTS v2) preprocessing steps.
The processing steps are: - Calculate NDVI - Calculate slope, hillshade, aspect, curvature and relative elevation from ArcticDEM - Merge everything into a single ds.
Parameters:
-
ds_optical
(xarray.Dataset
) –The Planet scene optical data or Sentinel 2 scene optical dataset including data_masks.
-
ds_arcticdem
(xarray.Dataset
) –The ArcticDEM dataset.
-
ds_tcvis
(xarray.Dataset
) –The TCVIS dataset.
-
tpi_outer_radius
(int
, default:100
) –The outer radius of the annulus kernel for the tpi calculation in m. Defaults to 100m.
-
tpi_inner_radius
(int
, default:0
) –The inner radius of the annulus kernel for the tpi calculation in m. Defaults to 0.
-
device
(typing.Literal['cuda', 'cpu'] | int
, default:darts_utils.cuda.DEFAULT_DEVICE
) –The device to run the tpi and slope calculations on. If "cuda" take the first device (0), if int take the specified device. Defaults to "cuda" if cuda is available, else "cpu".
Returns:
Source code in darts-preprocessing/src/darts_preprocessing/v2.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|