arctichoke.dataset.example_dataset
Functions
|
Create an example dataset for testing. |
Module Contents
- arctichoke.dataset.example_dataset.make_example_dataset(save_as: str = None, n: int = 10, offset: int, float = 0, test_var_name: str = 'test_var', time_axis: bool, int = False, overwrite: bool = True)
Create an example dataset for testing.
Construct a dataset such that it is minimal in size yet contains all notable features of the datasets of HighResMIP data, and save it to a netCDF file.
- Parameters:
save_as (str, None, optional) – The absolute file path to which to save the example dataset. Default is None, which doesn’t save the dataset to a file.
n (int, optional) – The number of values in each dimension. Default is 10.
offset (int, float, optional) – A constant offset value to add to every value in the dataset. Default is 0.
test_var_name (str, optional) – The name to give the test variable. Default is test_var.
time_axis (bool, int, optional) – Whether to include a time axis in the example dataset. If an integer is given, that will be used as the year for the datetimes. Default is False.
overwrite (bool, optional) – Whether to overwrite an existing file at the given filepath in save_as. Default is True.
- Returns:
example_dataset – A list, sorted alphabetically, of the names of the available models.
- Return type:
xr.Dataset
Examples
>>> from arctichoke.dataset.example_dataset import make_example_dataset >>> dataset = make_example_dataset(n=3, time_axis=True) >>> dataset['test_var'].values array([[[0., 1., 2.], [3., 4., 5.], [6., 7., 8.]],
- [[0., 1., 2.],
[3., 4., 5.], [6., 7., 8.]]])