我想通过 cdsapi 包从era5下载一些数据。
我知道大多数数据可以通过使用 cdsapi.Client.retrieve 函数下载。例如我可以在堆栈溢出中找到很多示例(cdsapiera5 下载到计算机)。 但是,我想要的数据是统计数据(https://cds.climate.copernicus.eu/cdsapp#!/software/app-c3s-daily-era5-statistics?tab=app),并且提供了它们通过 ERA5 每日统计计算器,并可根据 ERA5 每日统计用户指南通过 CDS API 下载 (https://datastore.copernicus-climate.eu/documents/app-c3s-daily-era5-statistics/C3S_Application-Documentation_ERA5 -每日统计-v2.pdf)。因此,在阅读完指南后,我使用了以下 python 脚本来下载,并且它起作用了。然而,这里唯一的问题是我得到的数据具有随机文件名,并且很难找到某个文件。
1.所以我想知道是否有什么方法可以在下载数据时自己设置下载文件名
`
import cdsapi
c = cdsapi.Client(timeout=600)
YEARS = range(1950,1951)
MONTHS = ["01","02","03","04","05","06","07","08","09","10","11","12"]
for year in YEARS:
for month in MONTHS:
result = c.service(
"tool.toolbox.orchestrator.workflow",
params={
"realm": "user-apps",
"project": "app-c3s-daily-era5-statistics",
"version": "master",
"kwargs": {"dataset": "reanalysis-era5-single-levels",
"product_type": "reanalysis",
"variable": "2m_temperature",
# "variable": {"2m_temperature", "2m_dewpoint_temperature", "10m_u_component_of_wind", "10m_v_component_of_wind"},
"statistic": "daily_mean",
"year": year,
"month": month,
"time_zone": "UTC+00:00",
"frequency": "1-hourly",
"grid": "0.25/0.25",
"area": {"lat": [25.15265, 52.84375], "lon": [-124.59375, -67.03125]}
},
"workflow_name": "application"
})
c.download(result)
你需要
c.download(result,["filename"])
确保文件名在列表中(我认为这是他们的一个小故障)