### Coordinates and Time Interval Example Source: https://docs.meteoblue.com/en/weather-apis/dataset-api/dataset-api-configurator This example demonstrates how to provide a list of coordinates along with optional elevation and location names, and specifies a start and end date for weather data retrieval. It highlights the expected format for comma-separated values and the use of ISO8601 for dates. ```text 49.78,7.65,161,Basel,2022-01-01,2022-01-31 // lat, lon, asl 47.37,8.55,429,Zurich,2022-02-01,2022-02-14 // lat, lon, asl ``` -------------------------------- ### Example Multimodel API URL Source: https://docs.meteoblue.com/en/weather-apis/forecast-api/forecast-data This example URL demonstrates how to access the Multimodel data package, which provides raw model output without post-processing. It includes parameters for latitude, longitude, and an API key. ```url https://my.meteoblue.com/packages/multimodel-1h_multimodel-3h?lat=47.558&lon=7.573&apikey=DEMOKEY ``` -------------------------------- ### Account API Usage Example Source: https://docs.meteoblue.com/en/weather-apis/further-apis/account-api This example demonstrates how to construct a URL to retrieve account usage statistics from the meteoblue Account API. It includes mandatory and optional parameters for date range and pagination. ```URL https://my.meteoblue.com/account/usage?apikey=DEMOKEY https://my.meteoblue.com/account/usage?date_start=2020-01-01&date_end=2020-01-14&apikey=DEMOKEY ``` -------------------------------- ### Get Crop Climate Risk Data (Highcharts HTML) Source: https://docs.meteoblue.com/en/weather-apis/further-apis/crop-risk-api This example demonstrates how to fetch crop climate risk data in highcharts HTML format. It requires specifying the risk type, crop, location (latitude and longitude), and a date range. An API key is also necessary for authentication. ```URL https://my.meteoblue.com/images/crop_climate_risk?format=highchartshtml&risk=drought&crop=maize&lat=49.1&lon=16.6&years_start=2010&years_end=2020&apikey=DEMOKEY ``` -------------------------------- ### API Signing Example Source: https://docs.meteoblue.com/en/weather-apis/dataset-api Demonstrates how to construct a signed API URL for meteoblue APIs. This is used to make API URLs tamper-proof or set an expiration date. The example includes parameters for the API key, MD5 hash of the POST body, expiration timestamp, and the final signature. ```url https://my.meteoblue.com/dataset/query?apikey=MY_API_KEY&post_body_md5=070aff9477baf1844e37e68606483436&expire=1581606535&sig=6a5c276f186539bf1d0c57835c4fb0dd ``` -------------------------------- ### Fetch Weather Data using Trend Pro API (Example URL) Source: https://docs.meteoblue.com/en/weather-apis/packages-api/forecast-data This snippet demonstrates how to construct a URL to fetch weather data using the 'Trend Pro' package. It requires specifying the desired data package, forecast interval, geographical coordinates (latitude and longitude), and an API key. The example URL includes parameters for 'trendpro-1h' and 'trendpro-day' intervals. ```URL https://my.meteoblue.com/packages/trendpro-1h_trendpro-day?lat=47.558&lon=7.573&apikey=DEMOKEY ``` -------------------------------- ### Time API Request Example Source: https://docs.meteoblue.com/en/weather-apis/maps-api/time-api Demonstrates how to make a GET request to the Time API to retrieve time information for a specific mode and domain. The mode parameter determines the aggregation level (hourly, daily, monthly, nexthours), and the domain specifies the geographical area. ```HTTP GET /v1/time/{mode}/{domain} ``` -------------------------------- ### JSON Weather Data Example Source: https://docs.meteoblue.com/en/weather-apis/dataset-api/dataset-api-configurator Example of JSON output for hourly temperature data for multiple locations. It includes geometry, time intervals, and weather variable details with data organized per time interval and grid-point. The structure is designed for efficient transfer of large datasets. ```json [ { "geometry":{ "type":"MultiPoint", "locationNames":[ "Basel", "Zurich" ], "coordinates":[ [7.5, 47.66652, 499.774], [8.4375, 47.33319, 549.352] ] }, "timeResolution":"hourly", "timeIntervals":[ ["20200101T0000","20200101T0100","20200101T0200",...] ], "domain":"NEMSGLOBAL", "codes":[ { "code":11, "variable":"Temperature", "unit":"°C", "level":"2 m above gnd", "aggregation":"none", "dataPerTimeInterval":[ { "data":[ [0.77,1.27,1.51,1.51,1.32,0.95,0.34,...], [2.32,4.51,6.52,8.34,10.03,11.6,13.09,...] ], "gapFillRatio": 0 } ] } ] } ] ``` -------------------------------- ### Location Search API - JSONP Example Source: https://docs.meteoblue.com/en/weather-apis/further-apis/location-search-api This example demonstrates how to bypass the Same-Origin Policy using JSONP to query the Location Search API. It fetches location names based on a search term and displays them in the console. ```APIDOC ## POST /en/server/search/query3 (JSONP) ### Description This endpoint allows searching for locations and returns results wrapped in a JSONP callback function to bypass the Same-Origin Policy. It's useful for older browsers that restrict cross-origin data requests. ### Method POST ### Endpoint https://www.meteoblue.com/en/server/search/query3 ### Parameters #### Query Parameters - **query** (string) - Required - The search term for the location. - **iso2** (string) - Required - The ISO 3166-1 alpha-2 country code. - **apikey** (string) - Required - Your API key. - **sig** (string) - Required - The signature for the request. #### Request Body (Not applicable for this JSONP example, parameters are sent as query parameters) ### Request Example ```javascript var params = { query: "Tokyo", iso2: "JP", apikey: "DEMOKEY", sig: "siuhaefiusf" }; $.ajax({ cache: true, // enable caching of the results dataType: "jsonp", // enable JSONP jsonpCallback: "printAllNames", // use "printAllNames" as callback url: "https://www.meteoblue.com/en/server/search/query3", data: params // add parameters to ajax request }); ``` ### Response #### Success Response (200) - **results** (array) - An array of location objects, each containing details like name, latitude, longitude, and elevation. #### Response Example ```json { "results": [ { "name": "Tokyo", "lat": 35.6895, "lon": 139.6917, "asl": 40 }, // ... more location objects ] } ``` ### Callback Function Example ```javascript function printAllNames(data) { var results = data.results; for (var i in results) { if (results.hasOwnProperty(i)) { console.log(results[i]["name"]); } } } ``` ``` -------------------------------- ### Aggregation and Comparing API Example Source: https://docs.meteoblue.com/en/weather-apis/maps-api/tile-api This section demonstrates how to use aggregations and the comparator in the meteoblue API. It shows the order of processing for these operations. ```APIDOC ## GET /map/vector/{layer}/{time_range1}/{time_range2}/{z}/{x}/{y} ### Description This endpoint allows fetching weather data with specified aggregations and comparisons. It processes data in a defined sequence to provide aggregated and compared results. ### Method GET ### Endpoint `https://maps-api.meteoblue.com/map/vector/NEMSAUTO/2019-04-01%2f2019-04-30_2020-04-01%2f2020-04-30/specialTempLayer~11~2%20m%20above%20gnd~daily~max~contourLinear~2~-100~46/5/17/11` ### Query Parameters - **timeIntervalAggregation** (string) - Required - Specifies the aggregation function to apply over time intervals (e.g., `mean`). - **timeIntervalComparator** (string) - Required - Specifies the comparison function to apply between time ranges (e.g., `substract`). ### Request Example ``` GET https://maps-api.meteoblue.com/map/vector/NEMSAUTO/2019-04-01%2f2019-04-30_2020-04-01%2f2020-04-30/specialTempLayer~11~2%20m%20above%20gnd~daily~max~contourLinear~2~-100~46/5/17/11?timeIntervalAggregation=mean&timeIntervalComparator=substract ``` ### Response #### Success Response (200) - **time** (string) - Timestamp of the aggregated/compared data. - **Temp [°C]** (float) - The aggregated and/or compared temperature value. #### Response Example ```json { "time": "2019-04-01T00:00:00", "Temp [°C]": -3.785 } ``` ### Processing Steps 1. **Data Reading**: Loads data for each grid point, layer, and time range at the highest resolution. 2. **Layer Aggregation**: Aggregates loaded data per grid point and time range using the layer's specified aggregation (e.g., daily maximum). 3. **Time Interval Aggregation**: Aggregates the data using the `timeIntervalAggregation` parameter (e.g., mean of daily maximums). 4. **Time Interval Comparison**: Compares data between time ranges using the `timeIntervalComparator` parameter (e.g., subtraction). ``` -------------------------------- ### Example API Call for Risk Data Source: https://docs.meteoblue.com/en/weather-apis/climate-data-api/overview This snippet demonstrates how to construct a request to the meteoblue Risk Data API. It includes all necessary parameters such as emission scenario, model, dimension, downscaling, location, time range, and API key. The example uses specific values for each parameter to retrieve temperature-related risk data. ```url https://climateplus.meteoblue.com/risk_data/SSP1-2.6?model=CMIP6&dimension=temperature_related&downscale=true&latitude=45.5&longitude=12.5&start_year=2031&end_year=2050&apikey=123456789abcd ``` -------------------------------- ### Current Weather Data Example for meteoblue API Source: https://docs.meteoblue.com/en/weather-apis/forecast-api/introduction An example of the JSON output for the 'Current' weather data package. It includes parameters such as pictocode, time, temperature, wind speed, and daylight information. ```json { "data_current": { "pictocode": 6, "time": "2019-08-20 15:05", "temperature": 14.90, "isdaylight": 1, "windspeed": 1.19, "isobserveddata": 1, "zenithangle": 40.80, "pictocode_detailed": 23 } } ``` -------------------------------- ### GET /packages/multimodeltemperature-1h Source: https://docs.meteoblue.com/en/weather-apis/packages-api/forecast-data Retrieves hourly temperature data from all available models for a specified location. ```APIDOC ## GET /packages/multimodeltemperature-1h ### Description This endpoint provides hourly temperature forecasts derived from a multimodel ensemble. It allows users to analyze the range and consistency of temperature predictions across different weather models, offering insights into forecast uncertainty. ### Method GET ### Endpoint https://my.meteoblue.com/packages/multimodeltemperature-1h ### Parameters #### Query Parameters - **lat** (float) - Required - Latitude of the location. - **lon** (float) - Required - Longitude of the location. - **apikey** (string) - Required - Your unique API key for authentication. ### Request Example ``` https://my.meteoblue.com/packages/multimodeltemperature-1h?lat=47.558&lon=7.573&apikey=DEMOKEY ``` ### Response #### Success Response (200) - **temperature** (object) - Contains temperature data in various units and intervals. - **units** (array) - Available units for temperature (e.g., ["°C", "°F"]). - **interval** (array) - Available forecast intervals (e.g., ["5", "10", "15", "20", "30", "1h"] in minutes or hours). - **data** (array of objects) - Array containing forecast data points, each with timestamp and model-specific values. #### Response Example ```json { "temperature": { "units": ["°C", "°F"], "interval": ["5", "10", "15", "20", "30", "1h"], "data": [ { "time": "2023-10-27T12:00:00Z", "model1_temp_c": 15.5, "model2_temp_c": 16.0, "min_temp_c": 15.0, "max_temp_c": 16.5, "mean_temp_c": 15.75 } // ... more data points ] } } ``` ``` -------------------------------- ### Location Search API - JavaScript AJAX Implementation Example Source: https://docs.meteoblue.com/en/weather-apis/further-apis/location-search-api This snippet illustrates how the meteoblue Location Search API can be integrated into a website using JavaScript and AJAX. It shows a typical implementation where the API is called for each keystroke to provide real-time location suggestions. The example highlights the use of JSONP for cross-domain requests and handling the callback function. ```javascript function searchLocations(query) { // Construct the API URL with the query and API key const apiUrl = `https://www.meteoblue.com/en/server/search/query3?query=${encodeURIComponent(query)}&apikey=DEMOKEY&callback=handleLocationResults`; // Create a script element to load the JSONP response const script = document.createElement('script'); script.src = apiUrl; document.body.appendChild(script); } function handleLocationResults(data) { // Process the location data returned by the API console.log(data); // Update the UI with the search results // ... // Clean up the script element after the callback const script = document.querySelector(`script[src*='${data.query}']`); if (script) { script.remove(); } } // Example usage: Call searchLocations when the user types in an input field // const searchInput = document.getElementById('location-search'); // searchInput.addEventListener('input', (event) => { // searchLocations(event.target.value); // }); ``` -------------------------------- ### PV Pro API Source: https://docs.meteoblue.com/en/weather-apis/packages-api/forecast-data-v2-faq Get solar power production forecasts based on installed capacity (kWp), panel inclination, and orientation. This package also considers panel efficiency and tracker usage. ```APIDOC ## GET /packages/pvpro-1h_pvpro-day ### Description Calculates solar power production forecasts considering factors like kilowatt peak (kWp), panel slope and facing, power efficiency, and tracker status. ### Method GET ### Endpoint https://my.meteoblue.com/packages/pvpro-1h_pvpro-day ### Parameters #### Query Parameters - **lat** (float) - Required - Latitude of the location. - **lon** (float) - Required - Longitude of the location. - **kwp** (float) - Required - Kilowatt peak production capacity. - **slope** (float) - Required - Inclination angle of the solar panel. - **facing** (float) - Required - Orientation angle of the solar panel. - **power_efficiency** (float) - Optional - Power efficiency of the PV module (default: 0.85). - **tracker** (integer) - Optional - Indicates if a sun tracker is used (1 for yes, 0 for no). - **apikey** (string) - Required - Your API key for authentication. ### Request Example ``` https://my.meteoblue.com/packages/pvpro-1h_pvpro-day?lat=47.558&lon=7.573&kwp=1&slope=20&facing=180&power_efficiency=0.9&tracker=1&apikey=DEMOKEY ``` ### Response #### Success Response (200) - **PV Power Production** (float) - Forecasted solar power production. #### Response Example ```json { "PV Power Production": 0.95 } ``` ``` -------------------------------- ### Fetch Historical Data with NEMSAUTO Domain (API) Source: https://docs.meteoblue.com/en/weather-apis/history-api/overview This example shows how to retrieve historical weather data using the NEMSAUTO domain for potentially more consistent time series. It includes parameters for start and end dates, location, variable, and the specific domain. ```url https://my.meteoblue.com/history/point?start=2022-11-01&end=2022-11-02&lat=47.1&lon=8.6&variable=temperature&domain=NEMSAUTO&apikey=DEMOKEY ``` -------------------------------- ### Fetch Historical Temperature Data (API) Source: https://docs.meteoblue.com/en/weather-apis/history-api/overview This example demonstrates how to fetch historical temperature data for a specific location and date range using the meteoblue API. It requires start and end dates, latitude, longitude, the desired variable (temperature), and an API key. ```url https://my.meteoblue.com/history/point?start=2022-11-01&end=2022-11-02&lat=47.1&lon=8.6&variable=temperature&apikey=DEMOKEY ``` -------------------------------- ### Initialization Options Source: https://docs.meteoblue.com/en/weather-apis/maps-api/maps-plugin Configure the meteoblue Maps Plugin with various options during initialization. ```APIDOC ## Initialisation Options **Example:** `new meteoblueMapsPlugin(options: Object)` ### Parameters #### options - **options.mapboxMap** (`Map`) - Required - Reference to a Mapbox GL JS map. - **options.inventory** (`string`) - Required - URL to an inventory JSON. - **options.apiKey** (`string`) - Required - API key for tile calls. - **options.buffer** (`boolean`) - Default: `true` - With buffer enabled, the interface will load the map for the next time step in the background. This feature is experimental. - **options.arrowKeys** (`boolean`) - Default: `false` - Select the next/previous time step with the keyboard arrow keys. - **options.hash** (`boolean`) - Default: `false` - If true, the currently selected map and other information will be stored in the URL hash. Useful, for example, if the user shares the URL on social media. - **options.timezoneOffsetInSeconds** (`number`) - Default: `0` - Time zone offset in seconds. - **options.timezoneAbbreviation** (`string`) - Default: `"UTC"` - Time zone abbreviation to be displayed. Use `timezoneOffsetInSeconds` to actually specify the time zone. - **options.language** (`string`) - Default: `"en"` - The UI language, e.g. for the time selection. This does not affect the menu language, which is set in the Inventory API URL. - **options.direction** (`string`) - Default: `"ltr"` - The writing direction. E.g. use "rtl" for Arabic script. - **options.autoplay** (`boolean`) - Default: `false` - Automatically start playing. Applies only to maps which can be played. - **options.showSidebar** (`boolean | "auto"`) - Default: `"auto"` - Show or hide the sidebar (menu). Use `auto` to show it on large screens and hide it on small ones. - **options.showTimeSelection** (`boolean`) - Default: `true` - Show or hide time selection. - **options.showLegend** (`boolean`) - Default: `true` - Show or hide legend. - **options.showLoadingTime** (`boolean`) - Default: `false` - Show loading/rendering time below loading spinner. - **options.screenshotLogoPath** (`string`) - Optional - Path to logo image displayed on the screenshot. - **options.defaults.map** (`string`) - Default: Map from URL hash, or first map from inventory - The initial map to be shown. - **options.defaults.variant** (`string`) - Default: Map variant from URL hash, or first map variant - The initial map variant to be shown. - **options.defaults.domain** (`string`) - Default: Domain from URL hash, or first domain for the specified map. - The initial domain to be used. - **options.defaults.level** (`string`) - Default: Height level given in URL hash, or first level for the specified map. - The initial height level to be used. - **options.defaults.overlays** (`string[]`) - Default: Overlays from URL hash, or none. - The initially enabled overlays. - **options.canUseRestricted** (`boolean`) - Default: `false` - User can use restricted maps, e.g. paid maps. - **options.restrictedNotice.content** (`string`) - Default: `"Access to this map is restricted."` - Message to show when a map is restricted and user `options.canUseRestricted` is false. - **options.restrictedNotice.actionLabel** (`string`) - Optional - Label for the action button in the restricted notice. - **options.restrictedNotice.action** (`Function: () => void`) - Optional - Function to be attached to action button. - **options.customMenu** (`Array`) - Defaults to menu with entries for screenshot and attribution - Array of menu entry labels and functions or strings. Possible strings are `screenshot`, `attribution` or any URL starting with `http://` or `https://` ` {label: string, action: function | string} `Example:` [{ label: "Take screenshot", action: "screenshot" }, { label: "Say hi", action: () => meteoblueMaps.openModal({ content: "hi" }) }] ` - **options.searchBar.show** (`boolean`) - Enable the search bar. - **options.searchBar.placeHolderText** (`string`) - Optional - Alternative text for the search bar placeholder. Useful for providing translations. - **options.searchBar.noResultsText** (`string`) - Optional - Alternative text when no results matching the search are found. Useful for providing translations. - **options.controls.toggleMenu** (`boolean`) - Default: `true` - Show toggle menu button. - **options.controls.zoom** (`boolean | string`) - Default: `"auto"` - Show/hide zoom button. When set to "auto", buttons are hidden on small screens. - **options.content.top** (`HTMLElement`) - Optional - Element to show in the top-left corner, e.g. a logo. - **options.content.main** (`HTMLElement`) - Optional - Element to show on the map. - **options.content.aboveMenu** (`HTMLElement`) - Optional - Element to show above the menu. - **options.content.belowMenu** (`HTMLElement`) - Optional - Element to show below the menu. - **options.content.belowOptions** (`HTMLElement`) - Optional - Element to show below the options. ``` -------------------------------- ### Initialize meteoblue Maps Plugin with Options Source: https://docs.meteoblue.com/en/weather-apis/maps-api/maps-plugin Instantiate the meteoblue Maps Plugin by providing an options object to configure its behavior. Key parameters include map references, API keys, inventory URLs, and UI customization settings. The plugin supports various boolean and string options to control features like buffering, keyboard navigation, URL hashing, and language. ```javascript const options = { mapboxMap: mapboxMapInstance, inventory: "https://path/to/inventory.json", apiKey: "YOUR_API_KEY", buffer: true, arrowKeys: false, hash: true, timezoneOffsetInSeconds: -3600, timezoneAbbreviation: "EST", language: "en", direction: "ltr", autoplay: false, showSidebar: "auto", showTimeSelection: true, showLegend: true, showLoadingTime: false, screenshotLogoPath: "/path/to/logo.png", defaults: { map: "defaultMap", variant: "defaultVariant", domain: "defaultDomain", level: "defaultLevel", overlays: ["overlay1", "overlay2"] }, canUseRestricted: false, restrictedNotice: { content: "Access to this map is restricted.", actionLabel: "Learn More", action: () => { console.log("Action triggered"); } }, customMenu: [ { label: "Take screenshot", action: "screenshot" }, { label: "Say hi", action: () => meteoblueMaps.openModal({ content: "hi" }) }, { label: "External Link", action: "https://meteoblue.com" } ], searchBar: { show: true, placeHolderText: "Search for a location", noResultsText: "No results found." }, controls: { toggleMenu: true, zoom: "auto" }, content: { top: document.getElementById('top-content'), main: document.getElementById('main-content'), aboveMenu: document.getElementById('above-menu-content'), belowMenu: document.getElementById('below-menu-content'), belowOptions: document.getElementById('below-options-content') } }; const meteoblueMaps = new meteoblueMapsPlugin(options); ``` -------------------------------- ### Retrieve Core Climate Data via API Source: https://docs.meteoblue.com/en/weather-apis/climate-data-api/overview This example demonstrates how to construct a URL to fetch core climate data. It requires specifying decades, meteorological variables, emission scenarios, output format, geographical coordinates, and an API key. Optional parameters include location name and country initials for clearer output filenames. ```HTTP https://climateplus.meteoblue.com/hourly/climate_plus_data/future?decades=2021-2030&variable=Temperature&emission_scenario=SSP1-2.6&output_format=csv&lat=47.55&lon=7.58&location_name=Basel&country_init=CH&apikey=12456789abcd ``` -------------------------------- ### Location Search API - PHP cURL Example Source: https://docs.meteoblue.com/en/weather-apis/further-apis/location-search-api This example shows how to use PHP with cURL to call the Location Search API. It retrieves the latitude, longitude, and elevation for a given location query. ```APIDOC ## POST /en/server/search/query3 (PHP cURL) ### Description This PHP function utilizes cURL to query the Location Search API and retrieve geographical coordinates (latitude, longitude) and elevation for a specified location. These coordinates can then be used for subsequent weather data requests. ### Method POST ### Endpoint https://www.meteoblue.com/en/server/search/query3 ### Parameters #### Path Parameters (Not applicable) #### Query Parameters - **query** (string) - Required - The search term for the location (e.g., "Basel"). - **iso2** (string) - Required - The ISO 3166-1 alpha-2 country code (e.g., "CH"). - **apikey** (string) - Required - Your API key. - **sig** (string) - Required - The signature for the request. #### Request Body (Not applicable, parameters are sent as query parameters) ### Request Example ```php private function getLocationCoords($query = "Basel", $iso2 = "CH", $apikey = "DEMOKEY", $sig = "siuhaefiusf") { $parameters = array("query" => $query, "iso2" => $iso2, "apikey" => $apikey, "sig" => $sig); $url = "https://www.meteoblue.com/en/server/search/query3?"; $url .= http_build_query($parameters); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $json = curl_exec($ch); $data = json_decode($json); $coords = array(); $coords["lat"] = (float)$data->results["0"]->lat; $coords["lon"] = (float)$data->results["0"]->lon; $coords["asl"] = (int)$data->results["0"]->asl; /* * print_r($coords): * Array * ( * [lat] => 47.5582 * [lon] => 7.5881 * [asl] => 260 * ) */ return $coords; } ``` ### Response #### Success Response (200) - **lat** (float) - The latitude of the location. - **lon** (float) - The longitude of the location. - **asl** (integer) - The elevation of the location in meters above sea level. #### Response Example ```json { "lat": 47.5582, "lon": 7.5881, "asl": 260 } ``` ``` -------------------------------- ### Configure PV Power Query (API) Source: https://docs.meteoblue.com/en/weather-apis/history-api/overview This example shows how to set up parameters for fetching photovoltaic (PV) power data. It includes variable-specific parameters such as panel slope, facing direction, peak capacity (kwp), and power efficiency. ```url &slope=20&facing=180&kwp=1&power_efficiency=0.9&tracker=1 ``` -------------------------------- ### Initialize meteoblue Maps Plugin with Mapbox GL JS Source: https://docs.meteoblue.com/en/weather-apis/maps-api/maps-plugin This snippet demonstrates how to load the Mapbox GL JS library and the meteoblue Maps Plugin, then initialize them to display weather maps. It requires an API key and specifies which weather maps to load from the Inventory API. The plugin automatically generates a user interface based on the provided inventory. ```html meteoblue Maps Plugin Example
``` -------------------------------- ### Web Colors Data Example for meteoblue API Source: https://docs.meteoblue.com/en/weather-apis/forecast-api/introduction An example of the JSON output for the 'Web Colors' data package. This package provides color codes for various weather parameters, including temperature and wind speed, for use in web applications. ```json { "data_day": { "temperature_max_color": ["#FCAC05", "#F88D00"], "temperature_max_fontcolor": ["#000000", "#000000"], "temperature_min_color": ["#B5FF33", "#B5FF33"], "temperature_min_fontcolor": ["#000000", "#000000"], "temperature_mean_color": ["#F8DF0B", "#F8DF0B"], "temperature_mean_fontcolor": ["#000000", "#000000"], "felttemperature_max_color": ["#F88D00", "#FC4F00"], "felttemperature_max_fontcolor": ["#000000", "#000000"], "felttemperature_min_color": ["#D8F7A1", "#D8F7A1"], "felttemperature_min_fontcolor": ["#000000", "#000000"], "predictability_class_color": ["#a0ce00", "#4eb400"], "windspeed_max_color": ["#F8F8F8", "#F8F8F8"], "windspeed_mean_color": ["#F8F8F8", "#F8F8F8"], "windspeed_min_color": ["#F8F8F8", "#F8F8F8"] } } ``` -------------------------------- ### General Output Parameters Metadata Example (JSON) Source: https://docs.meteoblue.com/en/weather-apis/forecast-api/overview This JSON snippet demonstrates the structure of the 'metadata' object in the API response. It includes location details, geographical coordinates, timezone information, and model run timestamps. ```json { "metadata": { "name": "Basel", "latitude": 47.56, "longitude": 7.57, "height": 279, "timezone_abbrevation": "CEST", "utc_timeoffset": 2.00, "modelrun_utc": "2019-08-20 00:00", "modelrun_updatetime_utc": "2019-08-20 07:22" } } ``` -------------------------------- ### Sun and Moon Data Example for meteoblue API Source: https://docs.meteoblue.com/en/weather-apis/forecast-api/introduction An example of the JSON output for the 'Sun and Moon' data package. This includes arrays for time, sunrise, sunset, moonrise, moonset, moon phase angle, moon age, and moon phase name. ```json { "data_day": { "time": ["2019-05-14", "2019-05-15"], "sunrise": ["05:52", "05:50"], "sunset": ["20:59", "21:00"], "moonrise": ["15:33", "16:50"], "moonset": ["04:08", "04:35"], "moonphaseangle": [122.50, 135.70], "moonage": [10.05, 11.13], "moonphasename": ["waxing gibbous", "waxing gibbous"] } } ``` -------------------------------- ### GET /packages/multimodelprecipitation-1h Source: https://docs.meteoblue.com/en/weather-apis/packages-api/forecast-data Retrieves hourly precipitation data from all available models for a specified location. ```APIDOC ## GET /packages/multimodelprecipitation-1h ### Description This endpoint provides hourly precipitation forecasts from multiple weather models. It helps in understanding the variability of precipitation predictions across different models, crucial for assessing forecast confidence. ### Method GET ### Endpoint https://my.meteoblue.com/packages/multimodelprecipitation-1h ### Parameters #### Query Parameters - **lat** (float) - Required - Latitude of the location. - **lon** (float) - Required - Longitude of the location. - **apikey** (string) - Required - Your unique API key for authentication. ### Request Example ``` https://my.meteoblue.com/packages/multimodelprecipitation-1h?lat=47.558&lon=7.573&apikey=DEMOKEY ``` ### Response #### Success Response (200) - **precipitation** (object) - Contains precipitation data in various units and intervals. - **units** (array) - Available units for precipitation (e.g., ["mm", "inch"]). - **interval** (array) - Available forecast intervals (e.g., ["5", "10", "15", "20", "30", "1h"] in minutes or hours). - **description** (string) - Description of the precipitation data (e.g., "Water amount"). - **data** (array of objects) - Array containing forecast data points. #### Response Example ```json { "precipitation": { "units": ["mm", "inch"], "interval": ["5", "10", "15", "20", "30", "1h"], "description": "Water amount", "data": [ { "time": "2023-10-27T12:00:00Z", "model1_precip_mm": 0.5, "model2_precip_mm": 0.7, "min_precip_mm": 0.4, "max_precip_mm": 0.8, "mean_precip_mm": 0.6 } // ... more data points ] } } ``` ``` -------------------------------- ### Methods Source: https://docs.meteoblue.com/en/weather-apis/maps-api/maps-plugin Methods available for interacting with the meteoblue Maps Plugin after initialization. ```APIDOC ## Methods ### getMap() Get the currently selected map. #### Return - **map** (`Weather` map object) - The current weather map object from the inventory. ### getVariant() Get the currently selected map variant. #### Return - **variant** (`object`) - The current map variant object from the inventory. ``` -------------------------------- ### HTTP Call for Basic and Agro Forecast Packages Source: https://docs.meteoblue.com/en/weather-apis/forecast-api/introduction Demonstrates how to make an HTTP API call to retrieve both 'basic-1h' and 'agro-1h' weather forecast packages for a specific location using latitude and longitude. The API key 'DEMOKEY' is used for demonstration purposes. ```HTTP https://my.meteoblue.com/packages/basic-1h_agro-1h?lat=47.56&lon=7.57&apikey=DEMOKEY ``` -------------------------------- ### Metadata API Example for CHIRPS2 Dataset Source: https://docs.meteoblue.com/en/weather-apis/dataset-api This snippet shows an example JSON response from the Metadata API for the CHIRPS2 dataset. It includes details like temporal and spatial resolution, data history, and source information. This data is useful for understanding dataset characteristics before making data retrieval calls. ```json { "name": "CHIRPS2", "temporalResolution": "daily", "region": "50S-50N", "spatialResolution": "5.0 km", "historyDataStart": "19810101T0000", "historyDataFinalRun": "20200731T2300", "source": "USGS & CHG", "sourceUrl": "http://chg.geog.ucsb.edu" } ``` -------------------------------- ### Using meteoblue Dataset API with Python (Recommended) Source: https://docs.meteoblue.com/en/weather-apis/dataset-api This section recommends the `meteoblue-dataset-sdk` Python module for interacting with the Dataset API. This library simplifies API access, handles job queues, and manages data decoding using protobuf. ```python # Example usage of meteoblue-dataset-sdk (conceptual) # from meteoblue_dataset_sdk import MeteoblueDataset # api_key = "YOUR_API_KEY" # dataset_api = MeteoblueDataset(api_key) # query_params = { # "units": {"temperature": "C"}, # "geometry": {"coordinates": [[7.57327, 47.558399]]}, # "timeIntervals": ["2023-01-01T00:00/2023-01-01T23:00"], # "queries": [{"domain": "NEMSGLOBAL", "timeResolution": "hourly", "codes": [{"code": 157}]}] # } # data = dataset_api.query(query_params) # print(data) ``` -------------------------------- ### GET /packages/multimodelwinddirection-1h Source: https://docs.meteoblue.com/en/weather-apis/packages-api/forecast-data Retrieves hourly wind direction data from all available models for a specified location. ```APIDOC ## GET /packages/multimodelwinddirection-1h ### Description This endpoint provides hourly wind direction forecasts from multiple weather models. It allows users to analyze the consistency of predicted wind directions and understand forecast uncertainty. ### Method GET ### Endpoint https://my.meteoblue.com/packages/multimodelwinddirection-1h ### Parameters #### Query Parameters - **lat** (float) - Required - Latitude of the location. - **lon** (float) - Required - Longitude of the location. - **asl** (integer) - Optional - Altitude above sea level. - **format** (string) - Optional - Data format (e.g., "json"). - **apikey** (string) - Required - Your unique API key for authentication. ### Request Example ``` https://my.meteoblue.com/packages/multimodelwinddirection-1h?lat=47.558&lon=7.573&asl=279&format=json&apikey=DEMOKEY ``` ### Response #### Success Response (200) - **wind_direction** (object) - Contains wind direction data. - **units** (array) - Available units for wind direction (e.g., ["°"]). - **interval** (array) - Available forecast intervals (e.g., ["5", "10", "15", "20", "30", "1h"] in minutes or hours). - **data** (array of objects) - Array containing forecast data points. #### Response Example ```json { "wind_direction": { "units": ["°"], "interval": ["5", "10", "15", "20", "30", "1h"], "data": [ { "time": "2023-10-27T12:00:00Z", "model1_wind_dir_deg": 270, "model2_wind_dir_deg": 275, "mean_wind_dir_deg": 272.5 } // ... more data points ] } } ``` ```