From 5d7fd235043c784f4d230d0266d65dc85e7fc2f8 Mon Sep 17 00:00:00 2001 From: b8raoult <53792887+b8raoult@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:13:40 +0100 Subject: [PATCH 1/2] Update copyright notice --- CHANGELOG.md | 1 + README.md | 2 +- dev/dev.py | 9 +++++++++ src/anemoi/transform/commands/hello.py | 5 ++--- src/anemoi/transform/filter.py | 4 +++- src/anemoi/transform/filters/base.py | 4 +++- src/anemoi/transform/filters/uv_to_ddff.py | 4 ++-- src/anemoi/transform/grids/unstructured.py | 4 ++-- src/anemoi/transform/registry.py | 4 ++++ src/anemoi/transform/source.py | 5 ++++- src/anemoi/transform/sources/mars.py | 4 ++-- src/anemoi/transform/transform.py | 4 +++- src/anemoi/transform/variables/variables.py | 4 +++- src/anemoi/transform/workflow.py | 5 ++++- src/anemoi/transform/workflows/pipeline.py | 4 ++-- tests/test_grids.py | 5 ++++- tests/test_variables.py | 5 ++++- 17 files changed, 53 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc0dbc9..dced3ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,3 +13,4 @@ Keep it human-readable, your future self will thank you! ### Changed - Add more attributes to typed variables +- Update copyright notice diff --git a/README.md b/README.md index 2aaccba..72185aa 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ $ pip install anemoi-transform ## License ``` -Copyright 2022, European Centre for Medium Range Weather Forecasts. +Copyright 2024, Anemoi contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/dev/dev.py b/dev/dev.py index 859be27..9b6394e 100644 --- a/dev/dev.py +++ b/dev/dev.py @@ -1,3 +1,12 @@ +# (C) Copyright 2024 Anemoi contributors. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. + from anemoi.transform.filters import filter_factory from anemoi.transform.sources import source_factory from anemoi.transform.workflows import workflow_factory diff --git a/src/anemoi/transform/commands/hello.py b/src/anemoi/transform/commands/hello.py index 793d126..babe7fe 100644 --- a/src/anemoi/transform/commands/hello.py +++ b/src/anemoi/transform/commands/hello.py @@ -1,12 +1,11 @@ -#!/usr/bin/env python -# (C) Copyright 2024 ECMWF. +# (C) Copyright 2024 Anemoi contributors. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. -# from . import Command diff --git a/src/anemoi/transform/filter.py b/src/anemoi/transform/filter.py index 18edb58..f8bd3b1 100644 --- a/src/anemoi/transform/filter.py +++ b/src/anemoi/transform/filter.py @@ -1,6 +1,8 @@ -# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts. +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. diff --git a/src/anemoi/transform/filters/base.py b/src/anemoi/transform/filters/base.py index f45ffd9..898b5ff 100644 --- a/src/anemoi/transform/filters/base.py +++ b/src/anemoi/transform/filters/base.py @@ -1,6 +1,8 @@ -# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts. +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. diff --git a/src/anemoi/transform/filters/uv_to_ddff.py b/src/anemoi/transform/filters/uv_to_ddff.py index 076f655..2f6201d 100644 --- a/src/anemoi/transform/filters/uv_to_ddff.py +++ b/src/anemoi/transform/filters/uv_to_ddff.py @@ -1,11 +1,11 @@ -# (C) Copyright 2024 ECMWF. +# (C) Copyright 2024 Anemoi contributors. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. -# from earthkit.meteo.wind.array import polar_to_xy diff --git a/src/anemoi/transform/grids/unstructured.py b/src/anemoi/transform/grids/unstructured.py index 7b6f6be..29f5214 100644 --- a/src/anemoi/transform/grids/unstructured.py +++ b/src/anemoi/transform/grids/unstructured.py @@ -1,11 +1,11 @@ -# (C) Copyright 2024 ECMWF. +# (C) Copyright 2024 Anemoi contributors. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. -# import logging diff --git a/src/anemoi/transform/registry.py b/src/anemoi/transform/registry.py index 6ff7b97..2e1240b 100644 --- a/src/anemoi/transform/registry.py +++ b/src/anemoi/transform/registry.py @@ -1,9 +1,13 @@ +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. + import importlib import logging import os diff --git a/src/anemoi/transform/source.py b/src/anemoi/transform/source.py index 7b1721d..eb8b70a 100644 --- a/src/anemoi/transform/source.py +++ b/src/anemoi/transform/source.py @@ -1,10 +1,13 @@ -# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts. +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. + from .transform import Transform diff --git a/src/anemoi/transform/sources/mars.py b/src/anemoi/transform/sources/mars.py index 45b8ee7..0f18d64 100644 --- a/src/anemoi/transform/sources/mars.py +++ b/src/anemoi/transform/sources/mars.py @@ -1,11 +1,11 @@ -# (C) Copyright 2024 ECMWF. +# (C) Copyright 2024 Anemoi contributors. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. -# import earthkit.data as ekd diff --git a/src/anemoi/transform/transform.py b/src/anemoi/transform/transform.py index da7fd47..a655614 100644 --- a/src/anemoi/transform/transform.py +++ b/src/anemoi/transform/transform.py @@ -1,6 +1,8 @@ -# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts. +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. diff --git a/src/anemoi/transform/variables/variables.py b/src/anemoi/transform/variables/variables.py index d53380e..3e6aeae 100644 --- a/src/anemoi/transform/variables/variables.py +++ b/src/anemoi/transform/variables/variables.py @@ -1,6 +1,8 @@ -# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts. +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. diff --git a/src/anemoi/transform/workflow.py b/src/anemoi/transform/workflow.py index 898530d..8f214ec 100644 --- a/src/anemoi/transform/workflow.py +++ b/src/anemoi/transform/workflow.py @@ -1,10 +1,13 @@ -# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts. +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. + from .transform import Transform diff --git a/src/anemoi/transform/workflows/pipeline.py b/src/anemoi/transform/workflows/pipeline.py index 62e6ad3..6b3f83f 100644 --- a/src/anemoi/transform/workflows/pipeline.py +++ b/src/anemoi/transform/workflows/pipeline.py @@ -1,11 +1,11 @@ -# (C) Copyright 2024 ECMWF. +# (C) Copyright 2024 Anemoi contributors. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. -# from ..workflow import Workflow diff --git a/tests/test_grids.py b/tests/test_grids.py index 3ee1698..c6b729d 100644 --- a/tests/test_grids.py +++ b/tests/test_grids.py @@ -1,10 +1,13 @@ -# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts. +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. + import earthkit.data as ekd from anemoi.transform.grids import UnstructuredGridFieldList diff --git a/tests/test_variables.py b/tests/test_variables.py index 6dd30cf..1aa00cf 100644 --- a/tests/test_variables.py +++ b/tests/test_variables.py @@ -1,10 +1,13 @@ -# (C) Copyright 2024 European Centre for Medium-Range Weather Forecasts. +# (C) Copyright 2024 Anemoi contributors. +# # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. + from anemoi.transform.variables import Variable From f247c60dfd4605bd3e00b6dac9717dede64e1bb4 Mon Sep 17 00:00:00 2001 From: Baudouin Raoult Date: Sat, 26 Oct 2024 13:20:20 +0000 Subject: [PATCH 2/2] Add more methods to Variables --- src/anemoi/transform/variables/__init__.py | 23 +++++++++++++++++++++ src/anemoi/transform/variables/variables.py | 6 +++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/anemoi/transform/variables/__init__.py b/src/anemoi/transform/variables/__init__.py index 0ab9dda..502fb5e 100644 --- a/src/anemoi/transform/variables/__init__.py +++ b/src/anemoi/transform/variables/__init__.py @@ -55,6 +55,29 @@ def level(self): def is_constant_in_time(self): pass + @property + @abstractmethod + def is_instantanous(self): + pass + + @property + def is_valid_over_a_period(self): + return not self.is_instantanous + + @property + @abstractmethod + def is_accumulation(self): + pass + + # This may need to move to a different class @property def grib_keys(self): raise NotImplementedError(f"Method `grib_keys` not implemented for {self.__class__.__name__}") + + @property + def is_computed_forcing(self): + raise NotImplementedError(f"Method `is_computed_forcing` not implemented for {self.__class__.__name__}") + + @property + def is_from_input(self): + pass diff --git a/src/anemoi/transform/variables/variables.py b/src/anemoi/transform/variables/variables.py index 846c84e..cb74ee9 100644 --- a/src/anemoi/transform/variables/variables.py +++ b/src/anemoi/transform/variables/variables.py @@ -43,9 +43,13 @@ def is_computed_forcing(self): def is_accumulation(self): return self.data.get("process") == "accumulation" + @property + def is_instantanous(self): + return "process" not in self.data.get + @property def grib_keys(self): - return self.data.get("mars", {}) + return self.data.get("mars", {}).copy() class VariableFromDict(VariableFromMarsVocabulary):