http://wrfchina.com/node/93
本文作者為中山大學楊超鋒同學,特此感謝。
1 CentOS 5 Linux 安裝圖解
參照:http://hi.baidu.com/senya/blog/item/410b2afa60dec88f9e514642.html
2 PGI 安裝
2.1 将檔案pgilinux86-64-707.tar.gz 下載下傳到/home/yourname/pgi707 目錄下解壓
[yourname @localhost pgi707]$ tar -zxvf pgilinux86-707.tar.gz
[yourname @localhost pgi707]$ ls
common install INSTALL.txt linux86 linux86-64 pgilinux86-707.tar.gz
postinstall
2.2 編譯并安裝
[yourname @localhost pgi707]$ su root
[[email protected] pgi707]# ./install
Do you accept these terms? [accept,decline]
accept
Install the ACML? [y/n]
n
Installation directory? [/usr/pgi]
/usr/local/pgi
Create an evaluation license? [y/n]
n
Do you want the files in the install directory to be read-only? [y,n]
n
還有許多其他設定可以預設進行,直接回車即可
2.3 用root 使用者把license.dat(在使用期範圍的其他版本的license.dat 也可以用)複制
(cp)到/usr/local/pgi 下
2.4 把以下幾行放到/home/yourname/.bashrc 的最後
export PGI=/usr/local/pgi/linux86/7.0-7
export PATH=$PGI/bin:$PATH
export MANPATH=$PGI/man:$MANPATH
export LM_LICENSE_FILE=/usr/local/pgi/license.dat
并執行:
[[email protected] pgi707]# source /home/yourname/.bashrc
2.5 測試PGI:
[[email protected] pgi707]# pgf90
pgf90-Warning-No files to process
以上說明PGI 安裝成功!
3 Netcdf 安裝
3.1 将檔案netcdf.tar.gz 下載下傳到/home/yourname/netcdf 下解壓
[yourname @localhost netcdf]$ tar -zxvf netcdf-4.0.1.tar.gz
[yourname @localhost netcdf]$ ls
netcdf-4.0.1 netcdf-4.0.1.tar.gz
3.2 編譯并安裝
[yourname @localhost netcdf]$ cd netcdf-4.0.1/
[yourname @localhost netcdf-4.0.1]$ su root
[[email protected] netcdf-4.0.1]# mkdir /usr/local/netcdf
[[email protected] netcdf-4.0.1]# ./configure --prefix=/usr/local/netcdf
FC=pgf90
[[email protected] netcdf-4.0.1]# make
[[email protected] netcdf-4.0.1]# make install
3.3 把以下幾行放到/home/yourname/.bashrc 的最後
export NETCDF=/usr/local/netcdf
export PATH=$NETCDF/bin:$PATH
并執行:
[[email protected] netcdf-3.6.2]# source /home/yourname/.bashrc
這樣NetCDF 安裝成功!
4 NCARG 安裝
4.1. 安裝PPNGlib 的支援,到http://www.libpng.org/pub/png/libpng.html 下載下傳然後執行
./configure --prefix=/usr/local
make all install
4.2. 下載下傳ncl 安裝檔案,到http://www.earthsystemgrid.org/下載下傳和本地機器和gcc 版本相近的ncl 預編譯
版本。本地機器版本可以用uname -m 檢視,gcc 版本用 gcc --version 檢視。我下載下傳的是 NCL 5.1.1 32-bit
binary for i686 chips for LINUX (compiled with gcc 4.1.2)。
4.3. 安裝
将下載下傳的檔案解壓,把裡面的三個子檔案夾bin, lib, include 解壓到目标檔案夾,即/usr/local/ncarg。
指令如下:
su
輸入密碼
mkidr /usr/local/ncarg
cd /usr/local/ncarg
tar zxvf /home/yourname/ncl_ncarg-5.1.1.Linux_i686_gcc412.tar.gz
4.4. 配置環境變量: (可參考http://www.ncl.ucar.edu/Download/install.shtml)
cd ~
gedit .bashrc
打開.bashrc 檔案添加下面幾行:
export NCARG_ROOT=/usr/local/ncarg
export PATH=/usr/local/ncarg/bin:$PATH
export DISPLAY=:0.0
export NCARG_LIB=/usr/local/ncarg/lib
export NCARG_INC=/usr/local/ncarg/include
然後儲存
再在~/目錄下,輸入 source .bashrc
4.5. 配置檔案:
在~/ 目錄下建立.hluresfile 檔案, 然後把下面内容複制( 此檔案說明見:
http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml)這個檔案已經做好給你們了,直接複制到~/裡
面
!=========================================
! 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
ncargex cpex08, ctrans -d X11 cpex08.ncgm
此時,可以看到測試的顯示結果。
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
到此為止,WRF 模式安裝的前期準備已經完成,下面開始正式安裝模式。在正式安裝之前,我們先在我們
自己的使用者目錄下建立一個名為WRF 的檔案夾,然後把地形檔案壓縮包geog_v3.1.tar.gz、WRFV3 壓
縮包WRFV3.1.1.TAR.gz、WPSV3 壓縮包WPSV3.1.1.TAR.gz 和ARWpost 壓縮包ARWpost.tar.gz
都複制到WRF 檔案夾裡,最後就可以在WRF 檔案夾裡進行模式的安裝了。
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
5 WRFV3 安裝
要先安裝WRF,再安裝WPS,這個順序不能颠倒。
安裝步驟:
5.1 WRF 壓縮包可以到以下網頁下載下傳:
http://www.mmm.ucar.edu/wrf/users/download/get_source.html
需要注冊,不過注冊很友善。我們已經下載下傳好了。
5.2 在事前建立的WRF 目錄下,解壓WRFV3 的壓縮包
tar zxvf WRFV3.1.1.TAR.gz
cd WRFV3
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
./configure
注釋:serial means single processor (考慮到大家機器的實際情況,請大家選擇這項)
smpar means Symmetric Multi-Processing/Shared Memory Parallel (OpenMP)
dmpar means Distributed Memory Parallel (MPI)
dm+sm means Distributed Memory with Shared Memory (for example, MPI across
nodes with OpenMP within a node)
the second option is for nesting: 0 = no nesting, 1 = standard static nesting,
2 = nesting with a prescribed set of moves, 3 = nesting that allows a domain
to follow a vortex (typhoon tracking)
注意:選擇linux with pgi 編譯器(serial)的選項,回車以後,出現compile for nesting?
選擇basic。
5.3 開始編譯
./compile em_real
ls -ls main/*.exe
注釋:you should see ndown.exe, real.exe, and wrf.exe 。代表WRFV3 安裝成功。
5.4 如果編譯失敗,請先回到WRFV3 目錄下,輸入./clean –a ,再重新查找問題,重新安裝。
6 WPSV3 安裝
6.1 擷取WPS 的源檔案 WPSV3.TAR.gz
o http://www.mmm.ucar.edu/wrf/users/download/get_source.html
6.2 進入WRF 目錄,并解壓:
cd WRF
tar -zxvf WPSV3.1.1.TAR.gz
解壓後,進入WPS 目錄
cd WPS
6.3 配置:
./configure
這一布會出現相關選項,注意事項如下:
o choose one of the options
o usually, option "1" and option “2” are for serial builds, that is the best
for an initial test
o WPS requires that you build for the appropriate Grib decoding, select an
option that suitable for the data you will use with the ungrib program
o If you select a Grib2 option, you must have those libraries prepared and
built in advance
6.4 編譯:
./compile
ls -ls *.exe
注釋:
o you should see geogrid.exe, ungrib.exe, and metgrid.exe (if you are missing
both geogrid.exe and metgrid.exe, you probably need to fix where the path to
WRF is pointing in the configure.wps file; if you are missing ungrib.exe, try
a Grib1-only build to further isolate the problem)
ls -ls util/*.exe
注釋:
o you should see a number of utility executables: avg_tsfc.exe,
calc_ecmwf_p.exe, g1print.exe, g2print.exe, mod_levs.exe, plotfmt.exe,
plotgrids.exe, and rd_intermediate.exe (files requiring NCAR Graphics are
plotfmt.exe and plotgrids.exe)
• if geogrid.exe and metgrid.exe executables are missing, probably the path
to the WRFV3 directory structure is incorrect (found inside the configure.wps
file)
• if the ungrib.exe is missing, probably the Grib2 libraries are not linked
or built correctly
• if the plotfmt.exe or the plotgrids.exe programs are missing, probably the
NCAR Graphics path is set incorrectly
6.5 如果編譯失敗,請先回到WPS 目錄下,輸入./clean –a ,再重新查找問題,重新安裝。
7 ARWpost 安裝
ARWpost 是一個把WRF 結果轉為GrADS 或Vis5D 可以辨識的資料格式的軟體。
下面為安裝步驟:
tar zxvf ARWpost.tar.gz
cd ARWpost
解壓後進入檔案夾,然後如下操作:
./configure
生成configure.arwp
如果你的WRF 目錄路徑不是在"../WRFV3" ,則要編輯configure.arwp,檔案,設定“WRF_DIR“變
量為你的WRFV3 路徑
./complie
生成 ARWpost.exe,表明安裝成功,
運作時,先修改namelist.ARWpost
然後運作 ./ARWpost.exe
這就會生成 output_root_name.dat & output_root_name.ctl 或output_root_name.v5d
然後就可以通過 GrADS 或Vis5D 畫圖。
8 GrADS 安裝
假設檔案下載下傳位置為/home/yourname/grads-2.0.a7.1-bin-i686-pc-linux-gnu.tar.gz
8.1.選擇安裝路徑.一般選擇裝在 /usr/local/bin/ 目錄(也可自行選擇其他)
[[email protected] ~]$ su 轉入根使用者,以便通路/usr/local/bin
[[email protected] yourname]# cd /usr/local/bin
8.2.解壓縮檔案
[[email protected] bin]# tar zxvf
/home/yourname/grads-2.0.a7.1-bin-i686-pc-linux-gnu.tar.gz
[[email protected] bin]# cd ..
[[email protected] grads-2.0.a7.1]# mkdir dat
[[email protected] grads-2.0.a7.1] # cd dat
[[email protected] bin]# tar zxvf /home/yourname/data.tar.Z
8.3.設定環境變量
轉到普通使用者(Ctrl+D),打開 ~./.bashrc,
[[email protected] ~]$ vi .bashrc
添加如下指令:
export GADDIR=/usr/local/bin/grads-2.0.a7.1/dat
export GASCRP=/usr/local/bin/grads-2.0.a7.1/lib
export PATH=/usr/local/bin/grads-2.0.a7.1/bin:$PATH
alias grads=/usr/local/bin/grads-2.0.a7.1/bin/grads
儲存後[[email protected] ~]$ source .bashrc
8.4.OK.輸入'grads'指令即可打開GrADS.