I am trying to get time series data for a specific place (latitude and longitude) for different weather elements from the CDS datapool. Therefore, I am using the cdsapi package and can run queries such as:

import cdsapi
import xarray as xr

# settings
filename = "here.nc"

# request
c = cdsapi.Client()
res = c.retrieve(
        "product_type": "reanalysis",
        "variable": "2m_temperature",
        "year": "2019",
        "month": "01",
        "day": "01",
        "time": [
        "format": "netcdf",

nc = xr.open_dataset(filename, decode_cf=False)
df = nc.to_dataframe().reset_index(drop=False)

This can easily be extended to more time points, but not as easily to places (even the returned latitude and longitude coordinates sometimes do are unreasonable). If I understand correctly the netcdf data is already interpolated, but there is no parameter to specify a distinct place (only area and grid). Because I have to query several places all over the world and want to go a few years back with hourly/daily resolution, querying large grids will not work.

Does anybody have an idea how to get the data for a specific place? If possible, I would like to keep my tooling Python only, but happy to use other packages or try other solutions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.