FLEXPART安装配置全记录

0.系统配置

sudo apt-get update
sudo apt-get install g++ gfortran autoconf libtool automake flex bison cmake python-dev python-pip git-core vim curl build-essential libbz2-dev libssl-dev libreadline-dev libsqlite3-dev tk-dev ruby

1. 安装jasper

cd /usr/local
wget http://www.ece.uvic.ca/~mdadams/jasper/software/jasper-1.900.1.zip
unzip jasper-1.900.1.zip
mkdir jasper
cd jasper-1.900.1
CFLAGS="-fPIC" ./configure --prefix=/usr/local/jasper
make
make check
make install

2. 安装grib_api

ECMWF取消了支持,安装包在这里.

cd /usr/local
wget https://people.freebsd.org/~sunpoet/sunpoet/grib_api-1.28.0-Source.tar.gz
tar xvzf grib_api-1.28.0-Source.tar.gz
mkdir grib_api
cd grib_api-1.28.0-Source
./configure --prefix=/usr/local/grib_api --with-jasper=/usr/local/jasper
make
make check
make install

3. 安装eccodes

wget https://software.ecmwf.int/wiki/download/attachments/45757960/eccodes-2.7.3-Source.tar.gz
tar xvzf eccodes-2.7.3-Source.tar.gz
mkdir eccodes
cd eccodes-2.7.3-Source
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/eccodes /usr/local/eccodes-2.7.3-Source -DPYTHON_EXECUTABLE=/usr/bin/python3
make
ctest
make install
export ECCODES_SAMPLES_PATH=$PATH:/usr/local/eccodes/share/eccodes/samples
export ECCODES_DEFINITION_PATH=$PATH:/usr/local/eccodes/share/eccodes/definitions
sudo apt-get install libeccodes-dev
python3 -m eccodes selfcheck
Found: ecCodes v2.6.0.
Your system is ready.

4. 安装 NetCDF

Note: Modification from Ubuntu 下安装 netcdf4


VERY IMPORTANT FOR Ubuntu USER

sudo apt-get install libnetcdf-dev libnetcdff-dev

4.1 安装 zlib
v=1.2.8  
sudo wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/zlib-${v}.tar.gz
sudo tar -xf zlib-${v}.tar.gz && cd zlib-${v}
sudo ./configure --prefix=/usr/local
sudo make install
cd ..
4.2 安装 szlib
v=2.1
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/szip-${v}.tar.gz
tar -xf szip-${v}.tar.gz && cd szip-${v}
./configure --prefix=/usr/local/szip
make
make install
4.3 安装hdf5
v=1.8.13
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/hdf5-${v}.tar.gz
tar -xf hdf5-${v}.tar.gz && cd hdf5-${v}
prefix="/usr/local/hdf5-$v"

echo "Add HDF5_DIR=$prefix to .bashrc"
echo "" >> ~/.bashrc
echo "# HDF5 libraries for python" >> ~/.bashrc
echo export HDF5_DIR=$prefix  >> ~/.bashrc

./configure --enable-shared --enable-hl --prefix=$HDF5_DIR
make -j 2 # 2 for number of procs to be used
make install
cd ..
4.4 安装 netcdf-c
v=4.1.3
wget http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-${v}.tar.gz
tar -xf netcdf-${v}.tar.gz && cd netcdf-${v}
prefix="/usr/local/"

echo "Add NETCDF4_DIR=$prefix to .bashrc"
echo "" >> ~/.bashrc
echo "# NETCDF4 libraries for python" >> ~/.bashrc
echo export NETCDF4_DIR=$prefix  >> ~/.bashrc

CPPFLAGS=-I$HDF5_DIR/include LDFLAGS=-L$HDF5_DIR/lib ./configure --enable-netcdf-4 --enable-shared --enable-dap --prefix=$NETCDF4_DIR
make 
make install
cd ..
4.5 python Netcdf4 安装
# install python's netCDF4
pip install netCDF4 --upgrade

5. 安装FLEXPART10.4

cd /usr/local
wget https://www.flexpart.eu/downloads/66
tar xvf 66
cd flexpart_v10.4_3d7eebf

cp -r src src2
cd src2
vi makefile
#modified to 
        ROOT_DIR = /usr/local

        F90       = /usr/bin/gfortran
        MPIF90    = /usr/bin/mpifort
         
        INCPATH1  = ${ROOT_DIR}/grib_api/include
        INCPATH2  = ${ROOT_DIR}/jasper/include
        INCPATH3 = /include
        LIBPATH1 = ${ROOT_DIR}/grib_api/lib
        LIBPATH2 = ${ROOT_DIR}/jasper/lib
        LIBPATH3 = /lib
### Enable netCDF output?
ifeq ($(ncf), yes)
        NCOPT = -DUSE_NCF -lnetcdff -lnetcdf
else
        NCOPT = -UUSE_NCF
endif
## LIBRARIES
LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper $(NCOPT) -lnetcdff

FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -I$(INCPATH3) -O$(O_LEV) -g -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(NCOPT) $(FUSER)  #-Warray-bounds -fcheck=all # -march=native

DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -I$(INCPATH3) -O$(O_LEV_DBG) -g3 -ggdb3 -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) $(NCOPT) -fbacktrace   -Wall  -fdump-core $(FUSER)  #  -ffpe-trap=invalid,overflow,denormal,underflow,zero  -Warray-bounds -fcheck=all

LDFLAGS  = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS) -L$(LIBPATH2)
-L$(LIBPATH3)
LDDEBUG  = $(DBGFLAGS) -L$(LIBPATH1) $(LIBS) -L$(LIBPATH2) -L$(LIBPATH3)

make ncf=yes
export LD_LIBRARY_PATH=/usr/local/grib_api/lib:$LD_LIBRARY_PATH

6. 安装flex_extract

6.1 安装flex_extract
cd /usr/local
git clone --single-branch --branch master https://www.flexpart.eu/gitmob/flex_extract

6.2 安装Dependence
apt-get install python3 (usually already available on GNU/Linux systems)
 apt-get install python3-eccodes -y
 apt-get install python3-genshi -y
 apt-get install python3-numpy -y
 apt-get install gfortran -y
 apt-get install fftw3-dev -y
 apt-get install libeccodes-dev -y
 apt-get install libemos-dev -y
 apt-get install python-is-python3 -y
 apt install plocate -y

pip install cdsapi
pip install ecmwf-api-client

#python3
# check in python3 console
import eccodes
import genshi
import numpy
import cdsapi
import ecmwfapi
6.3 import eccodes 报错处理-安装zlib1.2.9
wget https://sourceforge.net/projects/libpng/files/zlib/1.2.9/zlib-1.2.9.tar.gz
tar -xvf zlib-1.2.9.tar.gz
cd zlib-1.2.9
sudo -s
./configure; make; make install
cd /lib/x86_64-linux-gnu
ln -s -f /usr/local/lib/libz.so.1.2.9/lib libz.so.1
cd ~
rm -rf zlib-1.2.9
6.4 install emoslib
cd /usr/local
mkdir emoslib
wget https://confluence.ecmwf.int/download/attachments/3473472/libemos-4.5.9-Source.tar.gz
tar -xzf libemos-4.5.9-Source.tar.gz
cd libemos-4.5.9-Source
mkdir build ; cd build 
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/emoslib /usr/local/libemos-4.5.9-Source
make
make install
6.5 安装ECMWF 与ERA5安装权限
cd 
vim .ecmwfapirc
{
    "url"   : "https://api.ecmwf.int/v1",
    "key"   : "8fb37b516ba233bde068613a8f08c785",
    "email" : "791653827@qq.com"
}
vim .cdsapirc
url: {api-url}
key: {uid}:{api-key}
6.6 修改makefile_local_gfortran文件
cd /usr/local/flex_extract/Source/Fortran/makefile_local_gfortran
vi makefile_local_gfortran
# change the original path of ECCODES_INCLUDE_DIR to 
ECCODES_INCLUDE_DIR=/usr/include
6.7 修改makefile_local_gfortran文件
cd /usr/local/flex_extract
./setup_local.sh

出现以下输出表示安装成功:

WARNING: installdir has not been specified
flex_extract will be installed in here by compiling the Fortran source in /usr/local/flex_extract/Source/Fortran
Install flex_extract_v7.1.2 software at local in directory /usr/local/flex_extract

Using makefile: makefile_local_gfortran
gfortran   -O3  -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm  -lemosR64 -I. -I/usr/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c    ./rwgrib2.f90
gfortran   -O3  -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm  -lemosR64 -I. -I/usr/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c    ./phgrreal.f90
gfortran   -O3  -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm  -lemosR64 -I. -I/usr/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c    ./grphreal.f90
gfortran   -O3  -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm  -lemosR64 -I. -I/usr/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c    ./ftrafo.f90
gfortran   -O3  -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm  -lemosR64 -I. -I/usr/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c    ./calc_etadot.f90
gfortran   -O3  -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm  -lemosR64 -I. -I/usr/include -fdefault-real-8 -fopenmp -fconvert=big-endian   -c    ./posnam.f90
gfortran  rwgrib2.o calc_etadot.o ftrafo.o grphreal.o posnam.o phgrreal.o -o calc_etadot_fast.out  -O3  -Bstatic -leccodes_f90 -leccodes -Bdynamic -lm  -lemosR64 -fopenmp
ln -sf calc_etadot_fast.out calc_etadot

lrwxrwxrwx 1 root root 20 Nov 13 20:19 ./calc_etadot -> calc_etadot_fast.out
6.8 测试flex_extract
cd Testing/Installation/Calc_etadot
# execute the Fortran progam without arguments
../../../Source/Fortran/calc_etadot

出现以下输出表示成功:

STATISTICS:          98842.4598  98709.7359   5120.5385
STOP SUCCESSFULLY FINISHED calc_etadot: CONGRATULATIONS

Updated on 13 November 2020

7. FLEXPART MPI 环境配置
7.1 配置本地MPI环境
cd /usr/local/
wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz
tar mxvzf pich-3.3.2.tar.gz
./configure --prefix=/usr/local/mpi
make 
make install
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 156,757评论 4 359
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,478评论 1 289
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 106,540评论 0 237
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,593评论 0 203
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 51,903评论 3 285
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,329评论 1 210
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,659评论 2 309
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,383评论 0 195
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,055评论 1 238
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,337评论 2 241
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,864评论 1 256
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,227评论 2 251
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,820评论 3 231
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 25,999评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,750评论 0 192
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,365评论 2 269
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,260评论 2 258