casys.computation.storage

Diagnostics storage classes.

Classes

BinnedStorageProperties(name, group, ...[, ...])

Abstract class representing properties related to the storage of a binning diagnostic.

Binned2dStorageProperties(name, group, ...)

Abstract class representing properties related to the storage of a 2d binning diagnostic.

CrossoverStorageProperties(name, group, ...)

Abstract class representing properties related to the storage of a crossovers diagnostic.

CrossoverSwathStorageProperties(name, group, ...)

Abstract class representing properties related to the storage of a crossovers diagnostic.

GeoBoxStorageProperties(name, group, ...[, ...])

Abstract class representing properties related to the storage of a geobox diagnostic.

HistogramStorageProperties(name, group, ...)

Abstract class representing properties related to the storage of a histogram diagnostic.

MissingPointsStorageProperties(name, group, ...)

Abstract class representing properties related to the storage

PeriodogramStorageProperties(name, group, ...)

Abstract class representing properties related to the storage

ScatterStorageProperties(name, group, ...[, ...])

Abstract class representing properties related to the storage of a scatter diagnostic.

SectionAnalysesStorageProperties(name, ...)

Abstract class representing properties related to the storage of a section analysis diagnostic.

SegmentsAnalysisStorageProperties(name, ...)

Abstract class representing properties related to the storage of a spectral analysis diagnostic.

SpectralAnalysisStorageProperties(name, ...)

Abstract class representing properties related to the storage of a spectral analysis diagnostic.

SpectralCurvesStorageProperties(name, group, ...)

Abstract class representing properties related to the storage of a spectral analysis diagnostic.

StorageGroupParams(name, meta, model, ...[, ...])

Class representing parameters of a storage group.

StorageProperties(name, group, field_x, indexer)

Abstract class representing properties related to the storage of a diagnostic.

TemporalStorageProperties(name, group, ...)

Abstract class representing properties related to the storage of a temporal diagnostic.

class casys.computation.storage.Binned2dStorageProperties(name, group, field_x, indexer, res_x, field_y=None, *, field_z, res_y)

Bases: BinnedStorageProperties

Abstract class representing properties related to the storage of a 2d binning diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field | None) – Field used for y axes.

  • field_z (Field) – Field used for z axes.

  • indexer (ong_indexer.PassIndexer | None)

  • res_x (DataResolution)

  • res_y (DataResolution)

DTYPE: ClassVar[DiagnosticType] = 10
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

property dimensions: list[tuple[str, int]]
extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field | None = None
field_z: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
res_x: DataResolution
res_y: DataResolution
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.BinnedStorageProperties(name, group, field_x, indexer, res_x, field_y=None)

Bases: StorageProperties

Abstract class representing properties related to the storage of a binning diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field | None) – Field used for y axes.

  • indexer (ong_indexer.PassIndexer | None)

  • res_x (DataResolution)

DTYPE: ClassVar[DiagnosticType] = 9
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

property dimensions: list[tuple[str, int]]
extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field | None = None
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
res_x: DataResolution
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.CrossoverStorageProperties(name, group, field_x, indexer, field_y, field_z, time, time_delta)

Bases: StorageProperties

Abstract class representing properties related to the storage of a crossovers diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field) – Field used for y axes.

  • field_z (Field) – Field used for z axes.

  • time (str) – Field used the time.

  • time_delta (str) – Field used the time delta.

  • indexer (ong_indexer.PassIndexer | None)

DTYPE: ClassVar[DiagnosticType] = 12
FIELD_TIME_DELTA: ClassVar[str] = 'TIME_DELTA'
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field
field_z: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

time: str
time_delta: str
to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.CrossoverSwathStorageProperties(name, group, field_x, indexer, field_y, field_z, time, time_delta, main_dim, diamond_reduction)

Bases: CrossoverStorageProperties

Abstract class representing properties related to the storage of a crossovers diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field) – Field used for y axes.

  • field_z (Field) – Field used for z axes.

  • time (str) – Field used the time.

  • time_delta (str) – Field used the time delta.

  • main_dim (str) – Main dimension of the data to store.

  • diamond_reduction (StatType) – Statistic type used to reduce the data on the crossover diamond.

  • indexer (ong_indexer.PassIndexer | None)

DTYPE: ClassVar[DiagnosticType] = 12
FIELD_TIME_DELTA: ClassVar[str] = 'TIME_DELTA'
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

diamond_reduction: StatType
extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field
field_z: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

main_dim: str
name: str
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

time: str
time_delta: str
to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.GeoBoxStorageProperties(name, group, field_x, indexer, res_x, field_y=None, *, field_z, res_y)

Bases: Binned2dStorageProperties

Abstract class representing properties related to the storage of a geobox diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field | None) – Field used for y axes.

  • field_z (Field) – Field used for z axes.

  • indexer (ong_indexer.PassIndexer | None)

  • res_x (DataResolution)

  • res_y (DataResolution)

DTYPE: ClassVar[DiagnosticType] = 6
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

property dimensions: list[tuple[str, int]]
extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field | None = None
field_z: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
res_x: DataResolution
res_y: DataResolution
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.HistogramStorageProperties(name, group, field_x, indexer, res_x, field_y=None)

Bases: BinnedStorageProperties

Abstract class representing properties related to the storage of a histogram diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field | None) – Field used for y axes.

  • indexer (ong_indexer.PassIndexer | None)

  • res_x (DataResolution)

DTYPE: ClassVar[DiagnosticType] = 7
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

property dimensions: list[tuple[str, int]]
extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field | None = None
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
res_x: DataResolution
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.MissingPointsStorageProperties(name, group, field_x, indexer, field_y, time, mp_missing, mp_groups)

Bases: StorageProperties

Abstract class representing properties related to the storage

of a missing points diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field) – Field used for y axes.

  • indexer (ong_indexer.PassIndexer | None)

  • time (str)

  • mp_missing (str)

  • mp_groups (str)

DTYPE: ClassVar[DiagnosticType] = 13
FIELD_GROUPS: ClassVar[str] = 'MP_GROUPS'
FIELD_MISSING: ClassVar[str] = 'MP_MISSING'
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

mp_groups: str
mp_missing: str
name: str
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

time: str
to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.PeriodogramStorageProperties(name, group, field_x, indexer, field_y, nbr_periods)

Bases: StorageProperties

Abstract class representing properties related to the storage

of a periodogram diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field) – Field used for y axes.

  • nbr_periods (int) – Number of periods.

  • indexer (ong_indexer.PassIndexer | None)

DTYPE: ClassVar[DiagnosticType] = 5
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

property dimensions: list[tuple[str, int]]
extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
nbr_periods: int
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.ScatterStorageProperties(name, group, field_x, indexer, res_x, field_y=None, *, field_z, res_y)

Bases: Binned2dStorageProperties

Abstract class representing properties related to the storage of a scatter diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field | None) – Field used for y axes.

  • indexer (ong_indexer.PassIndexer | None)

  • res_x (DataResolution)

  • field_z (Field)

  • res_y (DataResolution)

DTYPE: ClassVar[DiagnosticType] = 8
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

property dimensions: list[tuple[str, int]]
extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field | None = None
field_z: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
res_x: DataResolution
res_y: DataResolution
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.SectionAnalysesStorageProperties(name, group, field_x, indexer, field_y)

Bases: StorageProperties

Abstract class representing properties related to the storage of a section analysis diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field) – Field used for y axes.

  • indexer (ong_indexer.PassIndexer | None)

DTYPE: ClassVar[DiagnosticType] = 15
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.SegmentsAnalysisStorageProperties(name, group, field_x, indexer, field_y, field_z, time)

Bases: StorageProperties

Abstract class representing properties related to the storage of a spectral analysis diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field) – Field used for y axes.

  • indexer (ong_indexer.PassIndexer | None)

  • field_z (Field)

  • time (str)

DTYPE: ClassVar[DiagnosticType] = 16
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field
field_z: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

time: str
to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.SpectralAnalysisStorageProperties(name, group, field_x, indexer, field_y, field_z, time, wn, spectral_names)

Bases: StorageProperties

Abstract class representing properties related to the storage of a spectral analysis diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field) – Field used for y axes.

  • indexer (ong_indexer.PassIndexer | None)

  • field_z (Field)

  • time (str)

  • wn (str)

  • spectral_names (list[str])

DTYPE: ClassVar[DiagnosticType] = 16
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field
field_z: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields | None

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
spectral_names: list[str]
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

time: str
to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

wn: str
class casys.computation.storage.SpectralCurvesStorageProperties(name, group, field_x, indexer, field_y, field_z, time, wn, spectral_names)

Bases: SegmentsAnalysisStorageProperties

Abstract class representing properties related to the storage of a spectral analysis diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field) – Field used for y axes.

  • indexer (ong_indexer.PassIndexer | None)

  • field_z (Field)

  • time (str)

  • wn (str)

  • spectral_names (list[str])

DTYPE: ClassVar[DiagnosticType] = 16
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field
field_z: Field
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
spectral_names: list[str]
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

time: str
to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

wn: str
class casys.computation.storage.StorageGroupParams(name, meta, model, fields, index, time_gap=np.timedelta64(0), gap_tolerance=1, dims=<factory>, parameters=<factory>)

Bases: object

Class representing parameters of a storage group.

Parameters:
  • name (str) – Name of the group.

  • meta (DiagnosticMeta) – Group’s metadata.

  • model (type[DiagnosticModel]) – Generic model for diagnostic stores.

  • fields (DiagnosticFields) – Sets of diagnostic fields.

  • index (str) – Diagnostic index name.

  • time_gap (timedelta64) – Expected time gap between two values.

  • gap_tolerance (float) – Tolerance between actual time gap and the expected one (default: 5%). This value is expressed as a percentage between 0 (no tolerance) and 1 (100% tolerance).

  • dims (list[tuple[str, int]]) – Diagnostic dimensions as a list of Tuple(name, size).

  • parameters (dict[str, Any]) – Additional parameters specific to some diagnostics store model (pass_name, cycle_name, indexer, time_policy).

declare_to_store(store)

Declare this group to the provided diagnostic store.

Parameters:

store (DiagnosticStore) – Diagnostic Store.

dims: list[tuple[str, int]]
fields: DiagnosticFields
gap_tolerance: float = 1
index: str
merge(other)

Merge provided parameters to the current ones.

Parameters:

other (StorageGroupParams) – Storage parameters to merge.

meta: DiagnosticMeta
model: type[DiagnosticModel]
name: str
parameters: dict[str, Any]
time_gap: timedelta64 = np.timedelta64(0)
class casys.computation.storage.StorageProperties(name, group, field_x, indexer)

Bases: ABC

Abstract class representing properties related to the storage of a diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y – Field used for y axes.

  • indexer (PassIndexer | None)

DTYPE: ClassVar[DiagnosticType]
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
abstract property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

abstract property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

abstract property fields_stored: DiagnosticFields

List of fields used when storing data.

group: str
abstract group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.

class casys.computation.storage.TemporalStorageProperties(name, group, field_x, indexer, res_x, field_y=None, *, frequency)

Bases: BinnedStorageProperties

Abstract class representing properties related to the storage of a temporal diagnostic.

Parameters:
  • name (str) – Name of the data.

  • group (str) – Storage group.

  • field_x (Field) – Field used for x axes.

  • field_y (Field | None) – Field used for y axes.

  • frequency (FrequencyHandler) – Frequency (day, pass, cycle).

  • indexer (ong_indexer.PassIndexer | None)

  • res_x (DataResolution)

DTYPE: ClassVar[DiagnosticType] = 4
align_bins(index, stored, analyse_type)

Align provided index to use the stored values for matching bins.

Parameters:
  • index (ndarray) – Reference index.

  • stored (ndarray) – Stored index to fix.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

Return type:

ndarray

Returns:

Fixed index.

property dimensions: list[tuple[str, int]]
extended_dates(index, analyse_type, analyse_date)

Compute diagnostic extended dates to allow the reading of stored data that might be dated outside these dates.

Parameters:
  • index (ndarray[Any, dtype[datetime64]]) – Starting date.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • analyse_date (datetime64 | None) – Date used to reference stored data.

Return type:

tuple[datetime64, datetime64]

Returns:

Extended dates including all requested bins.

field_x: Field
field_y: Field | None = None
property fields_diag_map: dict[str, str]

Mapping of fields to rename when reading data.

property fields_store_map: dict[str, str]

Mapping of fields to rename when storing data.

property fields_stored: DiagnosticFields

List of fields used when storing data.

frequency: FrequencyHandler
group: str
group_parameters(diag_meta, analyse_type, group=None)

Returns the storage group parameters matching these properties.

Parameters:
  • diag_meta (DiagnosticMeta) – Diagnostic metadata.

  • analyse_type (FreqType) – Type of period covered by this analyse (cycle, pass or custom). It’s used to determine the type of storage group to create.

  • group (str | None) – Name of the group to use for storage.

Return type:

StorageGroupParams

Returns:

Storage group parameters.

indexer: ong_indexer.PassIndexer | None
property is_mergeable: bool

Whether these properties allow to merge with existing data or not.

name: str
res_x: DataResolution
store_data(store, stat, data, group)

Format and store provided data using this storage properties.

Parameters:
  • store (DiagnosticStore) – DataStore in which to store.

  • stat (StatType) – Statistic to store.

  • data (Dataset) – Data to store.

  • group (str) – DataStore group in which to store.

store_group(group=None)

Returns the name of the group in the store for the diagnostic.

Parameters:

group (str | None) – Name of the group to use for storage.

Return type:

str

Returns:

Name of the store group.

to_diagnostic_data(data)

Transform the data read from the store to the correct diagnostic results format.

Parameters:

data (Dataset) – Data from the store.

Return type:

Dataset

Returns:

Data to the diagnostic results format.

to_store_data(data, analyse_date)

Formats the diagnostic data to be written to the store.

Parameters:
  • data (Dataset) – Data from the diagnostic to format.

  • analyse_date (datetime64) – Date representing the set of data used in this analyse. It’s used to determine at which timestamp to store non-temporal diagnostics.

Return type:

Dataset

Returns:

Formatted data ready for storage.