import cdsapi import xarray as xr # settings filename = "here.nc" # request c = cdsapi.Client() res = c.retrieve( "reanalysis-era5-single-levels", { "product_type": "reanalysis", "variable": "2m_temperature", "year": "2019", "month": "01", "day": "01", "time": [ "00:00", ], "format": "netcdf", }, filename, ) nc = xr.open_dataset(filename, decode_cf=False) df = nc.to_dataframe().reset_index(drop=False) print(df)
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.