arctichoke.dataset.grid_type

Functions

get_grid_type(dataset)

Get the grid type of the dataset.

summarize_grid_types(datasets)

Summarizes the types of grids for the datasets.

Module Contents

arctichoke.dataset.grid_type.get_grid_type(dataset: str, xarray.DataArray, xarray.Dataset)

Get the grid type of the dataset.

Opens the given datasets, checks the dimensions, and determines the type of grid: regular, irregular, or other.

Parameters:

dataset (str, xarray.DataArray, xarray.Dataset) – The dataset for which to determine the grid type.

Returns:

grid_type – The type of grid that the dataset has which will be ‘regular’, ‘irregular’, or ‘other’.

Return type:

str

Examples

>>> from arctichoke.dataset.grid_type import get_grid_type
>>> get_grid_type('/arctichoke_data/bergybits/data/CMIP6/HighResMIP/EC-Earth-Consortium/EC-Earth3P-HR/hist-1950/r1i1p2f1/SImon/siconc/gn/v20181212/siconc_SImon_EC-Earth3P-HR_hist-1950_r1i1p2f1_gn_201401-201412.nc')
irregular
arctichoke.dataset.grid_type.summarize_grid_types(datasets: [str, xarray.DataArray, xarray.Dataset])

Summarizes the types of grids for the datasets.

Uses the get_grid_type() function on each dataset in the list and reports the number of datasets with the grid types ‘regular’, ‘irregular’, or ‘other’.

Parameters:

datasets (List of str, xarray.DataArray, xarray.Dataset) – The list of datasets for which to summarize the grid types.

Returns:

grid_type_dict – A dictionary showing the number of datasets with the grid types ‘regular’, ‘irregular’, or ‘other’.

Return type:

dict

Examples

>>> from arctichoke.path import list_variable_files
>>> this_list = list_variable_files(source_id='EC-Earth3P-HR', variable_id='siconc', variant_label='r2i1p2f1')
>>> from arctichoke.dataset.grid_type import summarize_grid_types
>>> summarize_grid_types(this_list)
{'total': 65, 'irregular': 65}
>>> this_list = list_variable_files(source_id='HadGEM3-GC31-MM', variable_id='siconc', experiment_id='highres-future', variant_label='r1i1p1f1')
{'total': 36, 'regular': 36}