arctichoke.analysis.siconc ========================== .. py:module:: arctichoke.analysis.siconc Functions --------- .. autoapisummary:: arctichoke.analysis.siconc.calc_siconc arctichoke.analysis.siconc.make_siconc_files Module Contents --------------- .. py:function:: 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. :param sithick_dataset: The sea ice thickness dataset. Must have the same source ID, experiment ID, variant label, and dimensions sizes as `sivol_dataset`. :type sithick_dataset: `str`, list of `str`, `xarray.DataArray`, `xarray.Dataset` :param sivol_dataset: The sea ice volume dataset. Must have the same source ID, experiment ID, variant label, and dimensions sizes as `sithick_dataset`. :type sivol_dataset: `str`, list of `str`, `xarray.DataArray`, `xarray.Dataset` :param save_as: The file name to which to save the modified dataset. Default is `None`, which doesn't save the dataset to a file. :type save_as: `str`, `None`, optional :param verbose: Whether to verbosely output information as the function executes. Default is `False`. :type verbose: `bool`, optional :param \*\*kwargs: Keyword arguments. :returns: **siconc2_xr** -- A dataset of calculated sea ice concentration values. :rtype: `xarray.Dataset` .. rubric:: 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]]) .. py:function:: 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. :param sithick_files: A list of paths of the sea ice thickness data files. :type sithick_files: List of `str` :param sivol_files: A list of paths of the sea ice volume data files. :type sivol_files: List of `str` :param map_bbox: 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. :type map_bbox: Array of `float`, `None`, optional :param version_id: The version ID to use when making the directory structure for the sea ice concentration files. Default is `'v20260617'`. :type version_id: `str`, optional :param overwrite: Whether to overwrite an existing file if it exists. Default is `False`. :type overwrite: `bool`, optional :param \*\*kwargs: Keyword arguments to pass to `trim_latlon()`, and `calc_siconc()`. :rtype: None .. rubric:: 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`.