Skip to content

Commit

Permalink
[pylib-geo] Add another example, bump version, new bootstrap method
Browse files Browse the repository at this point in the history
  • Loading branch information
mirzov committed Mar 7, 2024
1 parent ce245a9 commit 7d944a7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/python/icoscp_core/src/icoscp_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
core services, such as authentication, metadata access, and data access.
"""

__version__ = "0.3.1"
__version__ = "0.3.2"
5 changes: 4 additions & 1 deletion src/main/python/icoscp_core/src/icoscp_core/bootstrap.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
14 changes: 13 additions & 1 deletion src/main/python/icoscp_core/src/icoscp_core/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)

Expand Down

0 comments on commit 7d944a7

Please sign in to comment.