From ecbd0e5a9ce513552142f9c8ef96db9bc9f43905 Mon Sep 17 00:00:00 2001 From: Baudouin Raoult Date: Wed, 16 Oct 2024 05:07:08 +0000 Subject: [PATCH] use properties --- src/anemoi/transform/variables/__init__.py | 2 ++ src/anemoi/transform/variables/variables.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/anemoi/transform/variables/__init__.py b/src/anemoi/transform/variables/__init__.py index 0776b59..bb49775 100644 --- a/src/anemoi/transform/variables/__init__.py +++ b/src/anemoi/transform/variables/__init__.py @@ -40,10 +40,12 @@ def __eq__(self, other) -> bool: return False return self.name == other.name + @property @abstractmethod def is_pressure_level(self): pass + @property @abstractmethod def level(self): pass diff --git a/src/anemoi/transform/variables/variables.py b/src/anemoi/transform/variables/variables.py index 24679b6..53c4303 100644 --- a/src/anemoi/transform/variables/variables.py +++ b/src/anemoi/transform/variables/variables.py @@ -15,9 +15,11 @@ def __init__(self, name, data: dict) -> None: super().__init__(name) self.data = data + @property def is_pressure_level(self): return self.data.get("levtype", None) == "pl" + @property def level(self): return self.data.get("levelist", None)