arctichoke.analysis.siconc
Functions
|
Calculate sea ice concentration from sea ice thickness and volume. |
|
Make sea ice concentration files based on the lists of files given. |
Module Contents
- arctichoke.analysis.siconc.calc_siconc(sithick_dataset: str, [str], xarray.DataArray, xarray.Dataset, sivol_dataset: str, [str], xarray.DataArray, xarray.Dataset, save_as: str = None, verbose: bool = False, **kwargs)
Calculate sea ice concentration from sea ice thickness and volume.
Verify the dataset(s) contains the sithick and sivol variables, calculate siconc based on those variables, and return a new dataset.
- Parameters:
sithick_dataset (str, list of str, xarray.DataArray, xarray.Dataset) – The sea ice thickness dataset. Must have the same source ID, experiment ID, variant label, and dimensions sizes as sivol_dataset.
sivol_dataset (str, list of str, xarray.DataArray, xarray.Dataset) – The sea ice volume dataset. Must have the same source ID, experiment ID, variant label, and dimensions sizes as sithick_dataset.
save_as (str, None, optional) – The file name to which to save the modified dataset. Default is None, which doesn’t save the dataset to a file.
verbose (bool, optional) – Whether to verbosely output information as the function executes. Default is False.
**kwargs – Keyword arguments.
- Returns:
siconc2_xr – A dataset of calculated sea ice concentration values.
- Return type:
xarray.Dataset
Examples
>>> from arctichoke.dataset.example_dataset import make_example_dataset >>> dataset_0 = make_example_dataset(n=3, test_var_name='sithick') >>> dataset_0['sithick'].values array([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]]) >>> dataset_1 = make_example_dataset(n=3, test_var_name='sivol') >>> dataset_1['sivol'].values array([[0., 1., 2.], [3., 4., 5.], [6., 7., 8.]]) >>> from arctichoke.analysis import calc_siconc >>> dataset_siconc2 = calc_siconc(sithick_dataset=dataset_0, sivol_dataset=dataset_1) >>> dataset_siconc2['siconc2'].values array([[ 0. , 50. , 66.66666667], [75. , 80. , 83.33333333], [85.71428571, 87.5 , 88.88888889]])
- arctichoke.analysis.siconc.make_siconc_files(sithick_files: [str], sivol_files: [str], map_bbox: [float, float, float, float] = None, version_id: str = 'v20260617', overwrite: bool = False, **kwargs)
Make sea ice concentration files based on the lists of files given.
For each given pair of files, load the data, trim the datasets (if applicable), calculate the sea ice concentration, then save the sea ice concentration dataset as a new file in the same directory structure.
- Parameters:
sithick_files (List of str) – A list of paths of the sea ice thickness data files.
sivol_files (List of str) – A list of paths of the sea ice volume data files.
map_bbox (Array of float, None, optional) –
- An array of coordinates defining the bounding box of the map in the following format:
[LAT_MAX, LAT_MIN, LON_MAX, LON_MIN]
Default is None, meaning the data will not be trimmed.
version_id (str, optional) – The version ID to use when making the directory structure for the sea ice concentration files. Default is ‘v20260617’.
overwrite (bool, optional) – Whether to overwrite an existing file if it exists. Default is False.
**kwargs – Keyword arguments to pass to trim_latlon(), and calc_siconc().
- Return type:
None
Examples
>>> from arctichoke.path import list_variable_files >>> from arctichoke.analysis import make_siconc_files >>> from arctichoke.params import CAA_BBOX >>> this_model = 'EC-Earth3P-HR' >>> for this_variant_label in [ >>> 'r1i1p2f1', >>> 'r2i1p2f1', >>> 'r3i1p2f1', >>> ]: >>> for this_experiment in ['hist-1950']:#, 'highres-future']: >>> sithick_list = list_variable_files( >>> source_id = this_model, >>> variable_id = 'sithick', >>> experiment_id = this_experiment, >>> variant_label = this_variant_label, >>> ) >>> sivol_list = list_variable_files( >>> source_id = this_model, >>> variable_id = 'sivol', >>> experiment_id = this_experiment, >>> variant_label = this_variant_label, >>> ) >>> make_siconc_files( >>> sithick_files = sithick_list, >>> sivol_files = sivol_list, >>> map_bbox = CAA_BBOX, >>> precise_trim = False, >>> ) (make_siconc_files) Writing file `/arctichoke_data/bergybits/data/CMIP6/HighResMIP/EC-Earth-Consortium/EC-Earth3P-HR/hist-1950/r1i1p2f1/SImon/siconc2/gn/v20260617/trim_CAA_siconc2_SImon_EC-Earth3P-HR_hist-1950_r1i1p2f1_gn_195001-195012.nc`. (make_siconc_files) Writing file `/arctichoke_data/bergybits/data/CMIP6/HighResMIP/EC-Earth-Consortium/EC-Earth3P-HR/hist-1950/r1i1p2f1/SImon/siconc2/gn/v20260617/trim_CAA_siconc2_SImon_EC-Earth3P-HR_hist-1950_r1i1p2f1_gn_195101-195112.nc`. (make_siconc_files) Writing file `/arctichoke_data/bergybits/data/CMIP6/HighResMIP/EC-Earth-Consortium/EC-Earth3P-HR/hist-1950/r1i1p2f1/SImon/siconc2/gn/v20260617/trim_CAA_siconc2_SImon_EC-Earth3P-HR_hist-1950_r1i1p2f1_gn_195201-195212.nc`. ... (make_siconc_files) Writing file `/arctichoke_data/bergybits/data/CMIP6/HighResMIP/EC-Earth-Consortium/EC-Earth3P-HR/hist-1950/r3i1p2f1/SImon/siconc2/gn/v20260617/trim_CAA_siconc2_SImon_EC-Earth3P-HR_hist-1950_r3i1p2f1_gn_201201-201212.nc`. (make_siconc_files) Writing file `/arctichoke_data/bergybits/data/CMIP6/HighResMIP/EC-Earth-Consortium/EC-Earth3P-HR/hist-1950/r3i1p2f1/SImon/siconc2/gn/v20260617/trim_CAA_siconc2_SImon_EC-Earth3P-HR_hist-1950_r3i1p2f1_gn_201301-201312.nc`. (make_siconc_files) Writing file `/arctichoke_data/bergybits/data/CMIP6/HighResMIP/EC-Earth-Consortium/EC-Earth3P-HR/hist-1950/r3i1p2f1/SImon/siconc2/gn/v20260617/trim_CAA_siconc2_SImon_EC-Earth3P-HR_hist-1950_r3i1p2f1_gn_201401-201412.nc`.