From 8d9e07108cdf18b7de701772f583cfbafdeebe74 Mon Sep 17 00:00:00 2001 From: Baudouin Raoult Date: Fri, 25 Oct 2024 09:39:20 +0000 Subject: [PATCH] update variables --- src/anemoi/transform/variables/__init__.py | 4 ++++ src/anemoi/transform/variables/variables.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/anemoi/transform/variables/__init__.py b/src/anemoi/transform/variables/__init__.py index b9d6703..0ab9dda 100644 --- a/src/anemoi/transform/variables/__init__.py +++ b/src/anemoi/transform/variables/__init__.py @@ -54,3 +54,7 @@ def level(self): @abstractmethod def is_constant_in_time(self): pass + + @property + def grib_keys(self): + raise NotImplementedError(f"Method `grib_keys` not implemented for {self.__class__.__name__}") diff --git a/src/anemoi/transform/variables/variables.py b/src/anemoi/transform/variables/variables.py index d53380e..77d8163 100644 --- a/src/anemoi/transform/variables/variables.py +++ b/src/anemoi/transform/variables/variables.py @@ -37,6 +37,14 @@ def is_from_input(self): def is_computed_forcing(self): return self.data.get("computed_forcing", False) + @property + def is_accumulation(self): + return self.data.get("process") == "accumulation" + + @property + def grib_keys(self): + return self.data.get("mars", {}) + class VariableFromDict(VariableFromMarsVocabulary): """A variable that is defined by a user provided dictionary."""