cryoswath.l4 module

Library of functions to produce level 4 (L4) data

cryoswath.l4.add_meta_to_default_finalized_l3(outdir: str | Path, your_name: str = 'unkown', your_institution: str = 'n/a', all_double: bool = False)[source]

Adds meta data to and changes variable names of L3 dataset

This function expects that pathlib.Path().stat().st_mtime() returns seconds since Unix epoch and only makes sense if you ran:

cryoswath.l3.build_dataset(region_id)
cryoswath.l4.fill_l3_voids(region_id)

If you deviated from default values in the processing, verify the output of this function.

Parameters:
  • outdir (str | Path) – Path to output directory.

  • your_name (str, optional) – Your name. Defaults to “n/a”.

  • your_institution (str, optional) – Your institution. Defaults to “n/a”.

cryoswath.l4.append_basin_group(ds: DataArray | Dataset, basin_gdf: GeoDataFrame = None) Dataset[source]
cryoswath.l4.append_basin_id(ds: DataArray | Dataset, basin_gdf: GeoDataFrame = None) Dataset[source]
cryoswath.l4.append_elevation_reference(geospatial_ds: Dataset | DataArray, ref_elev_name: str = 'ref_elev', dem_file_name_or_path: str = None) Dataset[source]
cryoswath.l4.difference_to_reference_dem(l3_data: Dataset, save_to_disk: str | bool = True, basin_shapes: GeoDataFrame = None) Dataset[source]
cryoswath.l4.elevation_trend_raster_from_l3(region_id: str, *, only_intermediate: bool = False) Dataset[source]

Calculate elevation trend for each cell of L3 dataset

This is a convenience function that currently takes opinionated choices that cannot be modified. More capabilities are planned to be implemented in future.

Next to returning the elevation trends, these are, also, written to disk. If the result files are present, these will be read instead of repeating the calculation.

Parameters:
  • region_id (str) – Region identifier that was used in the L3 Zarr store names.

  • only_intermediate (bool, optional) – If true, returns after calculating the trends where sufficient data is available and skips filling voids. Defaults to False.

Returns:

Dataset of elevation trends and other parameters, depending on the usage.

Return type:

xr.Dataset

cryoswath.l4.fill_l3_voids(o2region: str) Dataset[source]

Fills data gaps in L3 datasets

This is a convenience function that currently takes opinionated choices that cannot be modified. More capabilities are planned to be implemented in future.

This function, also, writes the results to disk. If a file is present at the corresponding location, it is read instead of being recalculated.

Parameters:

o2region (str) – The RGI second order region identifier.

Returns:

Filled dataset.

Return type:

xr.Dataset

cryoswath.l4.fill_voids(ds: Dataset, main_var: str, error: str, *, elev: str = 'ref_elev', per: tuple[str] = ('basin', 'basin_group'), basin_shapes: GeoDataFrame = None, outlier_limit: float = 5, outlier_replace: bool = False, outlier_iterations: int = 1, fit_sanity_check: dict = None, filled_flag: str = None) Dataset[source]
cryoswath.l4.fit_trend(data: ~xarray.core.dataset.Dataset, *, pivot: ~pandas.DateOffset = <DateOffset: months=0>, timestep_months: int = 12, return_raw: bool = False) Dataset[source]
cryoswath.l4.fit_trend__seasons_removed(l3_ds: Dataset) Dataset[source]
cryoswath.l4.trend_with_seasons(t_ns, trend, offset, amp_yearly, phase_yearly, amp_semiyr, phase_semiyr)[source]