Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
239 views
in Technique[技术] by (71.8m points)

python - cdsapi era5 download to computer

I have some data I'd like to download from the era5 model via the cdsapi package:

import cdsapi

c = cdsapi.Client()

url = c.retrieve(
    'reanalysis-era5-single-levels',
    {
        'product_type': 'reanalysis',
        'format': 'grib',
        'variable': 'total_precipitation',
        'year': '2021',
        'month': '01',
        'day': '01',
        'time': '00:00',
    },
    'download.grib')

Has this downloaded the the grib file to my computer or has it been created and saved to CDS's site?

If I print url:

Result(content_length=2076600,content_type=application/x-grib,location=https://download-0004.copernicus-climate.eu/cache-compute-0004/cache/data2/adaptor.mars.internal-1612475135.0349507-29868-7-7ed52a50-6bc6-493b-8b3e-92ac91518fd0.grib)

If it's just been saved to that online location is there any way to skip that step and download the data direclty to the computer in that same c.retrieve call?

question from:https://stackoverflow.com/questions/66054515/cdsapi-era5-download-to-computer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It has been downloaded to your computer, probably to same folder where you run your srript from.

You can also specify different location if you put custom full path instead of 'download.grib'. File can also be found on cds portal in your requests section


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...