fridlmue / pyAvaCore

Python library to download and parse EAWS avalanche bulletins. This is a code mirror only!

Home Page:https://gitlab.com/albina-euregio/pyAvaCore/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyAvaCore

Python library to download and parse EAWS avalanche bulletins. PyAvaCore can generate CAAMLv6 (CAAMLv6 is not yet officially released) compliant JSON files for the supported regions and Avalanche Warning Services (AWS).

License

This Project is Licensed under GPL-3.0

Utilization

pyAvaCore is used in the ALBINA project to parse the neighbor bulletins in a unified way as JSON-File and a ratings.json file with the danger levels for the regions. This is used to augment the map with the danger rating information.

pyAvaCore is used by EAWS to visualize (almost all) avalanche bulletins of Europe on a single map:

It is also used as parser for the mobile app "avaRisk" as background parser to fetch a wide variety of reports.

Dependencies

As on some target platforms the number of available Python dependencies is limited, the project aims to work with minimal external dependencies. The dependencies can be found in the "requirements.txt". Python 3.9 is the current Python target version. On Windows, please install the package tzdata.

CLI Parameters

> python -m avacore --help
usage: avacore [-h] [--lang LANG] [--date DATE] [--regions REGIONS]
               [--merge-dates DATES] [--merge-regions REGIONS]
               [--protect-overwrite-now TIMESTAMP] [--output OUTPUT]
               [--geojson GEOJSON] [--cli CLI]

Download and parse EAWS avalanche bulletins

options:
  -h, --help            show this help message and exit
  --lang LANG           language to fetch avalanche bulletins for
  --date DATE           date to fetch avalanche bulletins for;
                        date is specified in ISO 8601 format `YYYY-MM-DD`;
                        multiple dates may be specified using a space separator;
                        an ISO 8601 interval may be specified as `YYYY-MM-DD/YYYY-MM-DD`
  --regions REGIONS     avalanche regions to download
  --merge-dates DATES   dates to merge into one file
  --merge-regions REGIONS
                        avalanche regions to merge into one file
  --protect-overwrite-now TIMESTAMP
                        exclude bulletins prior the given timestamp
  --output OUTPUT       output directory
  --geojson GEOJSON     eaws-regions directory containing *micro-regions_elevation.geojson.json of
  --cli CLI             print output to cli? [y]es, [n]o or [o]nly to cli ([o] will not write files)

In default configuration, pyAvaCore will fetch the bulletins for all supported regions.

The regions to fetch can be limited with the --regions parameter. Multiple regions can be entered delimited by space. E. g. python -m avacore --regions AT-02 IT-57 will fetch the bulletins for AT-02 and IT-57 only.

The files are written to ./data by default the folder can be adjusted by setting the --output ./subfolder/of/choice.

A CLI output of the bulletin can be generated with the --cli parameter. Default is n, which gives no CLI output. With y a CLI output is generated in addition to the JSON files. With o, only the cli output is generated but no JSON files are written.

Supported Regions

At the moment the following regions are supported with the localization versions mentioned:

RegionIDs

The IDs for the different regions currently supported can be found here.

Credits

The parser uses the png.py file from the PyPNG-Project (MIT License).

About

Python library to download and parse EAWS avalanche bulletins. This is a code mirror only!

https://gitlab.com/albina-euregio/pyAvaCore/

License:GNU General Public License v3.0


Languages

Language:Python 100.0%