Commit a09cb0e2 authored by Ludvig Isaksson's avatar Ludvig Isaksson
Browse files

Updated CDS examples.

parent 0e4be153
......@@ -6,19 +6,15 @@ The reanalysis data used here were initially produced within the FP7 pre-operati
More information about the reanalyses systems and data can be found at the [UERRA website](http://www.uerra.eu/).
## CDS 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 via the Copernicus Climate Data Store API (CDS API).
All data produced within the Copernicus Climate Change Service regional reanalysis for Europe and the pre-operational UERRA project are publicly available for download. The analyses are listed in the [Copernicus Climate Data Store (CDS)](https://cds.climate.copernicus.eu/cdsapp#!/search?type=dataset&text=uerra) and can be downloaded via the Copernicus Climate Data Store API (CDS API).
The examples provided here use the python CDS API client.
Information about prerequisites for running these examples can be found at the [CDS website](https://cds.climate.copernicus.eu/api-how-to).
The folder ["cds_listed_retrieve_examples"](cds_listed_retrieve_examples/) contains an example python script for retrieving CDS listed data from the Copernicus Climate Change Service regional reanalysis for Europe reanalysis via the CDS API.<br />This is an example of the syntax used for retrieving data that are listed as [CDS datasets](https://cds.climate.copernicus.eu/cdsapp#!/search?type=dataset&text=uerra).<br />
The folder ["cds_retrieve_analyses_examples"](cds_retrieve_analyses_examples/) contains an example python script for retrieving analysis data from the Copernicus Climate Change Service regional reanalysis for Europe via the CDS API.<br />
Modify the date, time and parameter to match your specific needs.
The folder ["cds_unlisted_retrieve_examples"](cds_unlisted_retrieve_examples/) contains example python scripts for retrieving unlisted data from the Copernicus Climate Change Service regional reanalysis for Europe reanalysis via the CDS API.<br />These are examples of the syntax used for retrieving data that are not listed as [CDS datasets](https://cds.climate.copernicus.eu/cdsapp#!/search?type=dataset&text=uerra).<br />
Modify the time, parameters, levels etc. to match your specific needs.
## MARS retrieval examples
All the data produced are still also publicly available for download via the ECMWF MARS system.
All the data produced are publicly available for download via the ECMWF MARS system.
The examples provided here uses the python ECMWF Web-API client.
Information about prerequisites for running these examples can be found at the [ECMWF website](https://software.ecmwf.int/wiki/display/WEBAPI/Access+ECMWF+Public+Datasets).
......
......@@ -5,10 +5,10 @@ import calendar
c = cdsapi.Client()
def retrieve_uerra_eswi():
def retrieve_uerra():
"""
A function to demonstrate how to iterate over several years and months etc
for a particular UERRA request for origin SMHI.
for a particular UERRA request for origin UERRA-HARMONIE.
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.
......@@ -24,17 +24,18 @@ def retrieve_uerra_eswi():
requestDates = ['{:02}'.format(i) for i in range(1, numberOfDays+1)]
requestMonth = '{:02}'.format(month)
requestYear = '{:04}'.format(year)
uerra_eswi_request(requestYear, requestMonth, requestDates, targetFile)
uerra_request(requestYear, requestMonth, requestDates, targetFile)
def uerra_eswi_request(reqYear, reqMonth, reqDates, target):
def uerra_request(reqYear, reqMonth, reqDates, target):
"""
A UERRA request for 2 metre temperature every 6th hour.
Origin SMHI, surface level, analysis fields.
Origin uerra_harmonie, surface level, analysis fields.
Request cost per day is 4 fields, 1.8 Mbytes.
"""
c.retrieve(
'reanalysis-uerra-single-levels',
'reanalysis-uerra-europe-single-levels',
{
'format':'grib',
'variable':'2m_temperature',
......@@ -42,9 +43,9 @@ def uerra_eswi_request(reqYear, reqMonth, reqDates, target):
'month':reqMonth,
'day':reqDates,
'time':['00:00','06:00','12:00','18:00'],
'origin':'smhi'
'origin':'uerra_harmonie'
},
target)
if __name__ == '__main__':
retrieve_uerra_eswi()
retrieve_uerra()
# CDS listed 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 via the Copernicus Climate Data Store API (CDS API).
This is an example of retrieving UERRA data from one of the [CDS listed datasets](https://cds.climate.copernicus.eu/cdsapp#!/search?type=dataset&text=uerra). For retrieving UERRA data that are not listed in the CDS, use the examples in the ["cds_unlisted_retrieve_examples"](./../cds_unlisted_retrieve_examples/) folder.
# CDS analyses 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 analyses data from one of the [CDS listed datasets](https://cds.climate.copernicus.eu/cdsapp#!/search?type=dataset&text=uerra). Please note that only the analyses are available via CDS. All other data (e.g. hourly forecasts) must be downloaded via the ECMWF MARS system. See examples in the ["mars_retrieve_examples"](./../mars_retrieve_examples/) folder.
Before running this script it is recommended to explore the available data and the corresponding CDS API requests by browsing the [CDS datasets](https://cds.climate.copernicus.eu/cdsapp#!/search?type=dataset&text=uerra).
Then modify the time, parameters, levels etc. in the script to match your specific needs.
Then modify the time, parameter and data origin in the script to match your specific needs.
The example provided here uses the python CDS API client.
Information about prerequisites for running this example can be found at the [CDS website](https://cds.climate.copernicus.eu/api-how-to).
......
#!/usr/bin/env python
import cdsapi
import calendar
c = cdsapi.Client()
def retrieve_uerra_lfpw():
"""
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 'target' 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]
lastDate = '%04d%02d%02d' % (year, month, numberOfDays)
target = "ofile_%04d%02d.grb" % (year, month)
requestDates = (startDate + "/TO/" + lastDate)
uerra_lfpw_request(requestDates, target)
def uerra_lfpw_request(requestDates, target):
"""
A UERRA request for 2 metre temperature every 6 hours.
Origin Meteo France, surface level, analysis fields.
Request cost per day is 4 fields, 8.7 Mbytes.
"""
c.retrieve(
'reanalysis-uerra-complete',
{
'class':'ur',
'stream':'oper',
'type':'an',
'dataset':'uerra',
'step':'6',
'origin':'lfpw',
'date': requestDates,
'expver':'prod',
'levtype':'sfc',
'param':'167',
'time':'00/06/12/18'
},
target)
if __name__ == '__main__':
retrieve_uerra_lfpw()
#!/usr/bin/env python
import cdsapi
import calendar
c = cdsapi.Client()
def retrieve_uerra_eswi():
"""
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 'target' 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]
lastDate = '%04d%02d%02d' % (year, month, numberOfDays)
target = "ofile_%04d%02d.grb" % (year, month)
requestDates = (startDate + "/TO/" + lastDate)
uerra_eswi_request(requestDates, target)
def uerra_eswi_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-complete',
{
'class':'ur',
'stream':'oper',
'type':'fc',
'dataset':'uerra',
'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_eswi()
#!/usr/bin/env python
import cdsapi
import calendar
c = cdsapi.Client()
def retrieve_uerra_lfpw():
"""
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 'target' 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]
lastDate = '%04d%02d%02d' % (year, month, numberOfDays)
target = "ofile_%04d%02d.grb" % (year, month)
requestDates = (startDate + "/TO/" + lastDate)
uerra_lfpw_request(requestDates, target)
def uerra_lfpw_request(requestDates, target):
"""
A UERRA request for total precipitation every 24 hours at 06 UTC.
Origin Meteo France, surface level, analysis fields.
Request cost per day is 1 field, 2.2 Mbytes.
"""
c.retrieve(
'reanalysis-uerra-complete',
{
'class':'ur',
'stream':'oper',
'type':'an',
'dataset':'uerra',
'origin':'lfpw',
'date': requestDates,
'expver':'prod',
'levtype':'sfc',
'param':'228228',
'time':'06'
},
target)
if __name__ == '__main__':
retrieve_uerra_lfpw()
# CDS unlisted 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 via the Copernicus Climate Data Store API (CDS API).
These are example scripts for retrieving UERRA data that are not included in the [CDS listed datasets](https://cds.climate.copernicus.eu/cdsapp#!/search?type=dataset&text=uerra).
The request syntax is based on the ECMWF MARS retrieval system. Before running these scripts it is recommended to explore the available data and the corresponding MARS requests via Web-MARS:<br />
[UERRA-HARMONIE data in Web-MARS](http://apps.ecmwf.int/datasets/data/uerra/levtype=sfc/stream=oper/type=an/)<br />
[MESCAN-SURFEX data in Web-MARS](http://apps.ecmwf.int/datasets/data/uerra-mescan-surfex/levtype=sfc/stream=oper/type=an/)<br />
Then modify the time, parameters, levels etc. in the scripts to match your specific needs.
The examples provided here use the python CDS API client.
Information about prerequisites for running these examples can be found at the [CDS website](https://cds.climate.copernicus.eu/api-how-to).
## 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-climate-change-service-regional-reanalysis-europe).
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