mass_balance_module.mass_balance_from_thickness_entrypoint

Command line entry point for converting ice thickness to mass balance.

Implemented for ISMIP6 data but designed to be generalisable to other datasets with the appropriate CF metadata.

By default outputs a gridded (time, y, x) mass balance zarr in kg/cell/yr, preserving the input coordinate system.

Functions

main(input_zarr, output_path)

Convert ice thickness to gridded mass balance.

write_mass_balance_to_geozarr(mb_ds, output_path)

Write the computed mass balance to a GeoZarr file with appropriate metadata.

mass_balance_module.mass_balance_from_thickness_entrypoint.main(input_zarr: ZarrType, output_path: Path) → None

Convert ice thickness to gridded mass balance.

Input dataset should have a CRS written with rioxarray and its variables should be annotated with standard_name/long_name attributes so that ice thickness and grounded fraction (if present) can be auto-detected. If the dataset lacks a ‘cell_area’ variable, cell area will be inferred from coordinate spacing if possible (regular 1-D x/y coordinates); otherwise an error is raised.

Parameters:
  • input_zarr (ZarrType) – Input gridded zarr with x, y, and time coordinates, CF-attributed ice thickness (and optionally grounded fraction) variables, and CRS metadata written by rioxarray.

  • output_path (Path) – Where to write the output zarr.

mass_balance_module.mass_balance_from_thickness_entrypoint.write_mass_balance_to_geozarr(mb_ds: Dataset, output_path: Path, target_chunk_size: str = '1024MB') → None

Write the computed mass balance to a GeoZarr file with appropriate metadata.

Parameters:
  • mb_ds (xr.Dataset) – The computed mass balance dataset.

  • output_path (Path) – The path where the output GeoZarr file should be written.

  • target_chunk_size (str) – The target chunk size for the output GeoZarr file, by default “1024MB”. This is set on the high side to avoid lots of file downloading in the cloud. The xarray documentation recommends setting this value 10-100MB if you are working locally.