source: flex_extract.git/Documentation/html/_sources/Installation/local.rst.txt @ e0005c9

Last change on this file since e0005c9 was e0005c9, checked in by anphi <anne.philipp@…>, 4 years ago

removed jasper from local makefile output in docu

  • Property mode set to 100644
File size: 14.1 KB
Line 
1***********************
2Local mode installation
3***********************
4
5.. role:: underline
6    :class: underline
7   
8.. toctree::
9    :hidden:
10    :maxdepth: 2
11         
12   
13.. _Python3: https://www.python.org/
14.. _Anaconda Python3: https://www.anaconda.com/distribution/
15.. _numpy: http://www.numpy.org/
16.. _ecmwf-api-client: https://confluence.ecmwf.int/display/WEBAPI/ECMWF+Web+API+Home
17.. _cdsapi: https://cds.climate.copernicus.eu/api-how-to
18.. _genshi: https://genshi.edgewall.org/
19.. _eccodes for python: https://pypi.org/project/eccodes/
20.. _eccodes for conda: https://anaconda.org/conda-forge/python-eccodes
21.. _gfortran: https://gcc.gnu.org/wiki/GFortran
22.. _fftw3: http://www.fftw.org
23.. _eccodes: https://software.ecmwf.int/wiki/display/ECC
24.. _emoslib: https://software.ecmwf.int/wiki/display/EMOS/Emoslib
25.. _member state: https://www.ecmwf.int/en/about/who-we-are/member-states
26.. _registration form: https://apps.ecmwf.int/registration/
27.. _CDS API registration: https://cds.climate.copernicus.eu/user/register
28.. _ECMWF ectrans site: https://confluence.ecmwf.int/display/ECAC/Unattended+file+transfer+-+ectrans
29.. _ECaccess Presentation: https://confluence.ecmwf.int/download/attachments/45759146/ECaccess.pdf
30.. _ECMWF instructions on gateway servers: https://confluence.ecmwf.int/display/ECAC/ECaccess+Home
31.. _Computing Representative: https://www.ecmwf.int/en/about/contact-us/computing-representatives
32.. _MARS access: https://confluence.ecmwf.int//display/WEBAPI/Access+MARS
33.. _download section: https://www.flexpart.eu/downloads
34
35     
36.. _ref-local-mode:
37
38.. _ref-req-local:
39 
40Local mode - dependencies
41=========================
42
43The installation is the same for the access modes **member** and **public**.
44
45The environment on your local system has to provide the following software packages
46and libraries, since the preparation of the extraction and the post-processing is done on the local machine:
47
48+------------------------------------------------+----------------+
49|  Python code                                   | Fortran code   |
50+------------------------------------------------+----------------+
51| * `Python3`_                                   | * `gfortran`_  |
52| * `numpy`_                                     | * `fftw3`_     |
53| * `genshi`_                                    | * `eccodes`_   |
54| * `eccodes for python`_                        | * `emoslib`_   |
55| * `ecmwf-api-client`_ (everything except ERA5) |                |
56| * `cdsapi`_ (just for ERA5 and member user)    |                |
57+------------------------------------------------+----------------+
58
59
60.. _ref-prep-local:
61
62Preparing the local environment
63===============================
64
65The easiest way to install all required packages is to use the package management system of your Linux distribution which requires admin rights.
66The installation was tested on a *Debian GNU/Linux buster* and an *Ubuntu 18.04 Bionic Beaver* system.
67
68.. code-block:: sh
69
70  # On a Debian or Debian-derived (e. g. Ubuntu) system,
71  # you may use the following commands (or equivalent commands of your preferred package manager):
72  # (if respective packages are not already available):
73   apt-get install python3 (usually already available on GNU/Linux systems)
74   apt-get install python3-eccodes
75   apt-get install python3-genshi
76   apt-get install python3-numpy
77   apt-get install gfortran
78   apt-get install fftw3-dev
79   apt-get install libeccodes-dev
80   apt-get install libemos-dev
81  # Some of these packages will pull in further packages as dependencies.
82  # This is fine, and some are even needed by ``flex_extract''.
83
84  # As currently the CDS and ECMWF API packages are not available as Debian packages,
85  # they need to be installed outside of the Debian (Ubuntu etc.) package management system.
86  # The recommended way is:
87   apt-get install pip
88   pip install cdsapi
89   pip install ecmwf-api-client
90   
91.. note::
92
93    If you are using Anaconda Python, we recommend to follow the installation instructions of
94    `Anaconda Python Installation for Linux <https://docs.anaconda.com/anaconda/install/linux/>`_
95    and then install the ``eccodes`` package from ``conda`` with:
96
97    .. code-block:: bash
98
99       conda install conda-forge::python-eccodes   
100   
101The CDS API (``cdsapi``) is required for ERA5 data and the ECMWF Web API (ecmwf-api-client) for all other public datasets.   
102   
103.. note::
104
105    Since **public users** currently don't have access to the full *ERA5* dataset, they can skip the installation of the CDS API.
106
107Both user groups have to provide keys with their credentials for the Web APIs in their home directory, following these instructions:
108       
109ECMWF Web API:
110   Go to the `MARS access`_ website and log in with your credentials. Afterwards, go to the section "Install ECMWF KEY", where the key for the ECMWF Web API should be listed. Please follow the instructions in this section under 1 (save the key in a file ``.ecmwfapirc`` in your home directory).
111     
112CDS API:
113   Go to `CDS API registration`_ and register there, too. Log in on the `cdsapi`_ website and follow the instructions in the section "Install the CDS API key" to save your credentials in file ``.cdsapirc``.
114
115   
116.. _ref-test-local:
117   
118Testing the local environment
119=============================
120
121Check the availability of the python packages by typing ``python3`` in a terminal window and run the ``import`` commands in the python shell:
122
123.. code-block:: python
124   
125   # check in python3 console
126   import eccodes
127   import genshi
128   import numpy
129   import cdsapi
130   import ecmwfapi
131   
132If there are no error messages, you succeeded in setting up the environment.
133
134
135Testing the Web APIs
136--------------------
137
138You can start very simple test retrievals for both Web APIs to be sure that everything works. This is recommended to minimise the range of possible errors using ``flex_extract`` later on.
139
140
141ECMWF Web API
142^^^^^^^^^^^^^
143
144
145+----------------------------------------------------------+----------------------------------------------------------+
146|Please use this Python code snippet as a **Member user**: |Please use this Python code snippet as a **Public user**: |
147+----------------------------------------------------------+----------------------------------------------------------+
148|.. code-block:: python                                    |.. code-block:: python                                    |
149|                                                          |                                                          |
150|    from ecmwfapi import ECMWFService                     |    from ecmwfapi import ECMWFDataServer                  |
151|                                                          |                                                          |
152|    server = ECMWFService('mars')                         |    server = ECMWFDataServer()                            |
153|                                                          |                                                          |
154|    server.retrieve({                                     |    server.retrieve({                                     |
155|        'stream'    : "oper",                             |        'stream'    : "enda",                             |
156|        'levtype'   : "sfc",                              |        'levtype'   : "sfc",                              |
157|        'param'     : "165.128/166.128/167.128",          |        'param'     : "165.128/166.128/167.128",          |
158|        'dataset'   : "interim",                          |        'dataset'   : "cera20c",                          |
159|        'step'      : "0",                                |        'step'      : "0",                                |
160|        'grid'      : "0.75/0.75",                        |        'grid'      : "1./1.",                            |
161|        'time'      : "00/06/12/18",                      |        'time'      : "00/06/12/18",                      |
162|        'date'      : "2014-07-01/to/2014-07-31",         |        'date'      : "2000-07-01/to/2000-07-31",         |
163|        'type'      : "an",                               |        'type'      : "an",                               |
164|        'class'     : "ei",                               |        'class'     : "ep",                               |
165|        'target'    : "download_erainterim_ecmwfapi.grib" |        'target'    : "download_cera20c_ecmwfapi.grib"    |
166|    })                                                    |    })                                                    |
167+----------------------------------------------------------+----------------------------------------------------------+
168
169           
170   
171CDS API
172^^^^^^^
173
174Extraction of ERA5 data via CDS API might take time as currently there is a high demand for ERA5 data. Therefore, as a simple test for the API just retrieve pressure-level data (even if that is NOT what we need for FLEXPART), as they are stored on disk and don't need to be retrieved from MARS (which is the time-consuming action):
175
176Please use the following Python code snippet to retrieve a small sample of *ERA5* pressure level data:
177
178.. code-block:: python
179
180    import cdsapi
181   
182    c = cdsapi.Client()
183   
184    c.retrieve("reanalysis-era5-pressure-levels",
185    {
186    "variable": "temperature",
187    "pressure_level": "1000",
188    "product_type": "reanalysis",
189    "year": "2008",
190    "month": "01",
191    "day": "01",
192    "time": "12:00",
193    "format": "grib"
194    },
195    "download_cdsapi.grib")
196
197   
198If you know that your CDS API works, you can try to extract some data from MARS.
199
200.. **Member-state user**
201
202Please use the following Python code snippet to retrieve a small *ERA5* data sample as a **member-state user**! The **Public user** do not have access to the full *ERA5* dataset!
203
204.. code-block:: python
205
206   import cdsapi
207   
208   c = cdsapi.Client()
209   
210   c.retrieve('reanalysis-era5-complete',
211   {
212       'class'   : 'ea',
213       'expver'  : '1',
214       'stream'  : 'oper',
215       'type'    : 'fc',
216       'step'    : '3/to/12/by/3',
217       'param'   : '130.128',
218       'levtype' : 'ml',
219       'levelist': '135/to/137',
220       'date'    : '2013-01-01',
221       'time'    : '06/18',
222       'area'    : '50/-5/40/5',
223       'grid'    : '1.0/1.0',
224       'format'  : 'grib',
225   }, 'download_era5_cdsapi.grib')
226
227
228..  ********************** COMMENTED OUT FOR FUTURE
229    ********************** PUBLIC RETRIEVAL IS CURRENTLY NOT ACCESSIBLE
230   
231    **Public user**
232    Please use this piece of Python code:
233
234    .. code-block:: python
235
236       import cdsapi
237       
238       c = cdsapi.Client()
239       
240       c.retrieve('reanalysis-era5-complete',
241       {
242           'class'   : 'ea',
243           'dataset' : 'era5',
244           'expver'  : '1',
245           'stream'  : 'oper',
246           'type'    : 'fc',
247           'step'    : '3/to/12/by/3',
248           'param'   : '130.128',
249           'levtype' : 'ml',
250           'levelist': '135/to/137',
251           'date'    : '2013-01-01',
252           'time'    : '06/18',
253           'area'    : '50/-5/40/5',
254           'grid'    : '1.0/1.0',
255           'format'  : 'grib',
256       }, 'download_era5_cdsapi.grib')
257
258
259
260.. _ref-install-local:
261
262Local installation
263==================
264
265   
266The Fortran program called ``calc_etadot`` will be compiled during the
267installation process. A suitable makefile (``makefile_local_gfortran``) for the compilation is set by default.
268This may be overwritten by the ``MAKEFILE`` parameter in ``setup.sh``.
269
270However, you may have to adapt the makefile for your environment (the current default makefile works on Debian stretch and similar GNU/Linux distributions). If you use a new name for it, you will have to insert it into ``setup.sh``
271For details on the makefile and how to adapt them, see :ref:`Fortran Makefile <ref-convert>`.
272
273 
274In the root directory of ``flex_extract``, open the ``setup.sh`` script
275with an editor and adapt the installation parameters in the section labelled with
276"AVAILABLE COMMANDLINE ARGUMENTS TO SET" as shown below:
277
278
279.. code-block:: bash
280   :caption: 'Example settings for a local installation.'
281   :name: setup.sh
282   
283   ...
284   # -----------------------------------------------------------------
285   # AVAILABLE COMMANDLINE ARGUMENTS TO SET
286   #
287   # THE USER HAS TO SPECIFY THESE PARAMETER
288   #
289   TARGET='local'
290   MAKEFILE=<name_of_your_makefile>
291   ECUID=None
292   ECGID=None
293   GATEWAY=None
294   DESTINATION=None
295   INSTALLDIR=None
296   JOB_TEMPLATE=''
297   CONTROLFILE='CONTROL_EA5'
298   ...
299
300
301Afterwards, type:
302
303.. code-block:: bash
304
305   $ ./setup.sh
306   
307to start the installation. You should see the following standard output.
308   
309   
310.. code-block:: bash
311
312    # Output of setup.sh   
313    WARNING: installdir has not been specified
314    flex_extract will be installed in here by compiling the Fortran source in <path-to-flex_extract>/flex_extract_v7.1/Source/Fortran
315    Install flex_extract_v7.1 software at local in directory <path-to-flex_extract>/flex_extract_v7.1
316
317    Using makefile: makefile_local_gfortran
318    gfortran   -O3 -march=native -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm -lemosR64 -I. -I/usr/local/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c ./rwgrib2.f90
319    gfortran   -O3 -march=native -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm -lemosR64 -I. -I/usr/local/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c ./phgrreal.f90
320    gfortran   -O3 -march=native -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm -lemosR64 -I. -I/usr/local/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c ./grphreal.f90
321    gfortran   -O3 -march=native -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm -lemosR64 -I. -I/usr/local/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c ./ftrafo.f90
322    gfortran   -O3 -march=native -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm -lemosR64 -I. -I/usr/local/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c ./calc_etadot.f90
323    gfortran   -O3 -march=native -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm -lemosR64 -I. -I/usr/local/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c ./posnam.f90
324    gfortran  rwgrib2.o calc_etadot.o ftrafo.o grphreal.o posnam.o phgrreal.o -o calc_etadot_fast.out  -O3 -march=native -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm -lemosR64 -fopenmp
325    ln -sf calc_etadot_fast.out calc_etadot
326
327    lrwxrwxrwx. 1 <username> tmc 20 Aug 12  10:59 ./calc_etadot -> calc_etadot_fast.out
328
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG