Computational Science Community Wiki

Revision 1 as of 2014-01-24 17:29:24

Clear message

ECMWF Meterology, and how to get it.

This page details the methods used to download meterology data from ECMWF, both from their website, and from their data servers.

26/02/12: New server, new scripts are needed for batch access

The new server for batch access has changed the system slightly from the old one. To run, go to: https://software.ecmwf.int/wiki/display/WEBAPI/Accessing+ECMWF+data+servers+in+batch Register to get the token and key. Put this into a file in you home directory called: .ecmwfapirc

 {
    "url"   : "https://api.ecmwf.int/v1",
    "key"   : "###############",
    "email" : "XXXX@YYYY.ac.uk"
 }

Then register for particular database by clicking on relavent link (e.g. for interim data) Set up your environment following instructions on the website e.g.  export PYTHONPATH=/Users/scott_a_n/ecmwf-api-client-python  Run script to download data:

   1 #!/usr/bin/env python
   2 
   3 import time
   4 from datetime import date
   5 
   6 # export PYTHONPATH = /usr/bin/ecmwfapi
   7 from ecmwfapi import ECMWFDataServer
   8  
   9 server = ECMWFDataServer()
  10 
  11 # Set dates for data extraction - SAMBBA campaign period
  12 idate = date(2012,07,01)
  13 edate = date(2012,10,31)
  14 
  15 while (idate <= edate):
  16 
  17     iyear = idate.year
  18     imonth = idate.month
  19     iday = idate.day
  20 
  21     strdate = "%d%02d%02d" % (iyear, imonth, iday)
  22     print strdate   
  23 
  24     # extract 3D data
  25     server.retrieve({
  26         'dataset' : "interim",
  27         'step'    : "0",
  28         'levtype' : "pl",
  29         'levelist': "all",
  30         'date'    : strdate,
  31         'time'    : "00/06/12/18",
  32         'origin'  : "all",
  33         'type'    : "an",
  34         'param'   : "129/130/131/132/157",
  35         'grid'    : "128",
  36         'target'  : "pl_"+strdate+".grib"
  37         })
  38 
  39     # extract surface data
  40     server.retrieve({
  41         'dataset' : "interim",
  42         'step'    : "0",
  43         'levtype' : "sfc",
  44         'date'    : strdate,
  45         'time'    : "00/06/12/18",
  46         'origin'  : "all",
  47         'type'    : "an",
  48         'param'   : "172/134/151/165/166/167/168/235/33/34/31/141/139/170/183/236/39/40/41/42",
  49         'grid'    : "256", # use higher resolution surface data
  50         'target'  : "sfc_"+strdate+".grib"
  51         })
  52 
  53     # move to next day
  54     
  55     idate = idate.replace(day=idate.day + 1)
  56 
  57 print "End."

ECMWF Meterology (Old)

Access

Access to ECMWF met files can be applied for from here: http://www.ecmwf.int/about/computer_access_registration/forms/ Contact at ECMWF is Roddy Sharp (roddy[dot]sharp[at]metoffice[dot]gov[dot]uk)

Obtaining Data

Example script:

to be added...

ECMWF Meterology (New Batch Access)

Beta batch access to the ECMWF Interim data fields are now available. The webpage access for this service is here: http://data-portal.ecmwf.int/data/d/interim_daily - here you can register for access to the data, which will give you your own token associated with your email address.

Example python and perl scripts are provided by the website, as well as the communication modules. On hyperbar the perl scripts have been saved in /usr/local/share/perl. One difference with the old method is that we don't know how to extract surface and volume data in the same file. Some modifications will be needed for the WPS scripts (see next page).

Example script:

   1 #!/usr/bin/perl -I/usr/local/share/perl
   2 use ECMWF::DataServer;
   3 use Date::Calc qw(Add_Delta_Days Delta_Days);
   4 no strict;
   5 
   6 my $client = ECMWF::DataServer->new(
   7     portal => 'http://data-portal.ecmwf.int/data/d/dataserver/',
   8     token  => 'xxxxxxxxxxxxxxxxxxxxxx',
   9     email  => 'xxxxxx@xxxxxxxx',
  10 );
  11 
  12 # set dates for data extraction - summer RONOCO 
  13 @date = (2011,01,12);
  14 @enddate = (2011,01,25);
  15 
  16 while (Delta_Days(@date,@enddate) >= 0){
  17         $year = @date[0];
  18         $month = @date[1];
  19         $day = @date[2];
  20         $datestr=sprintf("%d-%02d-%02d",$year,$month,$day);
  21         
  22         # extract volume data
  23         $client->retrieve(
  24                 dataset => "interim_full_daily",
  25                 date => "$datestr",
  26                 time => "00/06/12/18",
  27                 step => "0",
  28                 levtype => "pl",
  29                 levelist => "all",
  30                 area => "70/-30/30/20",
  31                 type => "an",
  32                 grid => "128",
  33                 param => "129/130/131/132/157",
  34                 target => "pl_${datestr}.grb",
  35         );
  36 
  37         # extract surface data
  38         $client->retrieve(
  39                 dataset => "interim_full_daily",
  40                 date => "$datestr",
  41                 time => "00/06/12/18",
  42                 step => "0",
  43                 levtype => "sfc",
  44                 area => "70/-30/30/20",
  45                 type => "an",
  46                 grid => "128",
  47                 param => "172/134/151/165/166/167/168/235/33/34/31/141/139/170/183/236/39/40/41/42",
  48                 target => "sfc_${datestr}.grb",
  49         );
  50         # move to next day
  51         ($year,$month,$day) = Add_Delta_Days($year,$month,$day,1);
  52         @date=($year,$month,$day);
  53 
  54 }