Standalone tooling for downloading GHM timeseries data.
The repository currently includes a script for downloading the latest forecast for a list of PFAF IDs, and is structured so additional scripts can be added over time.
- Calls
/subProjectIdsfor the root project. - Picks the subproject with the largest timestamp (latest forecast).
- Calls bulk
/ghm-timeseries/tsIdsfor requested PFAF IDs. - Saves each series to CSV in the output folder.
download_latest_forecast.py: standalone CLI script for latest forecast downloaddhi-ghm-downloader/src/: reusable package modules (api,forecast,pfaf, dataframe helpers)pixi.toml: Pixi environment and run tasksrequirements.txt: optional pip dependency file
pixi install--project-id is required.
At least one PFAF input is required:
--pfaf-ids--pfaf-file
If neither is provided, the script exits with an input error:
Input error: Provide PFAF IDs with --pfaf-ids and/or --pfaf-file
Use space-separated PFAF IDs:
pixi run python download_latest_forecast.py --api-key <YOUR_API_KEY> --project-id <ROOT_PROJECT_ID> --pfaf-ids 136320200000 219730300000Use list-style PFAF IDs:
pixi run python download_latest_forecast.py --api-key <YOUR_API_KEY> --project-id <ROOT_PROJECT_ID> --pfaf-ids "[136320200000,219730300000]"Use PFAF IDs from file:
pixi run python download_latest_forecast.py --api-key <YOUR_API_KEY> --project-id <ROOT_PROJECT_ID> --pfaf-file pfaf_ids_example.txtUse predefined Pixi task:
pixi run download_latest --api-key <YOUR_API_KEY> --project-id <ROOT_PROJECT_ID> --pfaf-file pfaf_ids_example.txtRequired arguments:
--api-key--project-id- At least one of:
--pfaf-idsor--pfaf-file
Optional arguments:
--pfaf-ids--pfaf-file--base-url(default:https://wrd-mike-cloud-performance-statistics.azurewebsites.net/api)--environment(default:prod)--timeout(default:60)--outdir(default:output_latest_forecast)
To keep Pixi usage consistent as more Python scripts are added:
- Add the script at repository root (or preferred scripts folder).
- Register a dedicated task in
pixi.toml, for example:
[tasks]
download_latest = "python download_latest_forecast.py"
download_historical = "python download_historical_forecast.py"- Run with the same pattern:
pixi run <task_name> --<script-args>Keep the generic python = "python" task for ad hoc script execution.