darts_acquisition.tcvis
¶
Landsat Trends related Data Loading. Should be used temporary and maybe moved to the acquisition package.
download_tcvis
¶
Download TCVIS (Tasseled Cap trends) data for the specified area of interest.
This function downloads Tasseled Cap trend data from Google Earth Engine for the given area of interest and stores it in a local icechunk data store for efficient access.
Parameters:
-
aoi(geopandas.GeoDataFrame) –Area of interest for which to download TCVIS data. Can be in any CRS; will be reprojected to the TCVIS dataset's native CRS.
-
data_dir(pathlib.Path | str) –Path to the icechunk data directory (must have .icechunk suffix).
Note
Requires Google Earth Engine authentication to be set up before calling this function.
Use ee.Initialize() or ee.Authenticate() as needed.
Example
Download TCVIS for a study area:
Source code in darts-acquisition/src/darts_acquisition/tcvis.py
load_tcvis
¶
load_tcvis(
geobox: odc.geo.geobox.GeoBox,
data_dir: pathlib.Path | str,
buffer: int = 0,
offline: bool = False,
) -> xarray.Dataset
Load TCVIS (Tasseled Cap trends) for the given geobox, fetch new data from GEE if necessary.
This function loads Tasseled Cap trend data from a local icechunk store. If offline=False,
missing data will be automatically downloaded from Google Earth Engine and stored locally.
The data contains temporal trends in brightness, greenness, and wetness derived from
Landsat imagery.
Parameters:
-
geobox(odc.geo.geobox.GeoBox) –The geobox for which to load the data. Can be in any CRS.
-
data_dir(pathlib.Path | str) –Path to the icechunk data directory (must have .icechunk suffix). This directory stores downloaded TCVIS data for faster consecutive access.
-
buffer(int, default:0) –Buffer around the geobox in pixels. The buffer is applied in the TCVIS dataset's native CRS after reprojecting the input geobox. Defaults to 0.
-
offline(bool, default:False) –If True, only loads data already present in the local store without attempting any downloads. If False, missing data is downloaded from GEE. Defaults to False.
Returns:
-
xarray.Dataset–xr.Dataset: The TCVIS dataset with the following data variables: - tc_brightness (float): Temporal trend in Tasseled Cap brightness component - tc_greenness (float): Temporal trend in Tasseled Cap greenness component - tc_wetness (float): Temporal trend in Tasseled Cap wetness component
The dataset is in the TCVIS native CRS with the buffer applied. It is NOT automatically reprojected to match the input geobox's CRS.
Note
The offline parameter controls data fetching behavior:
- When
offline=False: Usessmart_geocubesaccessor'sload()method which automatically downloads missing tiles from GEE and persists them to the icechunk store. - When
offline=True: Uses the accessor'sopen_xarray()method to open the existing store and crops it to the requested region. Raises an error if data is missing.
Variable naming: The original TCB_slope, TCG_slope, and TCW_slope variables are renamed to follow DARTS conventions (tc_brightness, tc_greenness, tc_wetness).
Example
Load TCVIS data aligned with optical imagery:
from darts_acquisition import load_tcvis
# Assume "optical" is a loaded Sentinel-2 dataset
tcvis = load_tcvis(
geobox=optical.odc.geobox,
data_dir="/data/tcvis.icechunk",
buffer=0,
offline=False
)
# Reproject to match optical data's CRS and resolution
tcvis = tcvis.odc.reproject(optical.odc.geobox, resampling="cubic")