3

I want to access ECMWF data via a python script. I am not sure how to do that. I followed the instruction given on the website: Accessing ECMWF data server in batch

Unfortunately it says: "This method is only supported to UNIX platforms with Python." I am on a Windows platform. Does that mean I can't access the data from ECMWF? If this method is only for UNIX-Users only, is there an alternative for Windows-User?

So far I did the following:

created textfile in my homedirectory with content: C:\User\Name\ .ecmwfapirc.txt

{
  "url"   : "https://api.ecmwf.int/v1",
  "key"   : "my-API-code",
  "email" : "my.email@example.com"
}

Next I installed python library: ecmwfapi

python -m pip install https://software.ecmwf.int/wiki/download/attachments/56664858/ecmwf-api-client-python.tgz

Last but not least I created the python script which looks like:

 #!/usr/bin/env python
 from ecmwfapi import ECMWFDataServer
 server = ECMWFDataServer()
 server.retrieve({
     "class": "e2",
     "dataset": "era20c",
     "date": "2010-01-01/to/2010-12-31",
     "expver": "1",
     "levtype": "sfc",
     "param": "167.128",
     "stream": "oper",
     "time": "12:00:00",
     "type": "an",
     "target": "CHANGEME",
 })

I am not sure if the python script is correct either. Also I don't know whether the location of the python script is important when executed.

3
  • have you followed all of the instructions? installing the libraries? do you have an api key? also, UNIX platform - what operating system are you on?
    – albert
    Sep 30, 2016 at 19:15
  • I added some details what i did so far. Unfortunately I am on a windows platform
    – obrob
    Oct 1, 2016 at 6:28
  • according to them this is not going to work then. sorry.
    – albert
    Oct 1, 2016 at 13:36

2 Answers 2

2

I know this topic is six months old, but for reference: the ECMWF API is now supported on Windows. Please see here for details

The OP created a file '.ecmwfapirc.txt'. This is wrong, it has to be named '.ecmwfapirc' (without extension).

From what I can see your retrieval script is correct. There is a web interface to help you create your retrieval script: http://apps.ecmwf.int/datasets/ At the end click 'View MARS request'

The location of the retrieval script script does not matter; only if you save the output to the same location, the location has to be writeable.

2

You can create a UNIX environment from Windows by several ways.

  • Cygwin

    is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment. (source)

  • Run Linux in VirtualBox. VirtualBox is a free and open-source cross-platform software (among others) that runs other operating systems from inside of another. In your Windows computer, you would install VirtualBox. Then, pick a Linux distribution (e.g. Ubuntu) and install that operating system inside VirtualBox. Here's a guide for Ubuntu.

  • Run Ubuntu Linux from a USB stick. After you make the bootable USB stick, you choose to boot from that device at startup. Then you have a Linux enviroment, although each time you restart, you'll have to re-configure the network connection, etc.

All 3 methods will have standard python installed. You'll have to install the ECMWF client yourself. If your project is longer-lasting, you may considering buying some low-cost, used hardware and running something dedicated. Additionally, Linux cloud instances are very cheap, and even free for 12 months from some providers (AWS) and can be as cheap as $3 per month for other cloud providers.

1
  • @obrob - Please post if your results for others, if you make any progress.
    – philshem
    Oct 5, 2016 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.