Skip to content

API Reference

Every public function and class, with its signature, parameters and an example. Signatures on these pages are generated from the code, so they always match the installed version.

How to import

import zeit gives you the most used functions at the top level (zeit.landtrendr, zeit.save_raster, …) and registers the .zeit xarray accessor. Everything else lives in submodules (zeit.twdtw, zeit.segmentation, zeit.ai, …), shown in each signature.

  • Data & I/O


    STAC and Earth Engine cubes, local files, compositing, GeoTIFF I/O, QA weights.

  • Embeddings


    TESSERA and AlphaEarth yearly embeddings as cubes; similarity search; change from year to year.

  • Pre-processing


    Tmask cloud masking, Whittaker and Savitzky-Golay smoothing, spike removal.

  • Change Detection


    LandTrendr, CCDC, BFAST, BFAST Monitor, BFAST Lite, CODED, event extraction and agreement.

  • Time-Series Analysis


    Mann-Kendall trends, phenology, TWDTW, SNIC segmentation, SOM clustering.

  • Post-processing


    Spatial filters, CCDC classification, water masks.

  • Validation


    Stratified samples, labelling points by eye, accuracies and error-adjusted areas with confidence intervals.

  • Visualisation


    zeit.plot: a fast time-series viewer, pixel inspector, basemaps and static figures.

  • Deep Learning


    TempCNN, LightTAE, Presto, U-TAE, Siamese and foundation models; datasets and losses.

  • Xarray Accessor


    DataArray.zeit.*: every algorithm on lazy Dask cubes, and Zarr output.

  • Many Tiles & Helpers


    A folder of tiles on this computer and on others of the local network, resumable.

  • Command Line


    The core algorithms as zeit subcommands, for scripts and HPC jobs.

All functions

Function What it does
Data & I/O
build_time_series Lazy cube from a STAC catalog
build_annual_composites Cloud-masked annual composites from a STAC catalog (LandTrendr input)
download_gee_timeseries Harmonised Landsat composites from Earth Engine
download_gee_image / resolve_roi Download any ee.Image; turn tile ids, files or boxes into an area
regularize_time_series Median, medoid or clearest-date composites at a fixed step, gaps filled
load_raster / save_raster Read any time series as a georeferenced cube (scale and offset, bands by role, quality band, pixel windows) / write GeoTIFFs (with class names and colours)
build_vrt A VRT of tiles mosaicked and bands stacked, without GDAL's Python bindings
nd / normalized_difference The normalized difference of two bands, NaN where their sum is 0
qa_mask The observations a quality band keeps (Fmask, Landsat C2, SCL, HLS, FORCE QAI) as a boolean mask
qa_to_fmask The Fmask codes of a quality band (Landsat C2, SCL, HLS, FORCE QAI), for the qa= of CCDC and S-CCD
get_georef CRS and transform of a raster or cube
qc_sentinel2_scl, qc_modis_summary, qc_modis_state QA bands to observation weights
Embeddings
load_embeddings TESSERA or AlphaEarth embeddings of a region as a (time, band, y, x) cube
similarity Where (and when) pixels look like reference samples
embedding_change How far each pixel's embedding moved from year to year (events with extract_events)
Pre-processing
nbar Nadir BRDF-adjusted reflectance by the c-factor (Roy et al. 2016, 2017), from the per-pixel sun and view angles: HLS's view-angle step, before bandpass_adjust
coregister Moves each date of a cube to fit a reference image by the phase correlation of one window (AROSICS' global COREG, Scheffler et al. 2017), with each date's shift, reliability and similarity
coregister_local Warps each date of a cube to fit a reference image by the shifts of a grid of tie points, filtered by reliability, similarity and RANSAC (AROSICS' COREG_LOCAL), with a thin plate spline or a polynomial from GDAL, and the table of the tie points
topographic_correction Takes the relief's illumination out of reflectance with a DEM and the sun: C-correction (Teillet et al. 1982) or SCS+C (Soenen et al. 2005), Horn's slope and aspect
bandpass_adjust Sentinel-2 (and Landsat 5/7) on Landsat 8's bands: HLS's bandpass step, for L2A cubes (HLS itself: build_time_series)
spectral_adjust Landsat 4-9 and MODIS on Sentinel-2A's ten bands, the red edge predicted: FORCE's spectral adjustment
tasseled_cap Tasseled Cap brightness, greenness, wetness (and FORCE's disturbance): Crist 1985 as FORCE, or each sensor's matrix
mnf Minimum Noise Fraction components of a multiband image, highest SNR first, the noise from neighbouring pixels (Green et al. 1988; mnf_fit, inverse_mnf, mnf_denoise and MNFTransform fit, invert, denoise and keep it)
improphe Sharpens a coarse field or the scenes of a coarser sensor with the finer sensor's seasonal means: FORCE's CF-ImproPhe and L2-ImproPhe (Frantz et al. 2016)
sentinel2_resmerge The 20 m bands of Sentinel-2 at 10 m, by a moving-window regression, an ImproPhe-like weighted mean or STARFM on the 10 m green, red and NIR: FORCE's resolution merge
starfm STARFM spatiotemporal fusion (Gao et al. 2006, as FORCE's starfm()): the fine image of a date that only a coarse product covers, from pairs of fine and coarse images
fuse_starfm STARFM fusion of a fine series (Landsat, HLS, Sentinel-2) and a coarse one in its own grid (MODIS), from the paper (Gao et al. 2006): the fine image of every coarse date, clouds filled on the fine dates
fuse_estarfm ESTARFM fusion from two pairs (Zhu et al. 2010): neighbours similar on both dates, correlation weights, a conversion coefficient from a regression, temporal weights
fusion_plan The pairs and the dates a fusion would use, as a table, without running it
pansharpen Multispectral bands on the grid of a finer panchromatic band, for any sensor and any ratio above 1 (CBERS-4A WPM, Landsat 8 band 8, ...): Brovey, Gram-Schmidt adaptive (GSA), high-pass filter and principal components, written from the papers
level2_series find_l1c, download_l1c and level2 over the scenes of a tile, one at a time and resumable, as one lazy (time, band, y, x) reflectance cube
load_level2_series The scenes written by level2_series as that cube again: float32 reflectance x 10000, NaN for the fill and the QAI's default screening
find_l1c Sentinel-2 Level 1C products of a tile or a box in Earth Search, as a table by date with cloud cover and baseline
download_l1c The .SAFE of a product (what level2 reads) from the public Google Cloud bucket, with MD5 checks and resume
download_dem The Copernicus GLO-30 DEM of a scene or a box as one GeoTIFF, mosaicked in the geometry of the source
tmask Time-series cloud and shadow detection of a cube
parallax_clouds Sentinel-2 clouds from the potential cloud pixels by the parallax test (Cloud Displacement Index): FORCE's cloud_parallax (Frantz et al. 2018)
cloud_displacement_index The Cloud Displacement Index of Sentinel-2 on the 20 m grid
buffer_mask Buffers a boolean mask by a distance with FORCE's midpoint circle (its cloud buffer)
smooth Whittaker (uneven dates, gaps, weights) or Savitzky-Golay smoothing of a cube or series
unmix Fractions of green vegetation, NPV, soil, shade, cloud; the NDFI
desawtooth LandTrendr spike removal
Change detection
landtrendr LandTrendr on a file, cube, array or single pixel
extract_events One event per pixel, the same maps for every change algorithm (and for embedding change)
recovery_metrics Recovery after a disturbance: Y2R, R80P, RRI, ARI, YrYr
agreement Where and when several change maps agree
apply_vertices Fit another band to the same vertices
ccdc CCDC on a file, cube, array or single pixel
sccd Stochastic CCDC (S-CCD): CCDC updated by a Kalman filter, with the near-real-time state of each pixel
predict_synthetic_image Evaluate CCDC (and S-CCD) models on any date
bfast_monitor Near-real-time monitoring, on a file, cube, array or single pixel
bfast_lite Optimal multiple breakpoints
bfast Trend and seasonal breaks
coded Forest degradation and deforestation from the NDFI (CODED)
ewmacd Monitoring of irregular series with EWMA control charts (EWMACD): disturbance, recovery, gain
beast Bayesian changepoints, season and trend (BEAST): their probabilities and credible intervals
cva Change vector analysis of two dates: magnitude and direction (compressed, polar or sign sectors), fixed, Otsu or EM threshold
imad Iteratively re-weighted MAD (iMAD) between two dates: change images and the probability of no change, no radiometric normalization needed
radcal Relative radiometric normalization to a reference date by the invariant pixels of iMAD, with the tests of the fit
omnibus / estimate_enl The omnibus change test for Sentinel-1 series: dates, directions and p-values of the changes; the equivalent number of looks
Time-series analysis
mann_kendall Trend test and Theil-Sen slope
ar_trend Trend with AR(1) errors and its t-test (remotePARTS)
parts Regional test of the trends: mean, classes, covariates (PARTS)
emerging_hotspots Emerging hot spot analysis: Getis-Ord Gi* of every date and its trend, ESRI's patterns
eof Temporal EOFs (principal components) of a cube: maps, PCs, North's test, varimax, for cubes larger than the memory
lagged_correlation / fdr Correlation of every pixel with a driver at several lags, with the effective sample size, and the false discovery rate
phenology 19 phenology metrics per year or season
twdtw Classification by time-weighted DTW, on a file, cube or single pixel
snic / snic_to_polygons / snic_grid Superpixel segmentation of a map or cube, and its polygons
fields / fields_tiled / fields_to_polygons / edge_gradient / stochastic_watershed / watershed Field boundaries by the stochastic watershed (also by overlapping tiles, for rasters too large for one call), and their polygons
texture GLCM and window texture features of a map or a cube's summary
som Self-organizing map clusters of a map or cube, with each neuron's prototype
clean_samples Flag labelled samples whose class is not their SOM neuron's
SOM The SOM engine, online and batch (bit-exact minisom port)
Post-processing
apply_mmu_filter Remove patches below a minimum size
apply_majority_filter / apply_bayesian_filter Smooth class maps
mmu_sieve Merge patches below a minimum size into their neighbours
smooth_probs Bayesian smoothing of class probabilities (sits_smooth)
desawtooth_classes Remove short excursions from class series (A B A → A A A)
pixel_area / rasterize / polygonize The area of each pixel (geodesic), a layer burned on a grid, a map's patches as polygons
zonal_stats / zonal_areas Statistics, class areas and transitions of maps in each zone of a layer
train_classifier / classify Train at sample points, classify any cube, metrics or CCDC models
aoa / train_di Area of applicability of a model: dissimilarity index to the training data (CAST)
error_profile A model's error against the DI and the map of the error to expect (CAST's errorProfiles)
spatial_folds / autocorrelation_range Spatial cross-validation folds: blocks, buffer, clusters (blockCV); the range of a map's autocorrelation
extract_water_mask Water mask from CCDC
Validation
sampling_design Sample size and allocation per stratum (Olofsson et al. 2014)
stratified_sample Stratified random points of a map
interpret Label reference points by eye: chips, series, keyboard, review
accuracy Accuracies and error-adjusted areas with confidence intervals (direct, difference or ratio estimator)
transitions The area of each transition between two dates of a map of classes, with its interval
segmentation_accuracy Boundary, object (over/under-segmentation, IoU) and size accuracy of a field segmentation against a reference
Visualisation
plot Any cube, map, result or pixel: interactive viewer in a notebook or window, or a matplotlib figure
Deep learning (zeit.ai)
ai.samples, ai.train, ai.predict From a cube and labelled samples to a map with a deep learning model
ai.save, ai.load Keep a trained model with what prediction checks
TempCNN, LightTAE, LTAE Pixel time-series classifiers
Presto, presto_embeddings Pretrained pixel model; embeddings of a cube
UTAE Spatio-temporal patch segmentation
SiameseChangeDetector Two-date change detection
Prithvi Prithvi-EO-2.0 foundation model, fine-tuned to a class per pixel
STACCubeDataset Windows that cover a lazy cube, for a loop of your own
FocalLoss, TverskyLoss, ContrastiveSiameseLoss Losses for imbalanced data
Many tiles & helpers
run_tiles A command on every tile of a folder, here and on helpers; resumes where it stopped
run_worker Lend this computer to the group: wait for tiles and process them
invite_helpers A code with which other computers join the group
tile_urls, stac_tiles, gee_tiles Tiles each computer downloads or builds for itself