- 积分
- 52
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-9-4
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 Akihabara 于 2025-4-6 11:39 编辑
更新了.cdsapirc文件,还是提示找不到url地址,报错如下。。。有下载成功的同学可以帮忙看看是不是我的.cdsapirc文件配置错误嘛?
另外看之前贴子里有同学说重新注册账号,我重新注册了新的还是相同的错误。。。
In [4]: runfile('D:/ERA5-hgt.py', wdir='D:')
2025-04-06 11:27:22,534 INFO Sending request to https://cds.climate.copernicus.eu/api/resources/reanalysis-era5-pressure-levels
Traceback (most recent call last):
File c:\users\lyt\appdata\local\programs\python\python39\lib\site-packages\cdsapi\api.py:442 in _api
result.raise_for_status()
File c:\users\lyt\appdata\local\programs\python\python39\lib\site-packages\requests\models.py:1021 in raise_for_status
raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: Not Found for url: https://cds.climate.copernicus.eu/api/resources/reanalysis-era5-pressure-levels
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File D:\ERA5-hgt.py:49
client.retrieve(dataset, request).download()
File c:\users\lyt\appdata\local\programs\python\python39\lib\site-packages\cdsapi\api.py:364 in retrieve
result = self._api("%s/resources/%s" % (self.url, name), request, "POST")
File c:\users\lyt\appdata\local\programs\python\python39\lib\site-packages\cdsapi\api.py:464 in _api
raise Exception(error)
Exception: Not Found
.cdsapirc文件配置:
url: https://cds.climate.copernicus.eu/api
key: ab1fcebd-5a8e-4679-a45-61135160ba9e:47378b29-41af-45e8-aad3-6353f3ed79d
下载代码:
import cdsapi
c = cdsapi.Client()
# yyyy = ['1979', '1980', '1981', '1982', '1983', '1984', '1985', '1986', '1987',
# '1988', '1989', '1990', '1991', '1992', '1993', '1994', '1995', '1996',
# '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005',
# '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014',
# '2015', '2016', '2017', '2018', '2019', '2020']
# mm = ['05', '06', '07', '08']
for year in range(1979,2022):
for month in range(1,2):
print(month)
year=year
if month<10:
month='0'+str(month)
filename_str='pv-'+str(year)+'-'+str(month)
print(filename_str)
output="D:/ERA-daily/"+str(filename_str)+".nc"
c.retrieve(
"reanalysis-era5-pressure-levels",
{
"product_type": "reanalysis",
"variable": ["v_component_of_wind"],
"pressure_level": ['100','150','200','250', '300', '400', '500','600', '700', '850', '925', '1000'],
"year" : str(year),
"month": str(month),
"day": [
'01', '02', '03',
'04', '05', '06',
'07', '08', '09',
'10', '11', '12',
'13', '14', '15',
'16', '17', '18',
'19', '20', '21',
'22', '23', '24',
'25', '26', '27',
'28', '29', '30',
'31'
],
"time": ["00:00"],
"data_format": "netcdf",
"download_format": "unarchived",
"area": [90, -180, 0, 180]
},
output)
|
-
|