Skip to content

Repository files navigation

dClimate Client Audit

Small harness that runs the JS and Python dClimate clients against the same inputs and compares their outputs. It is file-based on purpose so it can run in CI without extra services.

Layout

  • cases/ – JSON files with the scenarios to run.
  • index.js – Orchestrator that runs JS locally and shells out to Python.
  • js-runner.js / py_runner.py – Thin wrappers around the two clients.

Prerequisites

  • This folder should live next to the two client repos: ../dclimate-client-js and ../dclimate-client-py.
  • Node 18+ and Python 3.11+.
  • JavaScript deps via Yarn (uses local file reference): yarn install.
  • Python deps via uv (from the Python client repo): cd ../dclimate-client-py && uv sync --extra dev --extra testing. The harness calls uv run, so make sure uv is on your PATH.

Running

cd client-audit
yarn compare # uses cases/sample-cases.json
node index.js cases/my.json

If a case fails you will see per-field diffs plus a quick stats preview for each side.

Case format

[
{
"name": "era5-2m-temperature-point",
"request": {
"collection": "era5",
"dataset": "2m_temperature",
"variant": "finalized"
},
"selection": {
"point": { "latitude": 40.875, "longitude": -104.875 },
"timeRange": {
"start": "2023-01-01T00:00:00Z",
"end": "2023-01-02T00:00:00Z"
}
},
"variable": "2m_temperature",
"precision": 6,
"tolerance": 1e-6,
"js": {
"gatewayUrl": "https://ipfs-gateway.dclimate.net",
"cid": null,
"autoConcatenate": false
},
"python": {
"gateway_base_url": "https://ipfs-gateway.dclimate.net",
"rpc_base_url": "https://ipfs-gateway.dclimate.net",
"cid": null
}
}
]
  • request matches the client constructors.
  • selection.point and selection.timeRange are applied in order to keep the result small.
  • variable falls back to the dataset name or the first data var if not found.
  • precision controls rounding during record extraction; tolerance controls comparison strictness.
  • js/python blocks are optional overrides for gateways or direct CID.

How it compares

  • Loads the dataset in each language.
  • Applies the selection (point, then time range).
  • Extracts numeric values for the chosen variable and computes simple stats (count/mean/min/max/sample).
  • Compares metadata fields (collection/dataset/variant/cid/source/url) and the stats within tolerance.

CI idea

Add a GitHub Action matrix job that:

  1. Checks out this repo plus the two clients.
  2. Runs yarn install in client-audit.
  3. Sets up Python, installs the client deps with uv sync --extra dev --extra testing in dclimate-client-py.
  4. Runs yarn compare.

About

This performs checks to ensure the data retrieved from the dclimate-client-js and dclimate-client-py retrieve identical results

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages