From 7d944a777437050ca5243ba45a193c3ea5f50dff Mon Sep 17 00:00:00 2001 From: Oleg Mirzov Date: Thu, 7 Mar 2024 08:42:41 +0100 Subject: [PATCH] [pylib-geo] Add another example, bump version, new bootstrap method --- .../python/icoscp_core/src/icoscp_core/__init__.py | 2 +- .../icoscp_core/src/icoscp_core/bootstrap.py | 5 ++++- .../python/icoscp_core/src/icoscp_core/examples.py | 14 +++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/python/icoscp_core/src/icoscp_core/__init__.py b/src/main/python/icoscp_core/src/icoscp_core/__init__.py index 9e189548..3888dec3 100644 --- a/src/main/python/icoscp_core/src/icoscp_core/__init__.py +++ b/src/main/python/icoscp_core/src/icoscp_core/__init__.py @@ -4,4 +4,4 @@ core services, such as authentication, metadata access, and data access. """ -__version__ = "0.3.1" +__version__ = "0.3.2" diff --git a/src/main/python/icoscp_core/src/icoscp_core/bootstrap.py b/src/main/python/icoscp_core/src/icoscp_core/bootstrap.py index f2dc3a60..c4e94bf8 100644 --- a/src/main/python/icoscp_core/src/icoscp_core/bootstrap.py +++ b/src/main/python/icoscp_core/src/icoscp_core/bootstrap.py @@ -1,6 +1,6 @@ import os from .envri import EnvriConfig -from .auth import ConfigFileAuth, PasswordAuth, TokenAuth +from .auth import AuthTokenProvider, ConfigFileAuth, PasswordAuth, TokenAuth from .metaclient import MetadataClient from .dataclient import DataClient from typing import Tuple @@ -29,3 +29,6 @@ def fromCredentials(self, user_id: str, password: str) -> Tuple[MetadataClient, auth = PasswordAuth(user_id, password, self._conf) data = DataClient(self._conf, auth, self._data_path) return data.meta, data + + def fromAuthProvider(self, auth: AuthTokenProvider) -> DataClient: + return DataClient(self._conf, auth, self._data_path) diff --git a/src/main/python/icoscp_core/src/icoscp_core/examples.py b/src/main/python/icoscp_core/src/icoscp_core/examples.py index 4d838fc5..c7315e81 100644 --- a/src/main/python/icoscp_core/src/icoscp_core/examples.py +++ b/src/main/python/icoscp_core/src/icoscp_core/examples.py @@ -10,7 +10,7 @@ import pandas as pd import time as tm from .geofeaturemeta import Point -from .queries.dataobjlist import box_intersect +from .queries.dataobjlist import box_intersect, GeoIntersectFilter def init_authentication_icos() -> None: return auth.init_config_file() @@ -33,6 +33,18 @@ def list_filtered_geo_info(): filters=[box_intersect(Point(-40, 145), Point(-25, 155))] ) +def la_reunion_atc(): + return meta.list_data_objects( + datatype="http://meta.icos-cp.eu/resources/cpmeta/atcCo2NrtDataObject", + filters=[ + GeoIntersectFilter([ + Point(-21.46555, 54.90857), + Point(-20.65176, 55.423563), + Point(-21.408027, 56.231058) + ]) + ] + ) + def list_all_stations_in_icos_cp(): return meta.list_stations(of_station_type_uri=False)