Skip to content
Snippets Groups Projects
Select Git revision
  • 5d42acdb93faea8fafde509d01e1002a958f7a43
  • master default protected
  • djmdev
  • dev
  • cloud_water_contents
  • 1-download-era5
  • sysinstall
  • origin/task/language-editing
  • task/language-editing
  • feature/makefiles
  • v7.1.2
  • v7.1.1
  • v7.1
  • v7.0.4.1
  • 7.0.4
15 results

python

README

This documentation shows how to use these python scripts to extract ECMWF ERA-Interim data and generate WINDFIELDS for running FLEXPART.

Overview

To run FLEXPART with ECMWF ERA-Interim data, you first need to retrieve ECMWF ERA-Interim GRIB fields and generate FLEXPART WINDFIELDS to run FLEXPART.

The two main programs are called respectively getEIdata.py and prepareFLEXPART.py.

To get the usage of these programs, use -h option:

getEIdata.py -h

Optional arguments are mentionned in squared brackets.

  • getEIdata.py

This program allows you to download ECMWF ERA-Interim data from ECMWF using ecmwfapi. It requires ecmwfapi python library (see Requirements below). Check with your local IT group as it may be already available.

{{{ Usage: getEIdata.py --start_date=YYYYMMDD [--end_date=YYYYMMDD] [--times=tt1/tt2/tt3] [--levels=nlevels] [--area=north/west/south/east] [--outputdir=output_directory]

Options: -h, --help show this help message and exit --start_date=start_date start date YYYYMMDD --end_date=end_date end_date YYYYMMDD --times=times times such as 00/12 --levels=levels number of vertical levels --area=area area defined as north/west/south/east with default 90.0/-179.0/-90.0/180.0 --outputdir=outputdir root directory for storing output files }}}

  • prepareFLEXPART.py

This program allow you to generate FLEXPART WINDFIELDS (inputs for FLEXPART). It requires python interface to grib_api and CONVERT2 program (located in src directory with instruction on how to compile it). You also need to provide a namelist for CONVERT2 (see test_1).

` Usage: prepareFLEXPART.py --start_date=YYYYMMDD [--end_date=YYYYMMDD] [--namelist=namelist_for_convert] [--inputdir=input_root_directory] [--outputdir=output_directory]

Options: -h, --help show this help message and exit --start_date=start_date start date YYYYMMDD --end_date=end_date end_date YYYYMMDD --namelist=namelist namelist used for converting --inputdir=inputdir root directory for reading input files --outputdir=outputdir root directory for storing output files

`

Requirements

Python Support
python
python-numpy
ecmwfapi
Utilities
----------------------:
grib-api
----------------------:
FLEXPART programs
----------------------:

Installation

  • Environment

At UIO, Red Hat 6 Linux systems (64 bits) were used for testing. We use the Module package to set-up user environment.

  • Getting the source code In the directory of your choice:

git clone git@bitbucket.org:flexpart/flexpart.git This command will create a subdirectory called flexpart: it contains the latest FLEXPART version.

Set then environment variable FLEXPART_HOME:

** Korn-shell or Bash users: cd flexpart export FLEXPART_HOME=$PWD

** C-shell users:

cd flexpart setenv FLEXPART_HOME=$PWD

  • Installation

Make sure your first generate CONVERT2 program (see separate instructions in preproc/src).

Users need to be able to execute prepareFLEXPART.py and getEIdata.py so make sure they have the correct unix permissions:

cd preproc/python chmod uog+rx getEIdata.py prepareFLEXPART.py

These two programs must be in the user PATH. At UIO this is done automatically when loading flexpart. If not, you would need to do the following:

** Korn-shell or Bash users: export PATH=$FLEXPART_HOME/preproc/python:$PATH

** C-shell users:

setenv PATH $FLEXPART_HOME/preproc/python:$PATH

Where $FLEXPART_HOME is the directory where FLEXPART

  • Testing your installation

First check that grib-api python interface is correctly installed on your platform: ` python

from gribapi import *

UseCTRL-D` to quit python.

Then check that ecmwfapi is properly installed: ` python

from ecmwfapi import *

`

If the two previous tests were successful, you can run tests/preproc (See separate instructions in tests/preproc).

If any of these two tests fail, this probably means that either ecmwfapi or grib-api have not been installed properly.

Please report any problems.

Installation FAQ