bin_average
Classes:
| Name | Description |
|---|---|
BinAverage |
Saves data into the specified coordinate grid using bin-averaging. |
Classes#
BinAverage #
Bases: DataConverter
Saves data into the specified coordinate grid using bin-averaging.
This converter is used to reindex a variable onto a new coordinate grid using bin
averaging. It is particularly useful for aligning datasets with different time
coordinates or other coordinate variables.
The coordinate axis this converter should be applied on can be specified using the
coord parameter. The default is 'time', but it can be set to any coordinate
variable present in the dataset.
The converter will preserve the original variable's data, and if requested, it will
also keep the quality control (QC) checks and transformation metrics as new data
variables in the output dataset.
Attributes:
coord (str): The coordinate axis this converter should be applied on. Defaults to 'time'.
keep_metrics (bool): If true, then transform metrics will be preserved in the output dataset.
keep_qc (bool): If true, then transform qc checks will be preserved in the output dataset.
Methods:
| Name | Description |
|---|---|
convert |
Convert the provided data using bin-averaging. |
Attributes:
| Name | Type | Description |
|---|---|---|
coord |
str
|
The coordinate axis this converter should be applied on. Defaults to 'time'. |
keep_metrics |
bool
|
If true, then transform metrics will be preserved in the output dataset as new |
keep_qc |
bool
|
If true, then transform qc checks will be preserved in the output dataset as a |
Attributes#
coord
class-attribute
instance-attribute
#
The coordinate axis this converter should be applied on. Defaults to 'time'.
keep_metrics
class-attribute
instance-attribute
#
If true, then transform metrics will be preserved in the output dataset as new
data variables ('
keep_qc
class-attribute
instance-attribute
#
If true, then transform qc checks will be preserved in the output dataset as a
new data variable ('qc_
Functions#
convert #
convert(
data: DataArray,
variable_name: str,
dataset_config: DatasetConfig,
retrieved_dataset: RetrievedDataset,
retriever: Optional[StorageRetriever] = None,
input_dataset: Optional[Dataset] = None,
input_key: Optional[str] = None,
**kwargs: Any
) -> Optional[xr.DataArray]
Convert the provided data using bin-averaging. Args: data (xr.DataArray): The data array to be transformed. variable_name (str): The name of the variable to be transformed. dataset_config (DatasetConfig): The configuration for the dataset. retrieved_dataset (RetrievedDataset): The dataset that has been retrieved. retriever (Optional[StorageRetriever]): The retriever used to access the data. input_dataset (Optional[xr.Dataset]): An optional input dataset to use for the transformation. input_key (Optional[str]): An optional key for the input dataset. **kwargs: Additional keyword arguments. Returns: Optional[xr.DataArray]: The transformed data array, or None if no transformation is performed.
Source code in tsdat/transform_v2/converters/bin_average.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |