Skip to main content

No project description provided

Project description

WHOS data retrieval functionality for HydroSOS

Purpose

To facilitate interoperable timeseries data retrieval from the WHOS (WMO Hydrological Observations System).

How to use

  1. Install this module (see Installation)

  2. Register into WHOS and save your access token

  3. Explore WHOS portals and search engines to select the timeseries of interest

  1. Take note of the feature id (site) plus observedProperty, or the observationIdentifier

  2. Use either a python script or notebook (see get_test.ipynb) or the command line interface to get the data (see get_test.sh) for a given time period

Installation

setup environment

python3 -m pip install venv
python3 -m venv .venv
source .venv/bin/activate

using git

git clone https://github.com/jbianchi81/whosclient.git
cd whosclient
pip install -e .

using pip

pip install whosclient

Basic Use

from whosclient.whosclient import OmOgcTimeseriesClient
client = OmOgcTimeseriesClient({"token":"my_token"}) # put your token here
metadata = client.getTimeseriesWithPagination(
  observedProperty = "Discharge",
  limit = 50
)
data = client.getData(
    "1990-01-01", 
    "2025-05-01",
    observationIdentifier = "id_of_interest" # put the id of the observation here
)

Output

Output format is either:

  • a JSON-serializable list of dicts:

    [
      {
        "date": "ISO format date string",
        "value": float
      },
      ...
    ]
    
  • or CSV:

    date,value
    string,float
    ...
    

Command line interface

data

Usage: whosclient data [OPTIONS] BEGIN_POSITION END_POSITION

Options:
  -t, --token TEXT                WHOS access token
  -u, --url TEXT                  WHOS OM OGC timeseries API url
  -o, --output TEXT               Save result into this file (instead of print
                                  on stdout)
  -c, --csv                       Use CSV format for output (instead of JSON)
  -m, --monitoring_point TEXT     site identifier. It must be user together
                                  with --variable_name
  -v, --variable_name TEXT        variable identifier. It must be used
                                  together with --monitoring_point
  -s, --timeseries_identifier TEXT
                                  timeseries identifier. If set,
                                  --monitoring_point and --variable_name are
                                  ignored
  --help                          Show this message and exit.

metadata

Usage: whosclient metadata [OPTIONS]

Options:
  -t, --token TEXT                WHOS access token
  -u, --url TEXT                  WHOS OM OGC timeseries API url
  -o, --output TEXT               Save result into this file (instead of print
                                  on stdout)
  -m, --monitoring_point TEXT     site (feature) identifier. It must be user
                                  together with --variable_name
  -v, --variable_name TEXT        variable identifier (=observedProperty). It
                                  must be used together with
                                  --monitoring_point
  -s, --timeseries_identifier TEXT
                                  timeseries identifier. If set,
                                  --monitoring_point and --variable_name are
                                  ignored
  -l, --limit INTEGER             pagination page size
  -h, --has_data                  return only observations with data
  -W, --west FLOAT                west longitude of bounding box
  -S, --south FLOAT               south latitude of bounding box
  -E, --east FLOAT                east longitude of bounding box
  -N, --north FLOAT               north latitude of bounding box
  -O, --ontology TEXT             The ontology to be used to expand the
                                  observed property search term (or URI) with
                                  additional terms from the ontology that are
                                  synonyms and associated to narrower
                                  concepts. Two ontologies are available: whos
                                  or his-central
  -V, --view TEXT                 Identifier of the data subset interesting
                                  for the user
  -T, --time_interpolation TEXT   The interpolation used on the time axis (for
                                  example, MAX, MIN, TOTAL, AVERAGE, MAX_PREC,
                                  MAX_SUCC, CONTINUOUS, ...)
  -i, --intended_observation_spacing TEXT
                                  The expected duration between individual
                                  observations, expressed as ISO8601 duration
                                  (e.g., P1D)
  -a, --aggregation_duration TEXT
                                  Time aggregation that has occurred to the
                                  value in the timeseries, expressed as
                                  ISO8601 duration (e.g., P1D)
  -f, --format TEXT               Response format (e.g. JSON or CSV)
  --help                          Show this message and exit.

Credits

Programa de Sistemas de Información y Alerta Hidrológico de la Cuenca del Plata

Laboratorio de Hidrología

Instituto Nacional del Agua

Argentina

2025-05-21

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

whosclient-0.1.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

whosclient-0.1.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file whosclient-0.1.2.tar.gz.

File metadata

  • Download URL: whosclient-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for whosclient-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c521d6c18f73e17c75f80542f92563f4d4b34ffd484cdda65a42893def22d47d
MD5 c64c1baa5896435151eaf41af6181ab5
BLAKE2b-256 c50bb555393c133334dcaf30d52e0ad07e11c12305d3605e224a5d81f7d4cfe1

See more details on using hashes here.

File details

Details for the file whosclient-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: whosclient-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for whosclient-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0160ff08c5f76c313eba9f6d97d80a7b2ecdeba30176ebf0eb8f2b26b575d06
MD5 0f0444b400f4a79e216fb3594aa9e187
BLAKE2b-256 162518c71253d3b8dd13378c0127286dfb75363cd4afe0ad8ab340c0c037c8f8

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