Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

WARNING: This page has been moved to Access ECMWF Public Datasets.

Include Page
Access ECMWF Public Datasets
Access ECMWF Public Datasets

WARNING: This page has been moved to Access MARS.

Info

Please see Troubleshooting if you are facing any issues.

Installing the client library

See client libraries for a list of all client libraries.

Python

You can install the ecmwfapi python library by running:

Code Block
languagebash
sudo pip install https://software.ecmwf.int/wiki/download/attachments/23694554/ecmwf-api-client-python.tgz

If you cannot run the sudo or pip commands, just download the ecmwf-api-client-python.tgz, extract its content and copy the module ecmwfapi to a directory pointed by the environment variable PYTHONPATH.

Perl

You need to download ecmwf-api-client-perl.tgz, extract its content and to a directory pointed by the environment variable PERL5LIB. This code relies on the JSON perl module, as well as libwww-perl and Crypt::SSLeay.

Java

You need to download ecmwf-api-client-java.tgz. You will also need the Java JSON package.

Installing your API key

Note

The keys from the old data server are not valid for this new service.

 

To access ECMWF you will need an  API key. For that you first need to login at https://apps.ecmwf.int/auth/login/ and then retrieve you key at https://api.ecmwf.int/v1/key/. For this, you will need to have an account on ECMWF web site. If you don't have an account, please self register at https://apps.ecmwf.int/registration/

Copy the information in this page and paste it in the file $HOME/.ecmwfapirc.

Code Block
languagejavascript
titleContent $HOME/.ecmwfapirc
{
    "url"   : "https://api.ecmwf.int/v1",
    "key"   : "XXXXXXXXXXXXXXXXXXXXXX",
    "email" : "john.smith@example.com"
}

Sample scripts

Info

More examples are available at Example data server scripts.

Python

Below is a simple Python script making use of the ecmwfapi library:

Code Block
languagepython
titlePython client
 #!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
 
server = ECMWFDataServer()
 
server.retrieve({
    'dataset' : "tigge",
    'step'    : "24/to/120/by/24",
    'number'  : "all",
    'levtype' : "sl",
    'date'    : "20071001/to/20071003",
    'time'    : "00/12",
    'origin'  : "all",
    'type'    : "pf",
    'param'   : "tp",
    'area'    : "70/-130/30/-60",
    'grid'    : "2/2",
    'target'  : "data.grib"
    })

 Perl

 Below is a simple Perl script making use of the ECMWF::DataServer module:

Code Block
languageperl
titlePerl client
#!/usr/bin/env perl
use ECMWF::DataServer;

my $server = ECMWF::DataServer->new();

$server.retrieve({
    'dataset' : "tigge",
    'step'    : "24/to/120/by/24",
    'number'  : "all",
    'levtype' : "sl",
    'date'    : "20071001/to/20071003",
    'time'    : "00/12",
    'origin'  : "all",
    'type'    : "pf",
    'param'   : "tp",
    'area'    : "70/-130/30/-60",
    'grid'    : "2/2",
    'target'  : "data.grib"
    })

Java 

Code Block
languagejava
import org.ecmwf.DataServer;
import org.json.JSONObject;

public class DataServerExample {
	public static void main(String[] args) throws Exception 
	{

		DataServer server = new DataServer(); 

		JSONObject	request = new JSONObject();
		
		request.put("dataset" , "tigge");
		request.put("step"    , "24/to/120/by/24");
		request.put("number"  , "all");
		request.put("levtype" , "sl");
		request.put("date"    , "20071001/to/20071003");
		request.put("time"    , "00/12");
		request.put("origin"  , "all");
		request.put("type"    , "pf");
        request.put("param"   , "tp");
		request.put("area"    , "70/-130/30/-60");
		request.put("grid"    , "2/2");
		request.put("target"  , "data.grib");

		server.retrieve(request);
	}
}

 

 Choosing a dataset

The "dataset" parameter is one of:

HTML
<table id="datasets_table"></table>
<script src="https://api.ecmwf.int/static/build_dataset_table.js"></script>
<script>
build_dataset_table($("#datasets_table"));
</script>

To access these dataset, you need to agree on the  the corresponding terms and conditions that can be found under the "Licence" link in the table above. See http://apps.ecmwf.int/datasets/ for the content of the datasets. The other parameters are described at: http://www.ecmwf.int/publications/manuals/mars/guide/index.html

Note

ODB datasets (ispd or icoads) require the output format to be specified in the batch request. This is done by using the 'format' batch request keyword. Possible values for the format are: 'odb' for ODB native output, or 'ascii' for the ODB output converted to ASCII. The ASCII output format is provided as a convenience for users with no access to ODB tools.

Proxies

This Perl and Python tools iare will use the http_proxy and https_proxy environment variables if they are set. You should set these variables in your Unix shell if your organisation runs an outgoing proxy. Some older versions also expect HTTP_PROXY and HTTPS_PROXY to be set.

...

Attachmentsuploadfalseoldfalsepatterns*.tgzsortByname