xarray_dataclasses.dataset module#

Submodule for Dataset creation.

class AsDataset[source]#

Bases: object

Mix-in class that provides shorthand methods.

classmethod empty(sizes: Sizes, order: Order = 'C', **kwargs: Any) TDataset[source]#
classmethod empty(sizes: Sizes, order: Order = 'C', **kwargs: Any) xr.Dataset

Create a Dataset object without initializing data vars.

Parameters:
  • sizes – Sizes of the new Dataset object.

  • order – Whether to store data in row-major (C-style) or column-major (Fortran-style) order in memory.

  • kwargs – Args of the Dataset class except for data vars.

Returns:

Dataset object without initializing data vars.

classmethod full(sizes: Sizes, fill_value: Any, order: Order = 'C', **kwargs: Any) TDataset[source]#
classmethod full(sizes: Sizes, fill_value: Any, order: Order = 'C', **kwargs: Any) xr.Dataset

Create a Dataset object whose data vars are filled with given value.

Parameters:
  • sizes – Sizes of the new Dataset object.

  • fill_value – Value for data vars of the new Dataset object.

  • order – Whether to store data in row-major (C-style) or column-major (Fortran-style) order in memory.

  • kwargs – Args of the Dataset class except for data vars.

Returns:

Dataset object whose data vars are filled with given value.

new(*args: Any, **kwargs: Any) Any[source]#

Create a Dataset object from dataclass parameters.

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

Any

classmethod ones(sizes: Sizes, order: Order = 'C', **kwargs: Any) TDataset[source]#
classmethod ones(sizes: Sizes, order: Order = 'C', **kwargs: Any) xr.Dataset

Create a Dataset object whose data vars are filled with ones.

Parameters:
  • sizes – Sizes of the new Dataset object.

  • order – Whether to store data in row-major (C-style) or column-major (Fortran-style) order in memory.

  • kwargs – Args of the Dataset class except for data vars.

Returns:

Dataset object whose data vars are filled with ones.

classmethod shaped(func: Callable[[Shape], AnyArray], sizes: Sizes, **kwargs: Any) TDataset[source]#
classmethod shaped(func: Callable[[Shape], AnyArray], sizes: Sizes, **kwargs: Any) xr.Dataset

Create a Dataset object from a shaped function.

Parameters:
  • func – Function to create an array with given shape.

  • sizes – Sizes of the new Dataset object.

  • kwargs – Args of the Dataset class except for data vars.

Returns:

Dataset object created from the shaped function.

classmethod zeros(sizes: Sizes, order: Order = 'C', **kwargs: Any) TDataset[source]#
classmethod zeros(sizes: Sizes, order: Order = 'C', **kwargs: Any) xr.Dataset

Create a Dataset object whose data vars are filled with zeros.

Parameters:
  • sizes – Sizes of the new Dataset object.

  • order – Whether to store data in row-major (C-style) or column-major (Fortran-style) order in memory.

  • kwargs – Args of the Dataset class except for data vars.

Returns:

Dataset object whose data vars are filled with zeros.

asdataset(dataclass: OptionedClass[PInit, TDataset], reference: AnyXarray | None = None, dataoptions: None = None) TDataset[source]#
asdataset(dataclass: DataClass[PInit], reference: AnyXarray | None = None, dataoptions: None = None) xr.Dataset
asdataset(dataclass: Any, reference: AnyXarray | None = None, dataoptions: DataOptions[TDataset] = DataOptions(xr.Dataset)) TDataset

Create a Dataset object from a dataclass object.

Parameters:
  • dataclass – Dataclass object that defines typed Dataset.

  • reference – DataArray or Dataset object as a reference of shape.

  • dataoptions – Options for Dataset creation.

Returns:

Dataset object created from the dataclass object.