Skip to main content

A package for downloading and maniuplating meteograms from YR

Project description

yr_meteogram_util

Python library for fetching and manipulating meteograms from YR.

The meteograms are returned as svg in a string for you to use.

Installing

To install the package, run:

pip install yr_meteogram_util

To upgrade

To upgrade to the latest version, run: pip install --upgrade yr_meteogram_util

Features

  • Standard (bright) or dark meteograms

    You can select between bright (default) or dark versions of the meteograms.

    Standard:

    Standard meteogram

    Dark (as rendered by Safari):

    Dark meteogram

    These are provided exactly as they are generated by Yr.

  • Crop

    The default meteograms have quite a lot of empty space, so you can select to have the meteograms cropped into a more compact version.

    Cropped meteogram

    This is done by altering the generated by Yr and change of generated contents may result in failure or unpredicted results.

  • Make transparent

    If you want to display the meteograms someware that has a background color other than white or black, it can be frustrating that they have a white or black background. So, you can choose to remove that and get a transparent meteogram.

    Transparent meteogram

    This is done by altering the generated by Yr and change of generated contents may result in failure or unpredicted results.

  • Unhide

    The dark version from YR renders bad in Safari browers. The logos and the wind direction arrows are rendered as "black on black"... So if you select the dark version the colors are altered to render the same way in Safari as in Chrome and Edge.

    Dark meteogram with modified colors

    This is done by altering the generated by Yr and change of generated contents may result in failure or unpredicted results.

  • Any combination

    These features are flags and any combination of them can be used. The last one is a dark, cropped, transparent with modified colors.

    Dark cropped, transparent meteogram with modified colors

Notes about location

To find the location id to be able to use this package:

  • Navigate to Yr.no

  • Search for the location you want

  • Copy the location id from the url (see picture below)

    LocationId in URL

Example

# Import libraries for fetching meteograms from YR
import asyncio # if using the async version
import yr_meteogram_util

# The location to fetch, see "Notes about location"
LOCATION_ID = '2-5847504'

# Fetch the standard (bright) meteogram for LOCATION_ID
standard_meteogram = yr_meteogram_util.fetch_svg(LOCATION_ID)

# Fetch the dark meteogram for LOCATION_ID
dark_meteogram = yr_meteogram_util.fetch_svg(LOCATION_ID, dark = True)

# Fetch the dark meteogram for LOCATION_ID and crop it
dark_cropped_meteogram = yr_meteogram_util.fetch_svg(LOCATION_ID, dark = True, crop = True)

# Fetch the dark meteogram for LOCATION_ID, crop it and make it transparent
dark_cropped_transparent_meteogram = yr_meteogram_util.fetch_svg(LOCATION_ID, dark = True, crop = True, make_transparent = True)

# Fetch the dark meteogram for LOCATION_ID, crop it and make it transparent and unhide dark details
dark_cropped_transparent_meteogram = yr_meteogram_util.fetch_svg(LOCATION_ID, dark = True, crop = True, make_transparent = True, unhide_dark_objects = True)

# There is also an async version available
meteogram_async = asyncio.run(yr_meteogram_util.fetch_svg_async(LOCATION_ID))

# It is possible to get the Location name from a meteogram
location_name = yr_meteogram_util.get_location_name(standard_meteogram)

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

yr_meteogram_util-0.2.5.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

yr_meteogram_util-0.2.5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file yr_meteogram_util-0.2.5.tar.gz.

File metadata

  • Download URL: yr_meteogram_util-0.2.5.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for yr_meteogram_util-0.2.5.tar.gz
Algorithm Hash digest
SHA256 3ac0380c66ac628bcb748c11a23f322164fde8298c6cb737a33f0511b505ae7b
MD5 79e17d4acfeeabca2bb07ed7706e28db
BLAKE2b-256 9b08a11565c52537e8882c60e590413615f3a8b5d040aaed7fc34960f6757d65

See more details on using hashes here.

File details

Details for the file yr_meteogram_util-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for yr_meteogram_util-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1a72914ccb10469da33c8fdd9bfbcaf009dd17167d58c58fa75a336249295e35
MD5 d200f7f81f1c9de64c5a4dd9250029f9
BLAKE2b-256 8450f53a31e2348ea6f8f981d3d2f05cd38cca7d95685103bf043189740968fc

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