1 | # README # |
---|
2 | |
---|
3 | This documentation shows how to use these python scripts to extract ECMWF ERA-Interim data and generate WINDFIELDS for running FLEXPART. |
---|
4 | |
---|
5 | ### Overview ### |
---|
6 | |
---|
7 | 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. |
---|
8 | |
---|
9 | The two main programs are called respectively `getEIdata.py` and `prepareFLEXPART.py`. |
---|
10 | |
---|
11 | To get the usage of these programs, use `-h` option: |
---|
12 | |
---|
13 | `getEIdata.py -h` |
---|
14 | |
---|
15 | Optional arguments are mentionned in squared brackets. |
---|
16 | |
---|
17 | * `getEIdata.py` |
---|
18 | |
---|
19 | This program allows you to download ECMWF ERA-Interim data from ECMWF using [ecmwfapi](https://software.ecmwf.int/wiki/display/WEBAPI/ECMWF+Web+API+Home). |
---|
20 | It requires `ecmwfapi` python library (see Requirements below). Check with your local IT group as it may be already available. |
---|
21 | |
---|
22 | |
---|
23 | {{{ |
---|
24 | Usage: getEIdata.py --start_date=YYYYMMDD [--end_date=YYYYMMDD] [--times=tt1/tt2/tt3] [--levels=nlevels] |
---|
25 | [--area=north/west/south/east] [--outputdir=output_directory] |
---|
26 | |
---|
27 | Options: |
---|
28 | -h, --help show this help message and exit |
---|
29 | --start_date=start_date |
---|
30 | start date YYYYMMDD |
---|
31 | --end_date=end_date end_date YYYYMMDD |
---|
32 | --times=times times such as 00/12 |
---|
33 | --levels=levels number of vertical levels |
---|
34 | --area=area area defined as north/west/south/east with default |
---|
35 | 90.0/-179.0/-90.0/180.0 |
---|
36 | --outputdir=outputdir |
---|
37 | root directory for storing output files |
---|
38 | }}} |
---|
39 | |
---|
40 | * `prepareFLEXPART.py` |
---|
41 | |
---|
42 | 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). |
---|
43 | |
---|
44 | ` |
---|
45 | Usage: prepareFLEXPART.py --start_date=YYYYMMDD [--end_date=YYYYMMDD] [--namelist=namelist_for_convert] [--inputdir=input_root_directory] [--outputdir=output_directory] |
---|
46 | |
---|
47 | Options: |
---|
48 | -h, --help show this help message and exit |
---|
49 | --start_date=start_date |
---|
50 | start date YYYYMMDD |
---|
51 | --end_date=end_date end_date YYYYMMDD |
---|
52 | --namelist=namelist namelist used for converting |
---|
53 | --inputdir=inputdir root directory for reading input files |
---|
54 | --outputdir=outputdir |
---|
55 | root directory for storing output files |
---|
56 | |
---|
57 | ` |
---|
58 | ### Requirements ### |
---|
59 | |
---|
60 | | Python Support | |
---|
61 | |----------------------:| |
---|
62 | | python | [http://www.python.org](http://www.python.org) | We have use [python Anaconda](https://store.continuum.io/cshop/anaconda/) for our testings |
---|
63 | | python-numpy | [http://www.numpy.org/](http://www.numpy.org/) | Not necessary if you have installed python Anaconda |
---|
64 | | ecmwfapi | [https://software.ecmwf.int/wiki/display/WEBAPI/ECMWF+Web+API+Home](https://software.ecmwf.int/wiki/display/WEBAPI/ECMWF+Web+API+Home) | You also need to install your API key (as explained in the documentation) |
---|
65 | | Utilities | |
---|
66 | |----------------------:| |
---|
67 | | grib-api | [https://software.ecmwf.int/wiki/display/GRIB/Home](https://software.ecmwf.int/wiki/display/GRIB/Home) | Make sure you install GRIB-API with JPEG support and python GRIB-API. |
---|
68 | |----------------------:| |
---|
69 | | FLEXPART programs | to run these programs (prepareFLEXPART.py), you need to compile CONVERT2 program (located in preproc/src). See separate README file to get instructions on how to compile this code. |
---|
70 | |----------------------:| |
---|
71 | |
---|
72 | |
---|
73 | ### Installation ### |
---|
74 | |
---|
75 | * Environment |
---|
76 | |
---|
77 | At UIO, Red Hat 6 Linux systems (64 bits) were used for testing. We use the [Module package](http://modules.sourceforge.net/) to set-up user environment. |
---|
78 | |
---|
79 | * Getting the source code |
---|
80 | In the directory of your choice: |
---|
81 | |
---|
82 | ` |
---|
83 | git clone git@bitbucket.org:flexpart/flexpart.git |
---|
84 | ` |
---|
85 | This command will create a subdirectory called flexpart: it contains the latest FLEXPART version. |
---|
86 | |
---|
87 | Set then environment variable `FLEXPART_HOME`: |
---|
88 | |
---|
89 | ** Korn-shell or Bash users: |
---|
90 | ` |
---|
91 | cd flexpart |
---|
92 | export FLEXPART_HOME=$PWD |
---|
93 | ` |
---|
94 | |
---|
95 | ** C-shell users: |
---|
96 | |
---|
97 | ` |
---|
98 | cd flexpart |
---|
99 | setenv FLEXPART_HOME=$PWD |
---|
100 | ` |
---|
101 | |
---|
102 | * Installation |
---|
103 | |
---|
104 | Make sure your first generate `CONVERT2` program (see separate instructions in `preproc/src`). |
---|
105 | |
---|
106 | Users need to be able to execute prepareFLEXPART.py and getEIdata.py so make sure they have the correct unix permissions: |
---|
107 | |
---|
108 | ` |
---|
109 | cd preproc/python |
---|
110 | chmod uog+rx getEIdata.py prepareFLEXPART.py |
---|
111 | ` |
---|
112 | |
---|
113 | 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: |
---|
114 | |
---|
115 | ** Korn-shell or Bash users: |
---|
116 | ` |
---|
117 | export PATH=$FLEXPART_HOME/preproc/python:$PATH |
---|
118 | ` |
---|
119 | |
---|
120 | ** C-shell users: |
---|
121 | |
---|
122 | ` |
---|
123 | setenv PATH $FLEXPART_HOME/preproc/python:$PATH |
---|
124 | ` |
---|
125 | |
---|
126 | Where `$FLEXPART_HOME` is the directory where FLEXPART |
---|
127 | |
---|
128 | * Testing your installation |
---|
129 | |
---|
130 | First check that grib-api python interface is correctly installed on your platform: |
---|
131 | ` |
---|
132 | python |
---|
133 | >>> from gribapi import * |
---|
134 | >>> |
---|
135 | ` |
---|
136 | Use `CTRL-D` to quit python. |
---|
137 | |
---|
138 | Then check that `ecmwfapi` is properly installed: |
---|
139 | ` |
---|
140 | python |
---|
141 | >>> from ecmwfapi import * |
---|
142 | >>> |
---|
143 | ` |
---|
144 | |
---|
145 | If the two previous tests were successful, you can run `tests/preproc` (See separate instructions in `tests/preproc`). |
---|
146 | |
---|
147 | If any of these two tests fail, this probably means that either `ecmwfapi` or `grib-api` have not been installed properly. |
---|
148 | |
---|
149 | Please report any problems. |
---|
150 | |
---|
151 | ### Installation FAQ ### |
---|
152 | |
---|