From 4802b5585362d13f2612fa35e1bc087d7f660309 Mon Sep 17 00:00:00 2001 From: Pingu Carsti Date: Wed, 8 Nov 2023 18:17:37 +0100 Subject: [PATCH] added fixed file-namer --- rook/utils/weighted_average_utils.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rook/utils/weighted_average_utils.py b/rook/utils/weighted_average_utils.py index e05305d..2880e30 100644 --- a/rook/utils/weighted_average_utils.py +++ b/rook/utils/weighted_average_utils.py @@ -8,6 +8,12 @@ from daops.ops.average import Average as DaopsAverage from clisops.ops.average import Average as ClisopsAverage +from clisops.utils.file_namers import StandardFileNamer + + +class FixedFileNamer(StandardFileNamer): + def _get_project(self, ds): + return "c3s-cmip6" def calc_weighted_mean(ds): @@ -26,6 +32,14 @@ def calc_weighted_mean(ds): class WeightedAverage_(ClisopsAverage): + def _get_file_namer(self): + extra = f"_w-avg" + + # namer = get_file_namer(self._file_namer)(extra=extra) + namer = FixedFileNamer(extra=extra) + + return namer + def _calculate(self): avg_ds = calc_weighted_mean(self.ds) @@ -57,7 +71,7 @@ def weighted_average( output_dir=None, output_type="netcdf", split_method="time:auto", - file_namer="simple", + file_namer="standard", apply_fixes=False, ): result_set = WeightedAverage(**locals()).calculate()