bolster.data_sources.metoffice ============================== .. py:module:: bolster.data_sources.metoffice .. autoapi-nested-parse:: UK Met Office Weather Data and Map Images Integration. Data Source: The UK Met Office provides weather data and map images through their DataHub API at https://data.hub.api.metoffice.gov.uk/. This module accesses weather forecast data including precipitation, temperature, pressure, and land cover information. The API provides high-resolution weather map images suitable for visualization and analysis applications. Update Frequency: Weather forecast data is updated multiple times daily, typically every 3-6 hours depending on the forecast model. Map images are generated continuously as new forecast data becomes available. Historical data snapshots are preserved for analysis and comparison purposes. .. rubric:: Example Generate weather images and access forecast data (requires Met Office DataHub API key): >>> import os >>> os.environ['MET_OFFICE_API_KEY'] = 'your-api-key' >>> os.environ['MAP_IMAGES_ORDER_NAME'] = 'your-order-name' >>> from bolster.data_sources import metoffice >>> callable(metoffice.get_uk_precipitation) True This module provides utilities for fetching weather data from the Met Office API, processing forecast information, and generating visualization-ready weather map images. See the Met Office DataHub documentation for API details: https://datahub.metoffice.gov.uk/docs/f/category/map-images/type/map-images/api-documentation Attributes ---------- .. autoapisummary:: bolster.data_sources.metoffice.logger bolster.data_sources.metoffice.BASE_URL bolster.data_sources.metoffice.is_my_date Functions --------- .. autoapisummary:: bolster.data_sources.metoffice.get_order_latest bolster.data_sources.metoffice.get_file_meta bolster.data_sources.metoffice.get_file bolster.data_sources.metoffice.filter_relevant_files bolster.data_sources.metoffice.make_borders bolster.data_sources.metoffice.make_isolines bolster.data_sources.metoffice.make_precipitation bolster.data_sources.metoffice.generate_image bolster.data_sources.metoffice.get_uk_precipitation Module Contents --------------- .. py:data:: logger .. py:data:: BASE_URL :value: 'https://data.hub.api.metoffice.gov.uk/map-images/1.0.0' .. py:function:: get_order_latest(order_name) Get the latest status for a Met Office data order. .. py:function:: get_file_meta(order_name, file_id) Get metadata for a specific file in a Met Office order. .. py:function:: get_file(order_name, file_id) Download and cache a file from a Met Office order. .. py:data:: is_my_date .. py:function:: filter_relevant_files(order_status) Filter order files to find UK precipitation radar data. .. py:function:: make_borders(data) Create image borders from Met Office geographic data. .. py:function:: make_isolines(data) Create weather isolines from Met Office data. .. py:function:: make_precipitation(data) Process precipitation radar data into visualization image. .. py:function:: generate_image(order_name, block, bounding_box = (100, 250, 500, 550)) Generate composite weather visualization from Met Office data. .. py:function:: get_uk_precipitation(order_name, bounding_box = None) Get the latest UK precipitation forecast from the Met Office API and generate an image suitable for epaper display.