Skip to content

Commit

Permalink
added regrid operator for workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Sep 28, 2023
1 parent 0226efd commit d828644
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rook/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)
from rook.utils.subset_utils import run_subset
from rook.utils.concat_utils import run_concat
from rook.utils.regrid_utils import run_regrid
from roocs_utils.utils.file_utils import is_file_list, FileMapper


Expand Down Expand Up @@ -89,6 +90,13 @@ def _get_runner(self):
return run_weighted_average


class Regrid(Operator):
prefix = "regrid"

def _get_runner(self):
return run_regrid


class Concat(Operator):
prefix = "concat"

Expand Down
6 changes: 6 additions & 0 deletions rook/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
AverageByDimension,
WeightedAverage,
Subset,
Regrid,
Concat,
)
from .provenance import Provenance
Expand Down Expand Up @@ -86,6 +87,7 @@ def __init__(self, output_dir):
self.average_time_op = AverageByTime(output_dir)
self.average_dim_op = AverageByDimension(output_dir)
self.weighted_average_op = WeightedAverage(output_dir)
self.regrid_op = Regrid(output_dir)
self.prov = Provenance(output_dir)

def validate(self, wfdoc):
Expand Down Expand Up @@ -154,6 +156,10 @@ def _run_step(self, step_id, step, inputs=None):
collection = step["in"]["collection"]
result = self.weighted_average_op.call(step["in"])
self.prov.add_operator(step_id, step["in"], collection, result)
elif "regrid" == step["run"]:
collection = step["in"]["collection"]
result = self.regrid_op.call(step["in"])
self.prov.add_operator(step_id, step["in"], collection, result)
elif "concat" == step["run"]:
collection = step["in"]["collection"]
result = self.concat_op.call(step["in"])
Expand Down

0 comments on commit d828644

Please sign in to comment.