由于课程需要,跌跌撞撞的安装了WRF,简单记录一下,希望以后能有帮助:
首先推荐一个网址,主要的流程是按照上门的要求走的,文库地址
1:首先安装Netcdf
下载Netcdf的安装包
tar -zxvf netcdf-*.tar.gz
cd netcdf-*
./configure --prefix=~/local/netcdf
make
make install
然后配置netcdf到.bashrc
export NETCDF=/usr/local/netcdf
export PATH=$PATH:$NETCDF/bin
export PATH=$PATH:$NETCDF/lib
export PATH=$PATH:$NETCDF/include
export PATH=$PATH:$NETCDF/share/man</span>
记得source ~/.bashrc检测which ncdump
先安装PPnglib
./configure --prefix=~/local/wrf
make all install
下载文件ncl_ncarg-6.2.1.Linux_RHEL6.4_x86_64_gcc472.tar.gz(在这个地方出错了,后来发现是和电脑的gcc版本不一致造成的,所以一定要下载和电脑环境相同或类似的版本,我的版本是RedHat6.6 gcc版本4.4.7,查看电脑信息 uname -a gcc --version)
mkdir ~/local/wrf/ncl
cd ~/local/wrf/ncl
tar -zxvf ~/software_package/ncl_ncarg-6.2.1.Linux_RHEL6.4_x86_64_gcc472.tar.gz
设置环境变量:
export NCARG_ROOT=~/local/wrf/ncl
export NCARG_LIB=~/local/wrf/ncl/lib
export NCARG_INC=~/local/wrf/ncl/include
export PATH=$PATH:~local/wrf/ncl/bin</span>
保存之后 source ~/.bashrc
3:配置文件
在~/下建立文件.hluresfile内容:
!=========================================
! comments for ".res" files are preceded by a "!"
! remember quotations are not used in .res files
! White background/black foreground
*wkForegroundColor : (/0.,0.,0./)
*wkBackgroundColor : (/1.,1.,1./)
*wkColorMap : rainbow+gray
! Font stuff
*Font : helvetica
! Function Codes [Default is a colon ]
*TextFuncCode : ~
! Make default X11 window larger (adjust as necessary)
*wkWidth : 800
*wkHeight : 800
! Have a favorite colormap that you use for everything? You can
! make it your default here (note the name is NOT in quotes):
! *wkColorMap : temp1
! Increase the default (16mb) contour memory
! If you gave gridded data > 500 x 500, you may need this
*wsMaximumSize: 32556688
!==========================================
然后cd ~执行:ng4ex gsun01n, ncl gsun01n.ncl 进行测试
4:WRFV3安装
先安装WRF,再安装WPS先下载WRF压缩包: WPSV3.2.1.TAR.gz
首先在.bashrc中编写环境变量:export WRFIO_NCD_LARGE_FILE_SUPPORT=1
source .bashrc
然后解压压缩包到~/local/wrf下面:
tar -zxvf WPSV3.2.1.TAR.gz -C ~/local/wrf
cd ~/local/wrf/WRFV3
./configure
选11
选择basic
./compile em_real >&compile.log
过程稍微会长一些
编译完成之后在当前目录下:ls -al main/*.exe,看是否得到ndown.exe, real.exe,wrf.exe,如果得到的话表示编译成功,否则请查看log进行对应调整然后重新编译
5:安装WPSV3
安装编译WPS之前,先安装jasper-1.900.1, libpng-1.2.31.tar.gz, zlib-1.2.8.tar.gzzlib-1.2.8.tar.gz:
./configure --prefix=~/local/zlib
make
make check
make install
libpng-1.2.31
tar –zxvf libpng-1.2.31.tar.gz
./configure –prefix=~/local/libpng
Make
Make install
jasper-1.900.1.zip
unzip jasper-1.900.1.zip
cd jasper-1.900.1
./configure –prefix=~/local/jasper
Make
Make install
下载 WPSV3.2.1.TAR.gz解压到wrf文件夹下面
tar -zxvf WPSV3.2.1.TAR.gz ~/local/wrf
cd ~/local/wrf/WPS
./configure
选择并行的4号选项
编辑configure.wps,加入jasper的lib和include:
COMPRESSION_LIBS = -L/data3a/mp/gill/WPS_LIBS/local/lib \
-L/home/zhaol/local/jasper/lib -ljasper -lpng12 -lpng -lz
COMPRESSION_INC = -I/home/zhaol/local/jasper/include
然后./compile
会在当前目录下生成geogrid.exe, ungrib.exe, and metgrid.exe
会在util下生成:avg_tsfc.exe, calc_ecmwf_p.exe, g1print.exe, g2print.exe, mod_levs.exe, plotfmt.exe, plotgrids.exe, and rd_intermediate.exe
修改namelist.wps中的geog_data_path = '目标地址'
6:Geog安装
tar –zxvf ~/software/ geog.tar.gz –C~/local/wrf
7:WPS预处理
7.1:运行./geogrid.exe首先修改.bashrc
LD_LIBRARY_PATH=$NETCDF/lib:~/local/hdf5-1.8.9/lib:~/local/jasper/lib :~/local/libpng/lib:~/local/zlib/lib:$LD_LIBRARY_PATH
运行成功后产生,将生成几个 geo_em.d0*.nc文件
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Successful completion of geogrid. !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
FORTRAN STOP7.2:链接Vtable.GFS,并链接下载的grib文件(fnl_*等)
ln -s ~/local/wrf/WPS/ungrib/Variable_Tables/Vtable.GFS Vtable./link_grib.csh ~/local/wrf/data/fnl* ./
7.3:解压
./ungrib.exe
./ungird.exe的时候记得修改起始时间和结束时间
7.4:把气象数据水平插入模式领域内:
./metgrid.exe
会生成met_em.d02.2012-11-*.nc文件
8:Wrf主进程
cd ~/local/wrf/WRFV3/run修改namelist中的max_dom=2(35行)
修改对应的开始时间和结束时间
接WPS过程中产生的met_em.d*.nc等nc文件
ln -s ~/local/WRF/WPS/met_em.d0* ./
运行real.exe:成功会输出wrfbdy_do1 wrfinputdo1 wrfinputdo2文件
运行./wrf.exe
成功生成wrfout_d01_2009-12-25_00:00:00和wrfout_d02_2009-12-25_00:00:00文件