Linux系统下使用wgrib2解析气象有关grb2文件

Now we are going to see how to install wgrib2 and g2ctl in our linux machine, for the Grib version 2 data.
#   现在我们来看看如何在我们的Linux机器上安装WGRIb2和G2CTL,用于GRIB版本2的数据。

step 1:
#  步骤1:

First of we need to install GRADS

#  首先我们需要安装GRADS


http://grads.iges.org/grads/downloads.html(查不到网页了)

(或者https://sourceforge.net/projects/opengrads/files/grads2/2.1.0.oga.1/Linux/)(推荐)

#  HTTP//Gr.IG.Org/Grass/DubLosi.HTML



From the above link we can get the source.

#  从上面的链接我们可以得到来源。



In ubuntu we need to install some dependencies,

#  在Ubuntu中,我们需要安装一些依赖项,



$ sudo apt-get install libgrib2c-dev libgrib2c0d (to install wgrib2 correctly)

#   $SUDO APT获得安装LBGRBI2C DEV LIGBRI2C0D(正确安装WGRIb2)



$ sudo apt-get install grads (for gribmap)

#    $SUDO APT获得安装梯度(GRIPMAP)


Note : grads version must be equal or higher than the 2.0.a8 (to work correctly for grib2).
#   注意:GrADS版本必须等于或高于2.0.A8(为GRBI2正确工作)。


If you are using ubuntu 10.04, then grads may be lower than the above version.

#   如果您使用Ubuntu 10.04,那么GrADS可能低于上述版本。


So download the source of grads version 2.0.a8 or higher.

#    因此,下载GrADS版本2.0.A8或更高的源代码。


$ sudo apt-get install libxmu-dev libxmu-headers x11-common x11-xserver-utils

#   $SUDO APT安装LIXMU DEV LIXXMU报头X11公共X11 XServer UTLS


Extract that downloaded grads source and change directory into that extracted folder.

#   提取下载的梯度源并将目录更改为提取的文件夹。


$ ./configure
#   $ /配置    详细见 https://blog.csdn.net/nemo2011/article/details/7384501


$ make && make install
#   $make和make install


Now it should be installed in that folder called ‘src’.
#   现在它应该安装在被称为“SRC”的文件夹中。


You can use this grads, gribmap (inside the src folder of the extracted folder of grads2.0.a8) to use the grib2 version.

#    您可以使用这个梯度,GRIPMAP(在提取的Grass2.2.8)文件夹中使用GRIP2版本。


$ sudo cp -r src /usr/local/grads2.0.a8

#    SUDO CP-R SRC/URS/loca/ GRADS2.0.A8



Edit your home .bashrc file, add the following lines.
#    编辑你的.BasHC文件,添加以下几行。


alias grads=’/usr/local/grads2.0.a8/grads’
#     别名梯度= '/Ur/Prime/Gravs2.2.A8/GrADS '


alias gribmap=/usr/local/grads2.0.a8/gribmap’
#    别名GRIPMAP=/Ur/Prime/Geals2.2.A8/GRIPMAP


step 2:
#    步骤2:


From the below site we can download the g2ctl.pl perl source code
#    从下面的站点,我们可以下载G2CTL.PL Perl源代码


http://www.cpc.ncep.noaa.gov/products/wesley/g2ctl.html
#    HTTP://www. cPC.nCEP.NOAAGOV/products/ WESLY/G2CTL.HTML


Look in the bottom of the page.
#    看看这页的底部。


Try to open all the above links in firefox not in chrome.
#    尝试在Firefox中打开所有链接,而不是在Chrome中。


Download that g2ctl.pl source code from here ftp://ftp.cpc.ncep.noaa.gov/wd51we/g2ctl/g2ctl save as g2ctl.pl . If that perl source code has viewed by web page itself means, copy that perl code into one text file, and save that as g2ctl.pl file in your home folder itself.
#    从这里下载的G2CTL.PL源代码从这里FTP:/FPT.CPC.NCEP.NOAAGOV/WD51 WE/G2CTL/G2CTL保存为G2CTL.PL。如果Perl源代码已被Web页本身查看,则将该Perl代码复制到一个文本文件中,并将其保存为主页本身中的G2CTL.PL文件。


step 3:
#    步骤3:


Go to the below link to download the wgrib2 tar file
#    转到下面的链接下载WGRIP2焦油文件


http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/
#    HTTP//www. CPC.NCEP.NOAAGOV/products/ WESLY/WGRBI2/


From here you can download the wgrib2.tgz source file in the above link.
#    从这里你可以在上面的链接下载WGRIP2.TGZ源文件。


Go to this section in the above link “Source Code and Compling Hints” .
#    在上面的链接“源代码和提示”中进入这一节。



Download the “wgrib2.tgz” by http way.

#    通过HTTP方式下载“WGRIP2.TGZ”。



After downloaded the wgrib2.tgz file, extract it either by GUI “Extract here” or
#    下载WGRIP2.TGZ文件后,通过GUI“提取此处”或将其提取出来。


$ tar -zxvf wgrib.gz
#    $TAR-ZXVF WGREB.GZ


It should create directory called “grib2″.
#    它应该创建名为“GRIP2”的目录。


Now move this folder into /usr/bin by
#    现在把这个文件夹移到/Urr/bin


$ sudo mv grib2 /usr/bin/
#    SUDO MV GRBI2/UR/BIN/


Now go to that directory by
#    现在转到目录



$ cd /usr/bin/grib2
#    $CD/Ur/bin /GRIP2


$ sudo make
#    苏多制造


It takes few minutes to install wgrib2 inside that folder itself.

#    在该文件夹本身中安装WGRIP2只需几分钟。


Note : now our wgrib2 executable path is ” /usr/bin/grib2/wgrib2/wgrib2 “.
#    注意:现在我们的WGRIP2可执行路径是“/Ur/bin /GRIP2/WGRBI2/WGRIP2”。



step 4:
#    步骤4:


Now open the g2ctl.pl file,
#    现在打开G2CTL.PL文件,


Look for the line:
#    寻找路线:


$wgrib2=’wgrib2′;
#    $WGRB2=’WGRIP2’;


and change it to point to your wgrib2 path. In our case,
#    并将其更改为指向您的WGRIP2路径。在我们的例子中,


$wgrib2=’/usr/bin/grib2/wgrib2/wgrib2′;
#    $WGRIP2=’/UR/BI/GRIP2/WGRBI2/WGRIP2’;


Don’t forget to make the program as executable (chmod 755 g2ctl.pl) and put it on your PATH. i.e $ sudo chmod 755 g2ctl.pl and $ sudo cp g2ctl.pl /usr/bin/
#    不要忘记将程序作为可执行文件(CHMOD 755 G2CTL.PL),并将其放到您的路径上。即$SUDO CHMOD 755 G2CTL.PL和$SUDO CP G2CTL.PL/UR/BIN /


Thats it … !
#  这就是……!




Now you can access the g2ctl.pl from the bash shell (terminal) itself.
#    在您可以从BASH外壳(终端)本身访问G2CTL.PL。



Try the following usage of g2ctl with your analysis and forecasting binary grib files.
#    尝试使用G2CTL来分析和预测二进制GRIB文件。


Usage
#    用法
For analyses:
#     分析:


$ g2ctl.pl -0 grib2_file >grib2_file.ctl [ here we passed zero option]

#    $G2CTL.PL - 0 GRIP2x文件> GRIb2a文件.CTL [这里我们通过零选项]

$ gribmap -0 -i grib2_file.ctl [ here we passed zero option]

#    $ GRIPMAP - 0 - I GRIP2YFIL.CTL [这里我们通过零选项]

$ grads

#    $GrADS


Landscape mode? (no for portrait):
#    景观模式?(没有肖像):


ga-> open grib2_file.ctl
#    GA->开放式GRIP2A文件CTL


For forecasts:
#    预测:


$ g2ctl.pl grib2_file >grib2_file.ctl
#    G2CTL.PL GRIP2X文件> GRIP2A文件CTL


$ gribmap -i grib2_file.ctl
#    $GRIPMAP -I GRIP2A文件CTL


$ grads
#    $GrADS


Landscape mode? (no for portrait):
#    景观模式?(没有肖像):


ga-> open grib2_file.ctl
#    GA->开放式GRIP2A文件CTL


The main differences between the syntax of grib2ctl.pl and g2ctl.pl are,
#    GRIP2CTL.PL和G2CTL.PL语法的主要区别是:


For grib version 2 files, we are using g2.ctl.pl script to create ctl files. The usage option -0 (zero) are passed for both g2ctl.pl and gribmap commands for analysis files and not for forecast files in the grib version 2.
#    对于GRIB版本2的文件,我们使用G2.CTL.PL脚本来创建CTL文件。对于GRIB版本2,使用选项0(0)用于分析文件的G2CTL.PL和GRIPMAP命令,而不用于预测文件。


For grib version 1 files, we are using grib2ctl.pl script to create ctl files. The usage option -0 (zero) is passed in gribmap command for analysis files and option -verf is passed in grib2ctl.pl command for forecast files. To know more about grib2ctl.pl script, how to install that and how to use that, click here .
#    对于GRIB版本1的文件,我们使用GRIP2CTL.PL脚本来创建CTL文件。使用选项0(0)在GRIPMAP命令中传递用于分析文件,选项-VIF在GRIP2CTL.PL命令中传递用于预测文件。要了解更多关于GRIP2CTL.PL脚本,如何安装它以及如何使用它,请点击这里。


To understand, what is grib and ctl file formate
#    要理解,什么是GRIB和CTL文件格式?


grib is the one of binary file formate to store the analysis and forecast data in some kind of structured manner.
#     GRIB是二进制文件格式的一种,以某种结构化的方式存储分析和预测数据。


ctl means control file in ascii formate. we can read it. Both these formates are usually used in atmospheric and meteorological departments.
#    CTL是ASCII格式文件中的控制文件。我们可以阅读。这两种甲酸盐通常用于大气和气象部门。


The generated ctl files can be read and visualized by GRADS , CDAT and other meteorological softwares.
#    生成的CTL文件可以通过GrADS、CDAT和其他气象软件读取和可视化。


Both Grads and CDAT are open source software.
#     Dead和CDAT都是开源软件。


More over many other foss applications are available for the same kind of stuff.

#    更多的其他的开源软件应用程序可用于相同类型的东西。



猜你喜欢

转载自blog.csdn.net/Gzigithub/article/details/80383242
今日推荐