{"id":23778446,"url":"https://github.com/tebben/kanemi","last_synced_at":"2026-05-10T03:43:55.262Z","repository":{"id":267095400,"uuid":"898641244","full_name":"tebben/kanemi","owner":"tebben","description":"Tools for working with KNMI and some other data","archived":false,"fork":false,"pushed_at":"2024-12-31T17:57:25.000Z","size":11106,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T18:29:32.185Z","etag":null,"topics":["cli","grib","hdf5","knmi","netcdf","nowcast","pdok","rust","svelte","tauri"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tebben.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-04T18:58:55.000Z","updated_at":"2024-12-31T17:57:28.000Z","dependencies_parsed_at":"2024-12-31T18:37:20.270Z","dependency_job_id":null,"html_url":"https://github.com/tebben/kanemi","commit_stats":null,"previous_names":["tebben/knmi-nowcast","tebben/kanemi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebben%2Fkanemi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebben%2Fkanemi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebben%2Fkanemi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tebben%2Fkanemi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tebben","download_url":"https://codeload.github.com/tebben/kanemi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239972943,"owners_count":19727459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","grib","hdf5","knmi","netcdf","nowcast","pdok","rust","svelte","tauri"],"created_at":"2025-01-01T09:11:11.051Z","updated_at":"2026-04-08T22:30:16.402Z","avatar_url":"https://github.com/tebben.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" style=\"width: 100%;background-color: hotpink;\"\u003e\n  \u003cimg height=\"90\" src=\"https://github.com/tebben/knmi-nowcast/blob/main/static/logo.png?raw=true\"\u003e\n\u003c/p\u003e\n\nThe goal of kanemi is to provide libraries and tools to work more easily with KNMI api's and data.\n\n\u003e Warning: LOOK MA! I'M DOING RUST!!!! (This repo is a learning project for Rust, no guarantees for the quality)\n\n## Testimonials\n\n- \"I'm not sure what this is, but it looks cool\" - Mom\n- \"Since I started using kanemi, my wife and dog moved back in with me\" - TheDude22\n- \"kanemi told me it was going to rain. I went out without an umbrella. It didn’t rain. So... thanks for making me look like an idiot.\" - StevenSeagul\n- \"kanemi: Finally, a way to make forecasts as accurate as flipping a coin.\" - NotImpressed44\n- \"LET'S GO!!! PRICIPITATION FORECASTING AND MUCH MORE WITH KANEMI, BABY!!!\" - SteveBall\n\n## Datasets\n\nKanemi tries to provide easy access to the following datasets\n\n### Nowcast precipitation forecast\n\n[Nowcast precipitation forecast](https://dataplatform.knmi.nl/dataset/radar-forecast-2-0) up to 2 hours ahead, per 5 minutes, over the Netherlands. The forecast contains 25 time steps: +0 minutes to +120 minutes. Forecasted is the precipitation sum per 5 minutes, on a grid of 1x1 km. The forecast is made with an operational KNMI implementation of pySTEPS. The forecast is initiated with the KNMI 5-minute real-time precipitation accumulation product: RTCOR-5m.\n\n### HARMONIE-AROME Cy43 forecasts Netherlands (P1)\n\nHARMONIE information in gridded form (regular lat-lon) of near surface and boundary layer (up to 300 m) parameters from the UWC-West HARMONIE-AROME Cy43 model. For this weather forecast model, KNMI works closely with Iceland, Denmark and Ireland on local short-term weather forecasts under the name \"United Weather Centres-West\" (UWC-West). An international project team is working on a joint Numerical Weather Prediction model (NWP), procurement and management of the HPC (supercomputer) and infrastructure. The output frequency is 1 hour.\n\n### Meteo data - actual synoptic observations\n\nKNMI collects observations from the automatic weather stations situated in the Netherlands and BES islands on locations such as aerodromes and North Sea platforms. In addition, wind data from KNMI wind poles are included. The weather stations report every 10 minutes meteorological parameters such as temperature, relative humidity, wind, air pressure, visibility, precipitation and cloud cover. The number of parameters differs per station. The file for the past 10-minutes is available a few minutes later. It is possible that a station's observations may not be immediately available. Files are updated with missing data up to 4 hours later.\n\n## Features\n\nThis repo consists of multiple libraries and tools. Everythng is work in progress.\n\n### Library kanemi\n\n- Working with KNMI Data Platform\n- Receiving notifications from the KNMI notification service\n- Nowcast precipitation forecast\n  - Load dataset from HDF5\n  - Projection conversion between HDF5 grid and EPSG:4326 (both directions)\n  - Read image data and their time attribute\n  - Get pixel values and mm/hr for a specific location (xy/lonlat)\n  - Get 2hr precipitation forecast for a specific location (lonlat)\n- Actual synoptic observations\n  - Load dataset from netCDF\n  - Get all stations and their observations\n  - Get closest station with observations and distance for a given location (lonlat)\n- Harmonie Cy43 P1\n  - Grib v1 reader optimized for Cy43 P1\n  - Load dataset from a list of GRIB files, a directory containing GRIB files or directly from a .tar file\n  - Get forecast for location(s) with optional requested parameters and time horizon\n  - Get available parameters and their units\n  - Experimental: flow field image generation from wind u/v components\n\n\u003cp align=\"center\" style=\"width: 100%\"\u003e\n  \u003cimg src=\"static/flow_field.jpg\" alt=\"drawing\" width=\"600\"/\u003e\n\u003c/p\u003e\n \n\n### Library pdok_geocoder\n\n- Geocode free text search\n- Reverse geocode lonlat/rd\n\n### CLI tool kanecli\n\n- Download KNMI data from the KNMI Data Platform\n- Get notifications from the KNMI notification service\n- Get precipitation forecast for a specific location\n- Get Harmonie Cy43 P1 forecast for a specific location\n- Geocode and reverse geocode locations in the Netherlands\n\n### App\n\n- Desktop app using Tauri and Svelte (work in progress)\n\n## Roadmap\n\n- Desktop app using Tauri and Svelte\n- Make CLI better and add more features\n- Geocoder: Lookup, suggets\n- More datasets\n- Webservice/API\n\n## Prerequisites\n\n### HDF5\n\nHDF5 library is required to run and build knmi-nowcast. Install it with:\n\n```bash\nsudo apt install libhdf5-dev\n```\n\n### KNMI API key\n\n#### Open Data API\nTo fetch the nowcast data, you need an API key from the KNMI. You can find more information [here](https://developer.dataplatform.knmi.nl/open-data-api#token). An anonymous key is available on the mentioned page aswell.\n\n#### Notifications\n\nFor the notifications service a different API key is needed and can be requested like the Open Data API key.\n\n## kanecli - CLI Tool\n\nEvery command accepts it's own set of args, check the args with the `--help` flag on an option.\nThe CLI tool contains some useful commands but not eveything from the libraries in this repo is available in the CLI tool.\n\nTo install kanecli, clone the repository and build the project with cargo. This will install the binary in the cargo bin directory (usually `~/.cargo/bin`).\n\n```bash\ngit clone https://github.com/tebben/kanemi.git\ncd kanemi\ncargo install --path kanecli\nkenecli -h\n```\n\n```bash\nA CLI tool to work with KNMI api's and some datasets may contain some other stuff aswell\n\nUsage: kanecli \u003cCOMMAND\u003e\n\nCommands:\n  download               Download KNMI data from the Open Data API\n  nowcast-precipitation  Dataset: Nowcast precipitation (2 hour precipitation forecast)\n  harmonie-cy43p1        Dataset: Harmonie CY43 P1 (60 hours weather forecast for the Netherlands)\n  notifications          Receive messages from the KNMI notification service on new data availability\n  geocoder               Geocode or reverse geocode a location using the PDOK Locatieserver\n  help                   Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help\n  -V, --version  Print version\n```\n\n### Download\n\nDownload a dataset from the KNMI Data Platform. The dataset name and version can be found on the KNMI Data Platform. The command will return a JSON message\nwith a success flag and the path to the downloaded file if downloaded successfully. At this moment only the latest dataset can be downloaded.\nSoon an option will be added to keep listening for notifications and keep downloading datasets when they are available.\n\n```bash\nDownload KNMI data from the Open Data API\n\nUsage: kanecli download [OPTIONS] --api-key \u003cAPI_KEY\u003e --name \u003cNAME\u003e --version \u003cVERSION\u003e\n\nOptions:\n  -a, --api-key \u003cAPI_KEY\u003e    API key for the KNMI Open Data API [env: KNMI_API_KEY_OPEN_DATA]\n  -d, --dir \u003cDIR\u003e            Output directory for the forecast data [default: ./output]\n  -f, --filename \u003cFILENAME\u003e  The name to use for saving the file, leave black to use original name\n  -n, --name \u003cNAME\u003e          The name of the dataset as found on the KNMI Open Data API\n  -v, --version \u003cVERSION\u003e    The version of the dataset as found on the KNMI Open Data API\n  -h, --help                 Print help (see more with '--help')\n```\n\n#### Example: Download the latest nowcast precipitation forecast\n\n```bash\nkanecli download -a \u003cyour-api-key\u003e -d ./output -n radar_forecast -v 2.0\n```\n\n```JSON\n{\n  \"success\": true,\n  \"data\": \"./output/RAD_NL25_RAC_FM_202501031440.h5\"\n}\n```\n\n### Nowcast precipitation forecast\n\n```bash\nPrint the precipitation forecast from input file or a newly downloaded KNMI dataset\n\nUsage: kanecli nowcast-precipitation [OPTIONS] --api-key \u003cAPI_KEY\u003e --location \u003cLOCATION\u003e\n\nOptions:\n  -a, --api-key \u003cAPI_KEY\u003e        API key for the KNMI Open Data API [env: KNMI_API_KEY_OPEN_DATA=]\n  -l, --location \u003cLOCATION\u003e      Location as a comma-separated string \"longitude,latitude\" [env: KNMI_LOCATION=]\n  -o, --output-dir \u003cOUTPUT_DIR\u003e  Output directory for the forecast data [default: ./output]\n  -i, --input-file \u003cINPUT_FILE\u003e  Input file to load, new file will be downloaded if not provided\n  -h, --help                     Print help (see more with '--help')\n```\n\n#### Example: Load the nowcast precipitation h5 file from disk and get the forecast for a given location\n\n```bash\nkanecli nowcast-precipitation -i ./example_data/RAD_NL25_RAC_FM_202412222055.h5 -l 4.91978668,52.36648685\n```\n\n#### Example: Download the latest dataset to ./output and get the precipitation forecast for a location\n\nSince the latest dataset is downloaded you need to provide the api-key.\n\n```bash\nkanecli nowcast-precipitation -a \u003cyour-api-key\u003e -o ./output -l 4.91978668,52.36648685\n```\n\n### Harmonie CY43 P1\n\n```bash\nkanecli harmonie-cy43p1 -h\n\nDataset: Harmonie CY43 P1 (60 hours weather forecast for the Netherlands)\nUsage: kanecli harmonie-cy43p1 \u003cCOMMAND\u003e\n\nCommands:\n  forecast    Get forecast data for a location\n  parameters  Get all available parameters\n  help        Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help  Print help\n```\n\n```bash\nkanecli harmonie-cy43p1 forecast -h\n\nGet forecast data for a location\nUsage: kanecli harmonie-cy43p1 forecast [OPTIONS] --input \u003cINPUT\u003e --locations \u003cLOCATIONS\u003e\n\nOptions:\n  -i, --input \u003cINPUT\u003e            file or list of files, a directory or tar file\n  -l, --locations \u003cLOCATIONS\u003e    Locations in the format 'longitude,latitude'\n  -p, --parameters \u003cPARAMETERS\u003e  Parameters in the format 'name,level'\n  -H, --hours \u003cHOURS\u003e            The max forecast hours to return\n  -h, --help                     Print help (see more with '--help')\n```\n\n#### Example: Get all available parameters\n\nWhen running forecast we can supply which parameters we want to get. With the parameters command we get some insight in what parameters are available.\nTo pass parameters to the forecast command we need to know the short_name and level of the parameter.\n\n```bash\nkanecli harmonie-cy43p1 parameters\n```\n\n```JSON\n[\n  {\n    \"code\": 20,\n    \"short_name\": \"vis\",\n    \"description\": \"Visibility\",\n    \"units\": \"m\",\n    \"level_type\": \"HeightAboveGround\",\n    \"level\": 0,\n    \"time_range_indicator\": \"Instant\",\n    \"has_bmp\": false,\n    \"byte_index\": null\n  },\n  ...\n]\n```\n\n#### Example: Get Harmonie Cy43 P1 forecast for a location.\n\nA few examples how to get the forecast for a location.\n\n```bash\n# Load from directory containing GRIB files, get temperature at level 0 and 50 for the given location with a maximum of 2 hours ahead\nkanecli harmonie-cy43p1 forecast -i ~/Downloads/grib -p tmp,0 -p tmp,50 -l 5.351926,51.7168 -H 2\n\n# Mulitple parameters can be supplied within -p and locations can contain multiple lonlat pairs, remove -H to get all available hours\nkanecli harmonie-cy43p1 forecast -i ~/Downloads/grib -p 'tmp,0 tmp,50 vis,0' -l '5.351926,51.7168 4.123,52.123'\n\n# You can also supply a single grib file or multiple files instead of a folder\nkanecli harmonie-cy43p1 forecast -i ./example_data/HA43_N20_202412221800_00000_GB -p tmp,0 -l 5.351926,51.7168\nkanecli harmonie-cy43p1 forecast -i 'file1 file2 file3 file4' -p tmp,0 -l 5.351926,51.7168\n\n# Or if you just download a fresh .tar file from the KNMI Data Platform you can load it directly\n# Data will be extracted to a temporary directory and is cleaned up when the dataset is dropped\nkanecli harmonie-cy43p1 forecast -i ~/Downloads/HARM43_V1_P1_2024122218.tar -p tmp,0 -l 5.351926,51.7168\n```\n\n```bash\n{\n  \"results\": [\n    {\n      \"location\": [\n        4.123,\n        52.123\n      ],\n      \"parameters\": [\n        {\n          \"name\": \"tmp\",\n          \"level\": 0,\n          \"values\": [\n            {\n              \"datetime\": \"2024-12-22T18:00:00Z\",\n              \"value\": 281.86865234375\n            },\n            {\n              \"datetime\": \"2024-12-22T19:00:00Z\",\n              \"value\": 281.868408203125\n            }\n          ]\n        },\n        ...\n      ]\n    },\n    ...\n  ]\n}\n```\n\n### Dataplatform notifications\n\n```bash\nReceive messages from the KNMI notification service on new data availability\n\nUsage: kanecli notifications [OPTIONS] --api-key \u003cAPI_KEY\u003e --name \u003cNAME\u003e --version \u003cVERSION\u003e\n\nOptions:\n  -a, --api-key \u003cAPI_KEY\u003e      API key for the KNMI Notification Service [env: KNMI_API_KEY_NOTIFICATION]\n  -n, --name \u003cNAME\u003e            The name of the dataset as found on the KNMI Open Data API\n  -v, --version \u003cVERSION\u003e      The version of the dataset as found on the KNMI Open Data API\n  -c, --client-id \u003cCLIENT_ID\u003e  Unique client id for the notification service [env: KNMI_CLIENT_ID_NOTIFICATION=]\n  -h, --help                   Print help (see more with '--help')\n```\n\n#### Example: Receive notifications for the radar_forecast dataset version 2.0 (nowcast precipitation)\n\nIt can take some time before the first notification is received depending on the dataset.\nThe connection stays open until closed by the user. On disconnect it will try to reconnect and a JSON message is returned with parameter success false.\n\n```bash\nkanecli notifications -a \u003cyour-api-key\u003e --dataset-name radar_forecast --dataset-version 2.0\n```\n\n```JSON\n{\n  \"success\": true,\n  \"topic\": \"dataplatform/file/v1/radar_forecast/2.0/created\",\n  \"data\": {\n    \"specversion\": \"1.0\",\n    \"type\": \"nl.knmi.dataplatform.file.created.v1\",\n    \"source\": \"https://dataplatform.knmi.nl\",\n    \"id\": \"4c7ae265-f55a-30f1-4a12-4c72f1cd9f5c\",\n    \"time\": \"2025-01-03T14:57:16Z\",\n    \"datacontenttype\": \"application/json\",\n    \"data\": {\n      \"datasetName\": \"radar_forecast\",\n      \"datasetVersion\": \"2.0\",\n      \"filename\": \"RAD_NL25_RAC_FM_202501031455.h5\",\n      \"url\": \"https://api.dataplatform.knmi.nl/open-data/v1/datasets/radar_forecast/versions/2.0/files/RAD_NL25_RAC_FM_202501031455.h5/url\"\n    }\n  }\n}\n```\n\n### PDOK Geocoder\n\n```bash\nkanecli geocoder -h\n\nGeocode or reverse geocode a location using the PDOK Locatieserver\nUsage: kanecli geocoder \u003cCOMMAND\u003e\n\nCommands:\n  free     Classic geocoding using free text, check kanecli geocoder free --help for more information\n  reverse  Reverse geocoding\n  help     Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help  Print help\n```\n\n```bash\nkanecli geocoder free -h\n\nClassic geocoding using free text, check kanecli geocoder free --help for more information\nUsage: kanecli geocoder free [OPTIONS] --q \u003cQ\u003e\n\nOptions:\n  -q, --q \u003cQ\u003e            Search query. Example: `museumplein 1 amsterdam`\n      --best-match       Get and return only the best match\n      --fl \u003cFL\u003e          Comma separated list of fields to return\n      --fq \u003cFQ\u003e          Query to filter results see --help for more information and examples\n      --start \u003cSTART\u003e    Start row, default 0 used for pagination\n      --rows \u003cROWS\u003e      Amount of rows to return, default 10, max 100\n      --lonlat \u003cLONLAT\u003e  Sorting will done on distance for given coordinates, format --lonlat \"5.12, 52.09\"\n      --df \u003cDF\u003e          Default search field\n      --sort \u003cSORT\u003e      Sort order of the results, default: score desc\n      --bq \u003cBQ\u003e          Boost fields for score calculation, see --info for more info\n  -h, --help             Print help (see more with '--help')\n```\n\n```bash\nkanecli geocoder reverse -h\n\nReverse geocoding\nUsage: kanecli geocoder reverse [OPTIONS]\n\nOptions:\n      --lonlat \u003cLONLAT\u003e      Longitude and latitude coordinates to reverse geocode, format --lonlat \"5.12, 52.09\"\n      --rd \u003cRD\u003e              The RD coordinates to reverse geocode, format --rd \"122000, 487000\"\n      --best-match           Get and return only the best match\n      --fl \u003cFL\u003e              Comma separated list of fields to return\n      --fq \u003cFQ\u003e              Query to filter results see --help for more information and examples\n      --start \u003cSTART\u003e        Start row, default 0 used for pagination\n      --rows \u003cROWS\u003e          Amount of rows to return, default 10, max 100\n      --types \u003cTYPES\u003e        Types to return, see --help for more information\n      --distance \u003cDISTANCE\u003e  Max search distance in meters\n  -h, --help                 Print help (see more with '--help')\n```\n\n#### Example: Geocode a location using the PDOK Locatieserver, filter on address type and return only the best match.\n\n```bash\nkanecli geocoder free -q \"museumstraat 1 Amsterdam\" --fq \"type:adres\" --best-match\n```\n\n#### Example: Reverse geocode, find the 5 best adres matches for the given lonlat within 15 meters.\n\n```bash\nkanecli geocoder reverse --lonlat \"4.887295127944717,52.36849110206849\" --rows 5 --distance 15\n```\n\n### Extra's\n\n#### Example: Chaining geocoding and cy43p1 forecast. Get a location and return the 5 hour cy43p1 forecast for the given location.\n\n```bash\nkanecli geocoder free -q \"den bosch\" --best-match | \\\njq -r '.centroide_ll | \"\\(.x),\\(.y)\"' | \\\nxargs -I {} kanecli cy43p1 forecast -i ~/Downloads/HARM43_V1_P1_2024122218.tar -l '{}' -p 'tmp,0' -H 5\n```\n\n## Building the CLI\n\n```bash\ncargo build --release\n```\n\n## App\n\nTesting creating an app using Tauri with Svelte\n\n```sh\ncd app\ncargo tauri dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftebben%2Fkanemi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftebben%2Fkanemi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftebben%2Fkanemi/lists"}