Commit 0e4be153 authored by Ludvig Isaksson's avatar Ludvig Isaksson
Browse files

CDS retrieval scripts added.

parent 2929ca15
......@@ -5,8 +5,20 @@ This project contains example code for users of the Copernicus Climate Change Se
The reanalysis data used here were initially produced within the FP7 pre-operational UERRA project.<br />
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).
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 />
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 data produced within the Copernicus Climate Change Service regional reanalysis for Europe and the pre-operational UERRA project is publicly available for download via the ECMWF MARS system.
All the data produced are still also 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).
......
#!/usr/bin/env python
import cdsapi
import calendar
c = cdsapi.Client()
def retrieve_uerra_eswi():
"""
A function to demonstrate how to iterate 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 = 2015
yearEnd = 2015
monthStart = 1
monthEnd = 12
for year in list(range(yearStart, yearEnd + 1)):
for month in list(range(monthStart, monthEnd + 1)):
numberOfDays = calendar.monthrange(year, month)[1]
targetFile = "ofile_%04d%02d.grb" % (year, month)
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)
def uerra_eswi_request(reqYear, reqMonth, reqDates, target):
"""
A UERRA request for 2 metre temperature every 6th hour.
Origin SMHI, surface level, analysis fields.
Request cost per day is 4 fields, 1.8 Mbytes.
"""
c.retrieve(
'reanalysis-uerra-single-levels',
{
'format':'grib',
'variable':'2m_temperature',
'year':reqYear,
'month':reqMonth,
'day':reqDates,
'time':['00:00','06:00','12:00','18:00'],
'origin':'smhi'
},
target)
if __name__ == '__main__':
retrieve_uerra_eswi()
# 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.
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.
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).
## 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/).
#!/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/).
# MARS retrieval examples
All data produced within the Copernicus Climate Change Service regional reanalysis for Europe and the pre-operational UERRA project is publicly available for download via the ECMWF MARS system. These are example python scripts for retrieving temperature and 24 hour precipitation data. Please note that these requests can result in the retrieval of a lot of data.
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 ECMWF MARS system. These are example python scripts for retrieving temperature and 24 hour precipitation data. Please note that these requests can result in the retrieval of a lot of data.
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 uses the python ECMWF Web-API client.
The examples provided here use 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).
The examples are based on the [UERRA SMHI retrieval efficiency Web-API example](https://software.ecmwf.int/wiki/display/WEBAPI/UERRA+SMHI+retrieval+efficiency).
......
# MARS retrieval examples
All data produced within the Copernicus Climate Change Service regional reanalysis for Europe and the pre-operational UERRA project is publicly available for download via the ECMWF MARS system. These are example python scripts for retrieving all the datasets within the reanalysis. Please note that these requests can result in the retrieval of a lot of data. The scripts are provided as a complete base showing all available data.
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 ECMWF MARS system. These are example python scripts for retrieving all the datasets within the reanalysis. Please note that these requests can result in the retrieval of a lot of data. The scripts are provided as a complete base showing all available data.
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 uses the python ECMWF Web-API client.
The examples provided here use 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).
The examples are based on the [UERRA SMHI retrieval efficiency Web-API example](https://software.ecmwf.int/wiki/display/WEBAPI/UERRA+SMHI+retrieval+efficiency).
......
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