Skip to main content

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

Release files for whosclient 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whosclient 0.1.2
File Size Uploaded
whosclient-0.1.2.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whosclient 0.1.2
File Interpreter ABI Platform
whosclient-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / whosclient-0.1.2.tar.gz

Download URL whosclient-0.1.2.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c521d6c18f73e17c75f80542f92563f4d4b34ffd484cdda65a42893def22d47d
BLAKE2b-256 checksum
How to use checksums
c50bb555393c133334dcaf30d52e0ad07e11c12305d3605e224a5d81f7d4cfe1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / whosclient-0.1.2-py3-none-any.whl

Download URL whosclient-0.1.2-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0160ff08c5f76c313eba9f6d97d80a7b2ecdeba30176ebf0eb8f2b26b575d06
BLAKE2b-256 checksum
How to use checksums
162518c71253d3b8dd13378c0127286dfb75363cd4afe0ad8ab340c0c037c8f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page