0

我有一个 grib 文件,当我对其执行 wgrib2 时,我有以下参数:

wgrib2 xxx.grib2

5:211198:d=2015021300:HGT:10 mb:anl:
6:262648:d=2015021300:TMP:10 mb:anl:
7:283996:d=2015021300:RH:10 mb:anl:
8:292394:d=2015021300:UGRD:10 mb:anl:
9:317511:d=2015021300:VGRD:10 mb:anl:
10:340062:d=2015021300:ABSV:10 mb:anl:
11:383260:d=2015021300:O3MR:10 mb:anl:
12:430173:d=2015021300:HGT:20 mb:anl:
13:481715:d=2015021300:TMP:20 mb:anl:
14:503017:d=2015021300:RH:20 mb:anl:
15:515254:d=2015021300:UGRD:20 mb:anl:
16:541214:d=2015021300:VGRD:20 mb:anl:
17:564276:d=2015021300:ABSV:20 mb:anl:
18:608222:d=2015021300:O3MR:20 mb:anl:
19:658193:d=2015021300:HGT:30 mb:anl:
20:717255:d=2015021300:TMP:30 mb:anl:
21:739796:d=2015021300:RH:30 mb:anl:
22:755685:d=2015021300:UGRD:30 mb:anl:
23:782085:d=2015021300:VGRD:30 mb:anl:
24:805410:d=2015021300:ABSV:30 mb:anl:
25:850474:d=2015021300:O3MR:30 mb:anl:
29:15146624:d=2015021300:TMP:80 m above ground:anl:
30:15191769:d=2015021300:SPFH:80 m above ground:anl:
31:15252084:d=2015021300:PRES:80 m above ground:anl:
32:15328443:d=2015021300:UGRD:80 m above ground:anl:
33:15407088:d=2015021300:VGRD:80 m above ground:anl:
34:15485944:d=2015021300:TMP:100 m above ground:anl:
35:15531004:d=2015021300:UGRD:100 m above ground:anl:
36:15609651:d=2015021300:VGRD:100 m above ground:anl:
37:15688696:d=2015021300:TMP:1829 m above mean sea level:anl:
38:15735588:d=2015021300:UGRD:1829 m above mean sea level:anl:
39:15815796:d=2015021300:VGRD:1829 m above mean sea level:anl:
40:15896935:d=2015021300:TMP:2743 m above mean sea level:anl:
41:15942724:d=2015021300:UGRD:2743 m above mean sea level:anl:
42:16024306:d=2015021300:VGRD:2743 m above mean sea level:anl:
46:2015021300:PRMSL:mean sea level:anl:

现在我想对 wgrib2 xxx.grib2 |egrep 'PARMETERS' 做些什么,这样我就可以隔离出 HGT、TMP、UGRD 参数,前提是它们是在以 mb 为单位的压力水平下测量的(即 UGRD:30 mb:anl 而不是UGRD ???? 米海拔)。我知道我可以使用以下命令执行此操作:

wgrib2 xxx.grib2 | egrep 'TMP:|:HGT:|:UGRD' |egrep 'mb' based on an earlier response from stackoverflow.  However, I also want PRMSL:mean sea level:anl including in my list of parameters being isolated out so I could get the following from the command:

wgrib2 xxx.grib2 |egrep 'PARMETERS'

 5:211198:d=2015021300:HGT:10 mb:anl:
6:262648:d=2015021300:TMP:10 mb:anl:
8:292394:d=2015021300:UGRD:10 mb:anl:
12:430173:d=2015021300:HGT:20 mb:anl:
13:481715:d=2015021300:TMP:20 mb:anl:
15:515254:d=2015021300:UGRD:20 mb:anl:
19:658193:d=2015021300:HGT:30 mb:anl:
20:717255:d=2015021300:TMP:30 mb:anl:
22:755685:d=2015021300:UGRD:30 mb:anl:
46:2015021300:PRMSL:mean sea level:anl:

如何设置 wgrib2 xxx.grib2 |egrep 'PARAMETERS' 命令以便获得上述输出?

4

2 回答 2

0

如果我仔细理解这个问题

egrep '(TMP:|:HGT:|:UGRD)[0-9]+ mb' file
于 2015-02-17T23:06:51.027 回答
0

wgrib2 xxx.grb2 -match ":(UGRD|HGT|TMP):" -match ":[0-9]* mb:"

或者

wgrib2 xxx.grb2 | egrep ":(UGRD|HGT|TMP):" | egrep ":[0-9]* mb:"

于 2015-02-18T19:38:01.587 回答