aris_lite package

Note

Canonical CLI is aris with subcommands 1go and calc. Legacy flat CLI entries and legacy module-level main*/cli aliases are deprecated and scheduled for removal in 0.4.0.

Implementation of the ARIS-lite model package.

type aris_lite.T_crop_names = 'winter wheat' | 'spring barley' | 'maize' | 'soybean' | 'norm potato' | 'grassland'
aris_lite.aris_1go(ds: xr.Dataset, crops: Iterable[T_crop_names]) xr.Dataset[source]

Legacy alias for run_1go().

aris_lite.cli(argv: list[str] | None = None) int[source]

Legacy CLI alias for aris-1go; use aris 1go.

aris_lite.extract_point_data(ds, locations)[source]

Extract data for specific point locations from a dataset.

For each location provided, selects the nearest grid point in the dataset and concatenates the results along a new ‘location’ dimension.

aris_lite.main_cli(argv: list[str] | None = None) int[source]

Legacy CLI alias for aris-1go; use aris 1go.

aris_lite.run_1go(ds: xr.Dataset, crops: Iterable[T_crop_names]) xr.Dataset[source]

Run the in-memory 1go ARIS-lite workflow on a single dataset.

This routine computes snow, phenology, soil-water outputs, and top-layer waterstress. It intentionally does not compute yield outputs.

Submodules

aris_lite.phenology module

Phenology module

This module computes the crop coefficients (Kc) and plant heights for different crops based on temperature and crop-specific phenological rules. These variables are essential for modeling crop growth, water use, and yield.

aris_lite.phenology.compute_phenology_variables(temperature: DataArray, crops: Iterable[T_crop_names] = ('winter wheat', 'spring barley', 'maize', 'grassland'), grass_cut_mask: DataArray | None = None) Dataset[source]

Compute crop coefficients (Kc) and plant heights for specified crops.

Uses temperature data and crop-specific rules to determine phenological stages, then assigns Kc and plant height values accordingly.

Parameters:
temperature : xr.DataArray

Daily surface air temperature average for one year.

crops : Iterable[str], optional

List of crops to compute phenology for.

Returns:

Dataset containing Kc_factor and plant_height for each crop.

Return type:

xr.Dataset

Notes

The current implementation draws on the three references below (basic idea: [All00], parameters and specifications: [EDK+24], grass cut days: [Sch11]).

[All00]

Richard G. Allen, editor. Crop Evapotranspiration: Guidelines for Computing Crop Water Requirements. Number 56 in FAO Irrigation and Drainage Paper. Food and Agriculture Organization of the United Nations, Rome, repr edition, 2000. ISBN 978-92-5-104219-9.

[EDK+24]

Josef Eitzinger, Voiko Daneu, Gerhard Kubu, Sabina Thaler, Mirek Trnka, Andreas Schaumberger, Stefan Schneider, and Thi Mai Anh Tran. Grid based monitoring and forecasting system of cropping conditions and risks by agrometeorological indicators in Austria – Agricultural Risk Information System ARIS. Climate Services, 34:100478, April 2024. doi:10.1016/j.cliser.2024.100478.

[Sch11]

Andreas Schaumberger. Räumliche Modelle zur Vegetations- und Ertragsdynamik im Wirtschaftsgrünland. PhD thesis, Graz University of Technology, Graz, Austria, September 2011.

aris_lite.phenology.main(years: Iterable[int], crops: Iterable[T_crop_names] = ('winter wheat', 'spring barley', 'maize', 'grassland'), base_dir: str = '../data')[source]

Legacy alias for run_calc_pheno() yearly core.

aris_lite.phenology.main_cli(argv: list[str] | None = None) int[source]

Command-line interface for computing phenology variables.

Parses command-line arguments to determine which years to process and how many Dask workers to use. Initializes a Dask cluster for parallel processing, handles missing data, and manages workflow for phenology calculations.

Usage:

aris-calc-pheno [years …] [–workers N] [–mem-per-worker SIZE]

Returns:

None

aris_lite.phenology.run_calc_pheno(years: Iterable[int], crops: Iterable[T_crop_names] = ('winter wheat', 'spring barley', 'maize', 'grassland'), workers: int = 4, mem_per_worker: str = '3Gb', base_dir: str = '../data')[source]

Load data, compute phenology variables, and save output for specified years.

For each year, loads temperature data, computes phenology variables for the given crops, and writes the results to a Zarr store.

Parameters:
years : Iterable[int]

List of years to compute.

crops : Iterable, optional

List of crops to compute, defaults to (“winter wheat”, “spring barley”, “maize”, “grassland”).

aris_lite.water_budget module

Water budget module

This module computes the snow/rain fraction, snow cover, evapotranspiration, and soil water availability for crop modeling. It provides functions to process meteorological and crop data to estimate water-related variables critical for crop growth and yield estimation.

aris_lite.water_budget.calc_snow(ds: Dataset) Dataset[source]

Calculate snowfall, meltwater production, and snow cover over time.

This function simulates the snow accumulation and melting process based on precipitation and temperature data. It returns a dataset with snowfall, meltwater production, and snow cover for each time step.

Parameters:
ds : xr.Dataset

Dataset containing variables “precipitation”, “min_air_temp”, “max_air_temp”, and “initial_snowcover”.

Returns:

Dataset with variables “snowfall”, “meltwater_production”, and “snowcover”.

Return type:

xr.Dataset

aris_lite.water_budget.calc_soil_water(ds: Dataset) Dataset[source]

Calculate evapotranspiration and soil water depletion for crops.

This function estimates the actual evapotranspiration, crop evapotranspiration (ETC), and soil water depletion in different soil layers, based on crop coefficients, meteorological data, and soil properties.

Parameters:
ds : xr.Dataset

Dataset containing variables “Kc_factor”, “plant_height”, “precipitation”, “wind_speed”, “rel_humidity”, “pot_evapotransp”, “snowfall”, and “meltwater_production”.

Returns:

Dataset with variables “evapotranspiration”, “evapo_ETC”, and “soil_depletion”.

Return type:

xr.Dataset

aris_lite.water_budget.main_cli(argv: list[str] | None = None) int[source]

Legacy CLI alias for aris-calc-waterbudget; use aris calc waterbudget.

aris_lite.water_budget.main_snow(years: Iterable[int], base_dir: str = '../data')[source]

Legacy alias for run_water_budget_snow().

aris_lite.water_budget.main_soil_water(years: Iterable[int], base_dir: str = '../data')[source]

Legacy alias for run_water_budget_soil().

aris_lite.water_budget.run_calc_waterbudget(years: Iterable[int], mode: str = 'auto', workers: int = 4, mem_per_worker: str = '2Gb', base_dir: str = '../data')[source]

Command-line interface for computing snow/melt or soil water and evapotranspiration.

Parses command-line arguments to determine which computations to perform and for which years. Initializes a Dask cluster for parallel processing, handles missing data, and manages workflow for snow and soil water calculations.

Usage:

aris-calc-waterbudget [-m MODE] [years …] [–workers N] [–mem-per-worker SIZE]

Returns:

None

aris_lite.water_budget.run_water_budget_snow(years: Iterable[int], base_dir: str = '../data')[source]

Load input data and write snow-related results to Zarr store.

For each year, this function loads meteorological data, initializes snow cover, computes snowfall and meltwater production, and saves the results.

Parameters:
years : Iterable[int]

List of years to compute.

aris_lite.water_budget.run_water_budget_soil(years: Iterable[int], base_dir: str = '../data')[source]

Load input data and write soil water and evapotranspiration results to Zarr store.

For each year, this function loads the necessary datasets, computes soil water depletion and evapotranspiration, and saves the results.

Parameters:
years : Iterable[int]

List of years to compute.

aris_lite.yield_expectation module

Stress and yield estimation for ARIS-lite.

This module is the final stage of the ARIS-lite chain: phenology provides crop activity (Kc_factor, plant_height), water budget provides evapotranspiration and soil depletion, and meteorology provides temperature. From these inputs, stress indicators are derived and translated into crop-wise yield depression.

aris_lite.yield_expectation.calc_heat_drought_compound_stress(ds: Dataset, threshold_temperature=None) DataArray[source]

Calculate crop-specific compound heat-drought stress.

This stressor approximates daily crop damage pressure from concurrent heat and water limitations. Rules are crop-specific and based on the original ARIS logic: winter cereals and soybean combine water stress with heat exceedance, maize/barley/soybean apply a stronger thresholded response, potatoes use potato-specific heat thresholds, and grassland follows water stress only.

The input waterstress is used when present; otherwise it is derived as soil_depletion / TAW for the top soil layer. Stress values before effective crop activity are masked using Kc_factor.

Parameters:
ds : xr.Dataset

Dataset containing max_air_temp and Kc_factor, and either waterstress or soil_depletion with TAW. plant_height is required for irrigated norm potato handling.

threshold_temperature : float, optional

Optional temperature threshold for potato crops other than norm potato and irrigated norm potato.

Returns:

Daily compound stress index for each crop.

Return type:

xr.DataArray

aris_lite.yield_expectation.calc_stresses(ds: Dataset) DataArray[source]

Build the full stress tensor used by yield estimation.

Combines simple threshold stressors (heat, drought) with the crop-specific compound heat-drought stress and stacks them along the stressor dimension. This is the direct input expected by calc_yield.

Parameters:
ds : xr.Dataset

Dataset with meteorological, phenology, and water-balance inputs.

Returns:

DataArray named stresses with dimensions including stressor.

Return type:

xr.DataArray

aris_lite.yield_expectation.calc_yield(stress_data: DataArray, yield_max: DataArray, yield_intercept: DataArray, params: DataArray, temporal_mask: DataArray = <xarray.DataArray ()> Size: 1B array(True), grass_cut_numbers: DataArray = <xarray.DataArray ()> Size: 8B array(0)) DataArray[source]

Estimate yield depression from one or multiple stressors.

The function applies a linear stress-response model where each stressor is weighted by a crop-specific parameter, added to an intercept, and scaled by maximum attainable yield. The result is expressed as percentage yield loss.

If a time dimension exists, stress is first masked by temporal_mask, cumulatively aggregated per year, and aligned back to the original time coordinate. Optional grass-cut information can be used to broadcast management-specific parameters and collapse grass1, grass2, and grassM into a single grassland class.

Parameters:
stress_data : xr.DataArray

Stress input with a stressor dimension.

yield_max : xr.DataArray

Maximum attainable yield (same spatial/crop support).

yield_intercept : xr.DataArray

Baseline yield term used in the linear model.

params : xr.DataArray

Stress-response coefficients, typically by stressor and crop (and optionally management class).

temporal_mask : xr.DataArray

Boolean mask selecting time steps that contribute to cumulative stress.

grass_cut_numbers : xr.DataArray

Optional grass management descriptor used to align and merge grass-specific parameters.

Returns:

Yield depression in percent, clipped to [0, 100].

Return type:

xr.DataArray

aris_lite.yield_expectation.main_cli(argv: list[str] | None = None) int[source]

Legacy CLI alias for aris-calc-yield; use aris calc yield.

aris_lite.yield_expectation.main_heat_drought_compound_stress(years: Iterable[int], base_dir: str = '../data')[source]

Legacy alias for run_calc_stresses().

aris_lite.yield_expectation.main_yield(years: Iterable[int], *, yield_max_path: str | None = None, yield_intercept_path: str | None = None, yield_params_path: str | None = None, temporal_mask_path: str | None = None, grass_cut_numbers_path: str | None = None, base_dir: str = '../data')[source]

Legacy alias for run_yield_depression().

aris_lite.yield_expectation.run_calc_stresses(years: Iterable[int], base_dir: str = '../data')[source]

Compute and persist yearly heat-drought compound stress datasets.

The output store path follows intermediate/CSI_<year>.zarr under base_dir.

aris_lite.yield_expectation.run_calc_yield(years: Iterable[int], mode: str = 'auto', workers: int = 4, mem_per_worker: str = '1Gb', base_dir: str = '../data', yield_max_path: str | None = None, yield_intercept_path: str | None = None, yield_params_path: str | None = None, temporal_mask_path: str | None = None, grass_cut_numbers_path: str | None = None)[source]

Command-line interface for computing stress indices and/or yield expectations.

Parses command-line arguments to determine which computations to perform and for which years. Initializes a Dask cluster for parallel processing, handles missing data, and manages workflow for stress and yield calculations.

Usage:

aris-calc-yield [-m MODE] [years …] [–workers N] [–mem-per-worker SIZE]

Returns:

None