This MWE
from pathlib import Path
from metocean_api import ts
# Pick a tiny time window to keep requests small
start_time = "2020-01-01"
end_time = "2020-01-02"
# Your approx Akkasæter bbox centre (from your error log)
lon = 18.48
lat = 69.062
# ERA5 in metocean-api; docs list product='ERA5' as valid. [2](https://metocean-api.readthedocs.io/en/stable/)[3](https://metocean-api.readthedocs.io/en/latest/index.html)
product = "ERA5"
# Keep it minimal: one variable (2m temperature)
variable = ["2m_temperature"]
out_csv = Path("era5_point.csv").resolve()
ts_data = ts.TimeSeries(
lon=lon,
lat=lat,
start_time=start_time,
end_time=end_time,
product=product,
variable=variable,
datafile=None,
)
# Match your pattern: set .datafile then import
ts_data.datafile = str(out_csv)
# This is the call that, in your case, ends up raising HTTPError 400 via requests
ts_data.import_data(save_csv=True, save_nc=False, use_cache=True)
Produces the error
The job has failed
The 'format' key for requests is deprecated, please use 'data_format' instead. Use of 'format' is no longer part of the system testing, therefore it is not guaranteed to work.
This was produced with Python 3.11.15 and metocean-api 1.1.12.
This MWE
Produces the error
This was produced with Python 3.11.15 and metocean-api 1.1.12.