calculate_bin_average
Functions:
| Name | Description |
|---|---|
calculate_bin_average |
Calculates weighted averages for variables based on overlaps between input and output bounds. |
Functions#
calculate_bin_average #
calculate_bin_average(
input_dataset: Dataset,
coord_name: str,
coord_labels: ndarray,
coord_bounds: ndarray,
filter_bad_qc: bool = False,
add_metrics: bool = True,
) -> xr.Dataset
Calculates weighted averages for variables based on overlaps between input and output bounds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_dataset
|
Dataset
|
The input xarray Dataset containing the variables. |
required |
coord_name
|
str
|
The name of the coordinate variable to modify. |
required |
coord_labels
|
ndarray
|
The new values for the coordinate variable. |
required |
coord_bounds
|
ndarray
|
The new bounds for the coordinate variable. |
required |
filter_bad_qc
|
bool
|
Flag to exclude data flagged as Bad from the average. |
False
|
add_metrics
|
bool
|
Flag to add metrics (std deviation, goodfrac %). |
True
|
Returns:
| Type | Description |
|---|---|
Dataset
|
xr.Dataset: The new xarray Dataset averaged across the new coordinate bounds. |
Source code in tsdat/transform_v2/bin_average/calculate_bin_average.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 | |