Furthermore, the ~/.cdsapirc file is ok to work with, but would it not just be possible to promt for user credentials if the file does not exist (or its contents are invalid), after which the cdsapi toolbox generates/retrieves the apikey and saves the ~/.cdsapirc file?
You will not have to update the URL in your .cdsapirc files in the immediate future. …there should be no impact to users when we switch from CDS-Beta to CDS in September as both CDS-Beta and CDS urls will continue to co-exist for longer
If you have not set up your CDS API credentials with a ~/.cdsapirc file, it is still possible to provide the credentials when initialising the cdsapi.Client. like here:
# If you have not set up your CDS API credentials with a ~/.cdsapirc file,
# it is possible to provide the credentials when initialising the cdsapi.Client.
if os.path.isfile("~/.cdsapirc"):
cdsapi_kwargs = {}
else:
URL = 'https://cds.climate.copernicus.eu/api/v2'
KEY = '##################################'
cdsapi_kwargs = {
'url': URL,
'key': KEY,
}
'data_format': 'netcdf',
# if you are looking sub-region extraction
'area': [90, -180, -90, 180]
# if you are looking to grid (interpolated)
'grid': '0.5/0.5',
# for original grid
# 'grid': 'original_grid',