Preprocessing Reference¶
darts_preprocessing
¶
Data preprocessing and feature engineering for the DARTS dataset.
load_and_preprocess_planet_scene(planet_scene_path, arcticdem_dir, cache_dir=None)
¶
Load and preprocess a Planet Scene (PSOrthoTile or PSScene) into an xr.Dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
planet_scene_path
|
Path
|
path to the Planet Scene |
required |
arcticdem_dir
|
Path
|
path to the ArcticDEM directory |
required |
cache_dir
|
Path | None
|
The cache directory. If None, no caching will be used. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
Dataset
|
xr.Dataset: preprocessed Planet Scene |
Examples:
Data directory structure:
data/input
└── planet
├── ArcticDEM
│ ├── relative_elevation
│ │ └── 4372514_relative_elevation_100.tif
│ └── slope
│ └── 4372514_slope.tif
└── planet
└── PSOrthoTile
└── 4372514/5790392_4372514_2022-07-16_2459
├── 5790392_4372514_2022-07-16_2459_BGRN_Analytic_metadata.xml
├── 5790392_4372514_2022-07-16_2459_BGRN_DN_udm.tif
├── 5790392_4372514_2022-07-16_2459_BGRN_SR.tif
├── 5790392_4372514_2022-07-16_2459_metadata.json
├── 5790392_4372514_2022-07-16_2459_udm2.tif
Load and preprocess a Planet Scene:
from pathlib import Path
from darts_preprocessing.preprocess import load_and_preprocess_planet_scene
fpath = Path("data/input/planet/planet/PSOrthoTile/4372514/5790392_4372514_2022-07-16_2459")
arcticdem_dir = input_data_dir / "ArcticDEM" / "relative_elevation" / f"{scene_id}_relative_elevation_100.tif"
tile = load_and_preprocess_planet_scene(fpath, arcticdem_dir)