Skip to content

Commit

Permalink
Changed name to var_name
Browse files Browse the repository at this point in the history
  • Loading branch information
mafdmi committed Nov 21, 2024
1 parent fa128ee commit 7abcfbb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions example.danra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ output:
end: 1990-09-06T00:00
compute_statistics:
MeanOperator:
- name: mean
- var_name: mean
dims: [grid_index, time]
StdOperator:
- name: std
- var_name: std
dims: [grid_index, time]
DiffMeanOperator:
- name: diff_mean
- var_name: diff_mean
dims: [grid_index, time]
- name: diff_time_mean
- var_name: diff_time_mean
dims: [time]
DiffStdOperator:
- name: diff_std
- var_name: diff_std
dims: [grid_index, time]
- name: diff_time_std
- var_name: diff_time_std
dims: [time]
DiurnalDiffMeanOperator:
- name: diurnal_diff_mean
- var_name: diurnal_diff_mean
dims: [grid_index, time]
- name: diurnal_diff_time_mean
- var_name: diurnal_diff_time_mean
dims: [time]
DiurnalDiffStdOperator:
- name: diurnal_diff_std
- var_name: diurnal_diff_std
dims: [grid_index, time]
- name: diurnal_diff_time_std
- var_name: diurnal_diff_time_std
dims: [time]
val:
start: 1990-09-06T00:00
Expand Down
2 changes: 1 addition & 1 deletion mllam_data_prep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Statistic:
The dimensions to compute the statistics over, e.g. ["time", "grid_index"].
"""

name: str
var_name: str
dims: List[str]


Expand Down
6 changes: 3 additions & 3 deletions mllam_data_prep/ops/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def calc_stats(
# of the same operator can be applied)
for statistic in statistics:
operator: StatisticOperator = globals()[stat_name](
ds=ds, splitting_dim=splitting_dim, name=statistic.name
ds=ds, splitting_dim=splitting_dim, var_name=statistic.var_name
)
stats[statistic.name] = operator.calc_stats(statistic.dims)
stats[statistic.var_name] = operator.calc_stats(statistic.dims)
else:
raise NotImplementedError(stat_name)

Expand All @@ -67,7 +67,7 @@ class StatisticOperator(ABC):

ds: xr.Dataset
splitting_dim: str
name: str
var_name: str

@abstractmethod
def calc_stats(self, dims):
Expand Down

0 comments on commit 7abcfbb

Please sign in to comment.