Skip to main content

Python package to interact with the SAEON Observation Database API

Project description

saeonobspy

build codecov PyPI

saeonobspy is a Python package for interacting with the South African Environmental Observation Network (SAEON) observations database API. It provides a simple interface to view available datasets and download observation data.

Installation

Install saeonobspy using pip:

pip install saeonobspy

Authorisation

To use saeonobsr you need to first register an account SAEON observations database. Once registered you need to login and retrieve an API token from https://observations.saeon.ac.za/account/token. This token will be valid for 1 month.

Before starting set your API access token using

import os
os.environ["OBSDB_KEY"] = "xxx"

Usage

Below is an example of using the package to view available datasets and download a set of observations:

import geopandas as gpd
from saeonobspy import SAEONObsAPI

# Initialize the API
saeon_api = SAEONObsAPI()

# View available datasets
datasets_df = saeon_api.view_datasets()

# Filter datasets by a specific area (optional)
extent_gdf = gpd.read_file('path/to/extent/shapefile.shp')
spatial_datasets_gdf = saeon_api.view_datasets(extent=extent_gdf, spatial=True)

# Filter the datasets DataFrame based on your criteria
filtered_datasets_df = datasets_df[datasets_df['siteName'] == 'Constantiaberg']
filtered_datasets_df = filtered_datasets_df[filtered_datasets_df['description'] == 'Air Temperature - Daily Minimum - Degrees Celsius']

# Download observation data
obs_data = saeon_api.get_datasets(filtered_datasets_df, start_date='2020-01-01', end_date='2020-12-31')

print(obs_data)

For more information on how to use the package, please refer to the documentation in the source code.

License

This package is licensed under the MIT License. See the LICENSE file for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

saeonobspy-0.2.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

saeonobspy-0.2.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file saeonobspy-0.2.0.tar.gz.

File metadata

  • Download URL: saeonobspy-0.2.0.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for saeonobspy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b8d1ed06d34e53bcf3e508756748811f862570cd808dee17b97229e65901cd6b
MD5 c4676b37f2691984dc8b13d6d4f14759
BLAKE2b-256 fde22f1d24fc34a75ae91d9a756d0772885cde0491d18d67d3d821e8f2efa822

See more details on using hashes here.

File details

Details for the file saeonobspy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: saeonobspy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for saeonobspy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e504fc08f04325de504601372ae419b0b7172717dc6988bb4ea1c8388af4df1
MD5 105ded0ab9156d8e2e9404e1d0668367
BLAKE2b-256 7237a7d32e43c838f4542fa737e449989166302af01b8472a43e367342caaf45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page