Skip to content

Releases

v0.3.0

Choose a tag to compare

@Teagum Teagum released this 15 Oct 13:15

canairy 0.3.0 renames the package (air_pollution → canairy) and the Hamburg client (luftmessnetz → hh), and fixes the Hamburg client silently returning only the last month of longer date ranges. Upgrading requires code changes; see below.

Upgrading from 0.2.x

  • Python 3.12 or newer is required. (canairy.uba already failed to import on 3.11 in 0.2.2.)

  • The distribution is now canairy (was air-pollution). Remove the old one with pip uninstall air-pollution.

  • Rename imports:

    0.2.x 0.3.0
    air_pollution.uba canairy.uba
    air_pollution.luftmessnetz canairy.hh
    LuftmessnetzClient HHClient
    Station, StationData, Component, ComponentData, Core, Threshold HHStation, HHStationData, HHComponent, HHComponentData, HHCore, HHThreshold

    The HH models can now be imported from canairy.hh directly.

  • HH date ranges are checked: start/end combined with a timespan other than "custom", or a start after end, now raise ValueError.

  • The downloader Docker image is now tagged canairy_downloader (was de.uke.iam.air-pollution_downloader).

Hamburg: complete date ranges

The Hamburg API cuts custom ranges to the latest 31 days for 1h, 8hg and 24hg, and to the latest 365 days for 24h, without reporting an error. In 0.2.x, a request for a year of hourly data returned only its last month. get_station_data and get_component_data now request long ranges in windows within these limits and join the results, so a year of hourly data takes about 12 requests.

Related changes:

  • start/end without a timespan are sent as a custom range. Before, the API ignored them and returned its default span.
  • A missing end means now in Hamburg, also on machines that run in UTC. An open range that starts in the future returns [].
  • Naive start/end are read as Hamburg time and timezone-aware ones are converted, so a timestamp from a previous result can be passed back as is.
  • HHStationData.value is float | None. It was int, which failed validation on most real ranges: values are decimals, and missing hours are null.

Other fixes

Both clients

  • When retries run out, the original error is raised right away. Before, the client waited another 256 s and then failed with an unrelated AttributeError or TypeError.

Hamburg

  • Sends one GET per request instead of HEAD + GET, which halves the requests the API receives. The HEAD was neither retried nor counted by the 120/min rate limit.
  • Requests time out after 60 s instead of 5 s.
  • Logs through its module logger instead of the root logger.

UBA

  • Client errors (4xx other than 429) are raised at once instead of being tried 8 times with 8.5 minutes of backoff.
  • get_stations with dt_start but no dt_stop no longer raises TypeError.
  • get_components and get_scopes check the API's column order and raise ValueError if it changes, instead of assigning values to the wrong fields.

Dependencies

  • Requires hishel>=1.0 (0.2.2 declared >=0.1.2 but needed 1.x).
  • Adds tzdata, so Hamburg time also works on slim Docker images and Windows.
  • Drops the unused httpx-limiter.

Known issue

aq-downloader requests each year up to 31 December of the following year, so files of consecutive years overlap. Deduplicate after loading.

v0.2.2

Choose a tag to compare

@Teagum Teagum released this 09 Feb 11:47
v0.2.2

v0.2.1

Choose a tag to compare

@Teagum Teagum released this 16 Jan 12:20

Maintenance release

  • fixes #5

v0.2.0

Choose a tag to compare

@Teagum Teagum released this 16 Jan 12:19

Major Changes:

  • Add UBA client

v0.1.2

Choose a tag to compare

@Teagum Teagum released this 01 Aug 11:11

Maintenance update