Skip to content

Latest commit

 

History

History
138 lines (88 loc) · 5.13 KB

README.md

File metadata and controls

138 lines (88 loc) · 5.13 KB

EDR-isobaric

Logo

What is EDR-isobaric?

EDR-isobaric is an API for isobaric data (temperature and wind in isobaric layers). The API is based on OGC Environmental Data Retrieval (EDR). Data source is GRIB files from https://api.met.no/weatherapi/isobaricgrib/1.0/documentation.

The resulting API is for people who need vertical environmental data for a single location.

The code is written as an example aimed at API developers at Met.no.

Resulting data can be pasted into covjson playground for visualizing:

playground

The area covered by the source:

playground

linting: pylint Code style: black security: bandit License: MIT

Who is responsible?

  • larsfp at met.no

Status

Feature complete.

Getting started

Test it out

Choose one of the following:

Pull image from Github registry and run with docker

docker pull ghcr.io/metno/edrisobaric:main
docker run -it --rm --publish 5000:5000 ghcr.io/metno/edrisobaric:main --bind_host 0.0.0.0

Build using Pip

This method might need you to install libeccodes-dev from your package manager. Clone repo and run:

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 app/app.py

Web

A test instance is available at https://edrisobaric.k8s.met.no/.

Usage

A grib data file will be downloaded on demand if none is supplied.

Staring the app will give these URLs:

Example position lookup:

Arguments supported:

    usage: app.py [-h] [--time TIME] [--file FILE] [--base_url BASE_URL] [--bind_host BIND_HOST] [--api_url API_URL] [--data_path DATA_PATH]

    options:
    -h, --help            show this help message and exit
    --time TIME           Timestamp to fetch data for. Must be in format 2024-01-24T18:00:00Z, where time matches an available production. See
                            <https://api.met.no/weatherapi/isobaricgrib/1.0/available.json?type=grib2> for available files. They are produced every 3rd hour.
                            Example: --datetime="2024-01-24T18:00:00Z"
    --file FILE           Local grib file to read data from. Default will fetch file from API.
    --base_url BASE_URL   Base URL for API, with a trailing slash. Default is http://localhost:5000/
    --bind_host BIND_HOST
                            Which host to bind to. Default is 127.0.0.1. Use 0.0.0.0 when running in container.
    --api_url API_URL     URL to download grib file from. Default is <https://api.met.no/weatherapi/isobaricgrib/1.0/grib2?area=southern_norway>.
    --data_path DATA_PATH
                            Where to store data files. Default is ./data

Use it for production

This is only ment for learning. Use as noted in Testing it out.

Overview of architecture

Documentation

  • Based on Pydantic EDR- and covjson-libraries by KNMI
  • This app will not download new data unless restarted.
  • Sample output

Testing

This project is heavily tested to serve as an example for API developers and of sedr.

  • This API is tested on commit to internal gitlab
  • This API is tested on commit to public github
  • To run tests manually, activate your venv, install requirements.txt and requirements-dev.txt, then run tox --parallel. Multiple tests available, see tox -a.

Other APIs for comparison

References and acknowledgements

How to contribute

  • Issues

Templates