rook.fixes.legacy.utils package

Helper functions used by legacy fix implementations.

Submodules

rook.fixes.legacy.utils.attr_utils module

Module for editing dataset and variable attributes.

rook.fixes.legacy.utils.attr_utils.add_global_attrs_if_needed(ds_id, ds, **operands)[source]

Add missing global attrs and return the dataset.

rook.fixes.legacy.utils.attr_utils.edit_global_attrs(ds_id, ds, **operands)[source]

Edit global attrs and return the dataset.

rook.fixes.legacy.utils.attr_utils.edit_var_attrs(ds_id, ds, **operands)[source]

Edit variable attrs and return the dataset.

rook.fixes.legacy.utils.attr_utils.remove_coord_attr(ds_id, ds, **operands)[source]

Remove coordinates encoding attributes from selected variables.

rook.fixes.legacy.utils.common_utils module

Common utility functions for legacy data operations.

rook.fixes.legacy.utils.common_utils.handle_derive_str(value, ds_id, ds)[source]

Handle derive expressions by resolving and invoking the target callable.

rook.fixes.legacy.utils.coord_utils module

Coordinate operations used by legacy fixes.

rook.fixes.legacy.utils.coord_utils.add_coord(ds_id, ds, **operands)[source]

Add a coordinate along a dimension.

rook.fixes.legacy.utils.coord_utils.add_scalar_coord(ds_id, ds, **operands)[source]

Add a scalar coordinate.

rook.fixes.legacy.utils.coord_utils.squeeze_dims(ds_id, ds, **operands)[source]

Squeeze dimensions from dataset.

rook.fixes.legacy.utils.decadal_utils module

Utility functions for legacy decadal fixes.

rook.fixes.legacy.utils.decadal_utils.get_lead_times(ds_id, ds)[source]

Get lead times in days relative to forecast reference time.

rook.fixes.legacy.utils.decadal_utils.get_reftime(ds_id, ds)[source]

Get reference time for decadal forecast.

rook.fixes.legacy.utils.decadal_utils.get_start_date(ds_id, ds)[source]

Get start date inferred from decadal dataset id.

rook.fixes.legacy.utils.decadal_utils.get_sub_experiment_id(ds_id, ds)[source]

Get sub-experiment identifier from start date.

rook.fixes.legacy.utils.decadal_utils.get_time_calendar(ds_id, ds)[source]

Get the calendar from the dataset time axis.

rook.fixes.legacy.utils.fixes_utils module

Shared helpers for legacy fixes.

rook.fixes.legacy.utils.fixes_utils.convert_calendar_to_gregorian(ds: Dataset, reference_date='1850-01-01') Dataset[source]

Convert proleptic Gregorian time coordinates to Gregorian coordinates.

rook.fixes.legacy.utils.var_utils module

Module to add data variables to a dataset.

rook.fixes.legacy.utils.var_utils.add_data_var(ds_id, ds, **operands)[source]

Add a data variable and return the dataset.