From 4f0d1c3c31c6d9d7fd126c6f51d89cc26b75bbc0 Mon Sep 17 00:00:00 2001 From: Carsten Hinz <c.hinz@fz-juelich.de> Date: Wed, 26 Jun 2024 16:40:42 +0200 Subject: [PATCH] added cartopy for interactive endpoint started implementing a class to handle the contributors removed contributors_role as this will not be part of the metadata of a gridded file --- .gitignore | 1 + examples/quality_controll.ipynb | 2 +- pyproject.toml | 1 + src/toargridding/contributors.py | 25 +++++++++++++++++++ src/toargridding/grids.py | 2 -- .../static_metadata/global_cf_attributes.json | 1 - src/toargridding/toar_rest_client.py | 1 + 7 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 src/toargridding/contributors.py diff --git a/.gitignore b/.gitignore index d2a41f3..f7cc33b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ notTracked/ *.swp log/ */log/ +.venv diff --git a/examples/quality_controll.ipynb b/examples/quality_controll.ipynb index dc44b43..b3ad13b 100644 --- a/examples/quality_controll.ipynb +++ b/examples/quality_controll.ipynb @@ -204,7 +204,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.11.7" } }, "nbformat": 4, diff --git a/pyproject.toml b/pyproject.toml index 3a1df3c..51d4d7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ installer = "uv" extra-dependencies = [ "jupyter", "ipykernel", + "cartopy" ] [tool.hatch.envs.hatch-static-analysis] diff --git a/src/toargridding/contributors.py b/src/toargridding/contributors.py new file mode 100644 index 0000000..6374a43 --- /dev/null +++ b/src/toargridding/contributors.py @@ -0,0 +1,25 @@ + + +class contributors: + def __init__(self, requestID, endpoint="not yet defined"): + self.requestID = requestID + self.timeseriesIDs = set() + self.endpoint = endpoint + def get_contributors_endpoint(self): + #TODO here, is the latest point to decide, if we need to provide an endpoint or a curl command to upload a time series id file + pass + def get_offline_command(self): + # write time series IDs to file + # save file + return f"curl {self.endpoint} -file {self.requestID}.contributors" + def get_service_contributors(self): + # TODO: missing implementation + raise NotImplementedError("This has not been implemented as this package is not yet operated as a service.") + def add_timeseries(self, id): + self.timeseriesIDs.add(id) + def add_many_timeseries(self, ids): + for id in ids: + self.timeseriesIDs.add(id) + + + diff --git a/src/toargridding/grids.py b/src/toargridding/grids.py index ca501ee..1bd176f 100644 --- a/src/toargridding/grids.py +++ b/src/toargridding/grids.py @@ -157,9 +157,7 @@ class RegularGrid(GridDefinition): cell_indices = self.as_cell_index(coords) # will convert cell_indices to float as some nans ar present - print(data) data_with_indices = data.join(cell_indices.to_frame(GridDefinition.cell_index_name), how="outer") - print(data) return data_with_indices.groupby(GridDefinition.cell_index_name) diff --git a/src/toargridding/static_metadata/global_cf_attributes.json b/src/toargridding/static_metadata/global_cf_attributes.json index bab7e03..25c30a3 100644 --- a/src/toargridding/static_metadata/global_cf_attributes.json +++ b/src/toargridding/static_metadata/global_cf_attributes.json @@ -12,7 +12,6 @@ "publisher_email": "info@toar-data.org", "publisher_url": "https://toar-data.fz-juelich.de/", "contributor_name": "ask Martin, namen", - "contributor_role": "ask Martin", "institution": "The Tropospheric Ozone Assessment Report (TOAR) Data Centre, Research Centre Jülich, Jülich, Germany", "project": "TOAR-II", "creator_type": "institution", diff --git a/src/toargridding/toar_rest_client.py b/src/toargridding/toar_rest_client.py index 2b22294..33a122b 100644 --- a/src/toargridding/toar_rest_client.py +++ b/src/toargridding/toar_rest_client.py @@ -429,6 +429,7 @@ class AnalysisService: timeseries, timeseries_metadata = self.get_timeseries_and_metadata(metadata) coords = self.get_clean_coords(timeseries_metadata) timeseries = self.get_clean_timeseries(timeseries, metadata) + print(timeseries) return AnalysisRequestResult(timeseries, coords, metadata) def get_timeseries_and_metadata(self, metadata: Metadata) -> tuple[pd.DataFrame, pd.DataFrame]: -- GitLab