Commit 7badb3cc authored by Ludvig Isaksson's avatar Ludvig Isaksson
Browse files

cds complete added

parent 18450d18
#!/usr/bin/env python
import cdsapi
import calendar
c = cdsapi.Client()
def retrieve_uerra():
"""
A function to demonstrate how to iterate efficiently over several years and months etc
for a particular UERRA request for origin SMHI.
Change the variables below to adapt the iteration to your needs.
You can use the variable 'targetFile' to organise the requested data in files as you wish.
In the example below the data are organised in files per month.
"""
yearStart = 2016
yearEnd = 2016
monthStart = 1
monthEnd = 12
for year in list(range(yearStart, yearEnd + 1)):
for month in list(range(monthStart, monthEnd + 1)):
startDate = '%04d%02d%02d' % (year, month, 1)
numberOfDays = calendar.monthrange(year, month)[1]
requestDates = ['{:04}'.format(year)+'{:02}'.format(month)+'{:02}'.format(i) for i in range(1, numberOfDays+1)]
targetFile = "ofile_%04d%02d.grb" % (year, month)
uerra_request(requestDates, targetFile)
def uerra_request(requestDates, target):
"""
A UERRA request for 2 metre temperature every hour.
Origin SMHI, surface level, forecast fields.
Request cost per day is 24 fields, 11 Mbytes.
"""
c.retrieve(
'reanalysis-uerra-europe-complete',
{
'class':'ur',
'database':'external',
'stream':'oper',
'format':'grib',
'type':'fc',
'step':'1/2/3/4/5/6',
'origin':'eswi',
'date': requestDates,
'expver':'prod',
'levtype':'sfc',
'param':'167',
'time':'00/06/12/18'
},
target)
if __name__ == '__main__':
retrieve_uerra()
#!/usr/bin/env python
import cdsapi
import calendar
c = cdsapi.Client()
def retrieve_uerra():
"""
A function to demonstrate how to iterate efficiently over several years and months etc
for a particular UERRA request for origin Meteo France.
Change the variables below to adapt the iteration to your needs.
You can use the variable 'targetFile' to organise the requested data in files as you wish.
In the example below the data are organised in files per month.
"""
yearStart = 2015
yearEnd = 2015
monthStart = 1
monthEnd = 12
for year in list(range(yearStart, yearEnd + 1)):
for month in list(range(monthStart, monthEnd + 1)):
startDate = '%04d%02d%02d' % (year, month, 1)
numberOfDays = calendar.monthrange(year, month)[1]
requestDates = ['{:04}'.format(year)+'{:02}'.format(month)+'{:02}'.format(i) for i in range(1, numberOfDays+1)]
targetFile = "ofile_%04d%02d.grb" % (year, month)
uerra_request(requestDates, targetFile)
def uerra_request(requestDates, target):
"""
A UERRA request for snow depth every hour.
Origin Meteo France, surface level, forecast fields.
Request cost per day is 24 fields, 46.1 Mbytes.
"""
c.retrieve(
'reanalysis-uerra-europe-complete',
{
'class':'ur',
'database':'external',
'stream':'oper',
'format':'grib',
'type':'fc',
'step':'1/2/3/4/5/6',
'origin':'lfpw',
'date': requestDates,
'expver':'prod',
'levtype':'sfc',
'param':'3066',
'time':'00/06/12/18'
},
target)
if __name__ == '__main__':
retrieve_uerra()
# CDS forecast data retrieval examples
All data produced within the Copernicus Climate Change Service regional reanalysis for Europe and the pre-operational UERRA project are publicly available for download.
This is an example of retrieving UERRA forecast data from datasets that are not available for direct download via the [CDS web form](https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-uerra-europe-complete?tab=form).
Before running these scripts it is recommended to read the [information at the CDS website](https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-uerra-europe-complete?tab=form).
## General information
This project contains example code for users of the Copernicus Climate Change Service regional reanalysis for Europe (C3S_322_Lot1) data.
More information about the service can be found at the [Copernicus Climate Change Service regional reanalysis for Europe website](https://climate.copernicus.eu/copernicus-regional-reanalysis-europe-cerra).
The reanalysis data were initially produced within the FP7 pre-operational UERRA project.
More information about the reanalyses systems and data can be found at the [UERRA website](http://www.uerra.eu/).
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment