variable_flagging#
Functions#
Function to set a flag on the variable in the dataset to mark it as actually available and not just filled with default values. |
|
Function to set a flag on the dataset to remove all unassigned variables |
|
Function to set a flag on the dataset to remove all unassigned variables |
|
|
Function to check a flag on a variable in a dataset whether it has been assigned with actual values. |
|
Helper function to clean all unassigned data variables from a dataset. |
Module Contents#
- mark_variable_assigned(var)#
Function to set a flag on the variable in the dataset to mark it as actually available and not just filled with default values.
Should only be called on variables that had a non-default value assigned. Variables that have not been flagged, may be dropped upon finalization of the loading routine.
- Parameters:
var (xr.DataArray) – The variable to set the flag on to mark it as assigned to.
- Return type:
None
- mark_dataset_for_cleanup(ds)#
Function to set a flag on the dataset to remove all unassigned variables
- Parameters:
ds (xr.Dataset) – The variable to set the flag on to mark it as assigned to.
- Return type:
None
- is_marked_for_cleanup(ds)#
Function to set a flag on the dataset to remove all unassigned variables
- Parameters:
ds (xr.Dataset) – The variable to check the cleanup flag on
- Return type:
Whether a cleanup flag is set on a dataset.
- is_variable_assigned(var)#
Function to check a flag on a variable in a dataset whether it has been assigned with actual values.
- Parameters:
var (xr.DataArray) – The variable to check for a set “__assigned” flag.
- Returns:
Returns True if the variable has been marked as having been assigned a value previously.
- Return type:
- clean_unassigned_variables(dataset)#
Helper function to clean all unassigned data variables from a dataset.
To make sure we only ever clean data after import, a flag is checked in the _shnitsel_setup_for_cleanup attribute so that we do not accidentally clean out data from previously serialized data formats, where such a cleanup is not neede. The flag is normally set in create_initial_dataset() and not necessary to set manually.
For all unflagged inputs, the return value will be the unchanged input parameter.
- Parameters:
dataset (xr.Dataset) – The dataset to check for cleaning and potentially drop unassigned variables from.
- Returns:
The dataset either unchanged if the flag for cleaning was not set or with unassigned variables left over from the dummy setup process being removed.
- Return type:
xr.Dataset