Output formats
The response shape is controlled by two parameters:
output-format—json(inline) ornetcdf(a downloadable file).output-schema— for JSON,list(pandas-friendly) orxarray(an xarray Dataset dict).
output-format |
output-schema |
Result |
|---|---|---|
json |
list (default) |
Array of per-point objects; load with pandas |
json |
xarray |
A single xarray Dataset dict |
netcdf |
— | JSON envelope with a pre-signed URL to a NetCDF4 file |
All timestamps are ISO 8601 strings. With timezone=UTC (default) they end in Z; with
another timezone they carry that UTC offset.
JSON — list (pandas)
Returns an array with one object per queried point. Each object has ref_datetime,
valid_datetime, and one array per requested variable, all the same length. (For a single
point requested as scalar latitude/longitude, a single object may be returned instead of
a one-element array.)
[
{
"ref_datetime": ["2023-08-01T00:00:00Z", "2023-08-01T00:00:00Z"],
"valid_datetime": ["2023-08-01T00:00:00Z", "2023-08-01T01:00:00Z"],
"Temperature": [17.4, 17.1],
"WindSpeed": [5.2, 5.0]
}
]
import requests, pandas as pd
resp = requests.get(
"https://api.rebase.energy/weather/v2/point/historical",
headers={"Authorization": "your_api_key"},
params={
"model": "DWD_ICON-EU",
"latitude": "60.1, 59.3",
"longitude": "16.5, 18.1",
"variables": "Temperature, WindSpeed",
"start-date": "2023-08-01",
"end-date": "2023-08-03",
},
)
points = resp.json()
dfs = [pd.DataFrame(p) for p in points] # one DataFrame per point
df0 = dfs[0].set_index(["ref_datetime", "valid_datetime"])
print(df0.head())
Column names match exactly what you requested, including levels — e.g. requesting
WindSpeed:100 yields a WindSpeed:100 column.
JSON — xarray
With output-schema=xarray the response is a single xarray Dataset serialized via
Dataset.to_dict() (attrs / dims / coords / data_vars). This is the natural choice
for grids (type=grid). Dimensions include point, reference_time, valid_time, and,
where applicable, latitude / longitude / height.
import requests, xarray as xr
resp = requests.get(
"https://api.rebase.energy/weather/v2/area/operational",
headers={"Authorization": "your_api_key"},
params={
"model": "DWD_ICON-EU",
"latitude": "60.0, 60.5, 61.0",
"longitude": "16.0, 16.5, 17.0",
"variables": "Temperature",
"output-schema": "xarray",
},
)
ds = xr.Dataset.from_dict(resp.json())
print(ds)
NetCDF (pre-signed URL)
For large requests, set output-format=netcdf. The response is a small JSON envelope with a
pre-signed download URL rather than the data inline:
{
"file": "https://api.rebase.energy/weather/v2/download/eyJ0eXAi...",
"create_time": "2026-06-30T08:21"
}
- The
fileURL is generated on demand and expires (default ~1 week). - The file may still be building when the envelope returns. Either poll the
fileURL (it returns404until ready,200when complete) or passwait=trueto have the API block until the file is fully generated before responding. - Large queries are expected to use this format rather than inline JSON.
import requests, xarray as xr
resp = requests.get(
"https://api.rebase.energy/weather/v2/area/historical",
headers={"Authorization": "your_api_key"},
params={
"model": "DWD_ICON-EU",
"latitude": "60.0, 61.0",
"longitude": "16.0, 17.0",
"variables": "Temperature, WindSpeed",
"start-date": "2023-08-01",
"end-date": "2023-08-31",
"output-format": "netcdf",
"wait": "true",
},
)
file_url = resp.json()["file"]
# Download and open
nc = requests.get(file_url)
with open("forecast.nc", "wb") as f:
f.write(nc.content)
ds = xr.open_dataset("forecast.nc")
print(ds)