GrADS CTL文件 VARS字段

GrADS可以读取GRIB格式的再分析数据,如ERA5,CFSR,CRA40等。对于这些数据,借助grib2ctl/g2ctl程序,生成描述文件(*.ctl文件),再通过gribmap命令,生成索引文件(*.idx文件)从而实现对数据的读取。对于一部分数据创建的CTL文件,其var字段的内容比较显式,通过名称就可以知道它描述的是什么变量,变量的维数是多少等;而对于另一些数据创建的CTL文件,创建的var变量字段名称就比较抽象,难以明白其代表那些含义。

 

 CFSR pgbh ctl的vars字段

vars 95
no4LFTXsfc   0,1,0   0,7,193 ** surface Best (4 layer) Lifted Index [K]
no5WAVA500mb   0,100,50000   0,3,197 ** 500 mb 5-Wave Geopotential Height Anomaly [gpm]
no5WAVH500mb   0,100,50000   0,3,193 ** 500 mb 5-Wave Geopotential Height [gpm]
ABSVprs    37,100  0,2,10 ** (1000 975 950 925 900.. 7 5 3 2 1) Absolute Vorticity [1/s]
CAPEsfc   0,1,0   0,7,6 ** surface Convective Available Potential Energy [J/kg]
CAPE180_0mb  0,108,18000,0   0,7,6 ** 180-0 mb above ground Convective Available Potential Energy [J/kg]
CAPE90_0mb  0,108,9000,0   0,7,6 ** 90-0 mb above ground Convective Available Potential Energy [J/kg]
CAPE255_0mb  0,108,25500,0   0,7,6 ** 255-0 mb above ground Convective Available Potential Energy [J/kg]
CINsfc   0,1,0   0,7,7 ** surface Convective Inhibition [J/kg]
CIN180_0mb  0,108,18000,0   0,7,7 ** 180-0 mb above ground Convective Inhibition [J/kg]
CIN90_0mb  0,108,9000,0   0,7,7 ** 90-0 mb above ground Convective Inhibition [J/kg]
CIN255_0mb  0,108,25500,0   0,7,7 ** 255-0 mb above ground Convective Inhibition [J/kg]
CLMRprs    32,100  0,1,22 ** (1000 975 950 925 900.. 70 50 30 20 10) Cloud Mixing Ratio [kg/kg]
CWATclm   0,200,0   0,6,6 ** entire atmosphere (considered as a single layer) Cloud Water [kg/m^2]
DPT30_0mb  0,108,3000,0   0,0,6 ** 30-0 mb above ground Dew Point Temperature [K]
GPA1000mb   0,100,100000   0,3,9 ** 1000 mb Geopotential Height Anomaly [gpm]
GPA500mb   0,100,50000   0,3,9 ** 500 mb Geopotential Height Anomaly [gpm]
HGTsfc   0,1,0   0,3,5 ** surface Geopotential Height [gpm]
HGTprs    37,100  0,3,5 ** (1000 975 950 925 900.. 7 5 3 2 1) Geopotential Height [gpm]
HGT2pv   0,109,2e-06   0,3,5 ** PV=2e-06 (Km^2/kg/s) surface Geopotential Height [gpm]
HGTneg2pv   0,109,-2e-06   0,3,5 ** PV=-2e-06 (Km^2/kg/s) surface Geopotential Height [gpm]
HGTtop0C   0,204,0   0,3,5 ** highest tropospheric freezing level Geopotential Height [gpm]
HGT0C   0,4,0   0,3,5 ** 0C isotherm Geopotential Height [gpm]
HGTmwl   0,6,0   0,3,5 ** max wind Geopotential Height [gpm]
HGTtrop   0,7,0   0,3,5 ** tropopause Geopotential Height [gpm]
HLCY3000_0m  0,103,3000,0   0,7,8 ** 3000-0 m above ground Storm Relative Helicity [m^2/s^2]
HLCY1000_0m  0,103,1000,0   0,7,8 ** 1000-0 m above ground Storm Relative Helicity [m^2/s^2]
LFTXsfc   0,1,0   0,7,192 ** surface Surface Lifted Index [K]
O3MRprs    37,100  0,14,192 ** (1000 975 950 925 900.. 7 5 3 2 1) Ozone Mixing Ratio [kg/kg]
PLI30_0mb  0,108,3000,0   0,7,0 ** 30-0 mb above ground Parcel Lifted Index (to 500 hPa) [K]
POTsig995   0,104,0.995   0,0,2 ** 0.995 sigma level Potential Temperature [K]
PRESsfc   0,1,0   0,3,0 ** surface Pressure [Pa]
PRESmsl   0,101,0   0,3,0 ** mean sea level Pressure [Pa]
PRES2pv   0,109,2e-06   0,3,0 ** PV=2e-06 (Km^2/kg/s) surface Pressure [Pa]
PRESneg2pv   0,109,-2e-06   0,3,0 ** PV=-2e-06 (Km^2/kg/s) surface Pressure [Pa]
PRESmwl   0,6,0   0,3,0 ** max wind Pressure [Pa]
PREStrop   0,7,0   0,3,0 ** tropopause Pressure [Pa]
PRMSLmsl   0,101,0   0,3,1 ** mean sea level Pressure Reduced to MSL [Pa]
PWAT30_0mb  0,108,3000,0   0,1,3 ** 30-0 mb above ground Precipitable Water [kg/m^2]
PWATclm   0,200,0   0,1,3 ** entire atmosphere (considered as a single layer) Precipitable Water [kg/m^2]
RHprs    37,100  0,1,1 ** (1000 975 950 925 900.. 7 5 3 2 1) Relative Humidity [%]
RHsg330_1000  0,104,0.33,1   0,1,1 ** 0.33-1 sigma layer Relative Humidity [%]
RHsg440_1000  0,104,0.44,1   0,1,1 ** 0.44-1 sigma layer Relative Humidity [%]
RHsg720_940  0,104,0.72,0.94   0,1,1 ** 0.72-0.94 sigma layer Relative Humidity [%]
RHsg440_720  0,104,0.44,0.72   0,1,1 ** 0.44-0.72 sigma layer Relative Humidity [%]
RHsig995   0,104,0.995   0,1,1 ** 0.995 sigma level Relative Humidity [%]
RH30_0mb  0,108,3000,0   0,1,1 ** 30-0 mb above ground Relative Humidity [%]
RHclm   0,200,0   0,1,1 ** entire atmosphere (considered as a single layer) Relative Humidity [%]
RHtop0C   0,204,0   0,1,1 ** highest tropospheric freezing level Relative Humidity [%]
RH0C   0,4,0   0,1,1 ** 0C isotherm Relative Humidity [%]
SPFHprs    37,100  0,1,0 ** (1000 975 950 925 900.. 7 5 3 2 1) Specific Humidity [kg/kg]
SPFH30_0mb  0,108,3000,0   0,1,0 ** 30-0 mb above ground Specific Humidity [kg/kg]
STRMprs    37,100  0,2,4 ** (1000 975 950 925 900.. 7 5 3 2 1) Stream Function [m^2/s]
TMPprs    37,100  0,0,0 ** (1000 975 950 925 900.. 7 5 3 2 1) Temperature [K]
TMP_1829m   0,102,1829   0,0,0 ** 1829 m above mean sea level Temperature [K]
TMP_2743m   0,102,2743   0,0,0 ** 2743 m above mean sea level Temperature [K]
TMP_3658m   0,102,3658   0,0,0 ** 3658 m above mean sea level Temperature [K]
TMP_4572m   0,102,4572   0,0,0 ** 4572 m above mean sea level Temperature [K]
TMPsig995   0,104,0.995   0,0,0 ** 0.995 sigma level Temperature [K]
TMP30_0mb  0,108,3000,0   0,0,0 ** 30-0 mb above ground Temperature [K]
TMP2pv   0,109,2e-06   0,0,0 ** PV=2e-06 (Km^2/kg/s) surface Temperature [K]
TMPneg2pv   0,109,-2e-06   0,0,0 ** PV=-2e-06 (Km^2/kg/s) surface Temperature [K]
TMPmwl   0,6,0   0,0,0 ** max wind Temperature [K]
TMPtrop   0,7,0   0,0,0 ** tropopause Temperature [K]
TOZNEclm   0,200,0   0,14,0 ** entire atmosphere (considered as a single layer) Total Ozone [DU]
UGRDprs    37,100  0,2,2 ** (1000 975 950 925 900.. 7 5 3 2 1) U-Component of Wind [m/s]
UGRD_1829m   0,102,1829   0,2,2 ** 1829 m above mean sea level U-Component of Wind [m/s]
UGRD_2743m   0,102,2743   0,2,2 ** 2743 m above mean sea level U-Component of Wind [m/s]
UGRD_3658m   0,102,3658   0,2,2 ** 3658 m above mean sea level U-Component of Wind [m/s]
UGRD_4572m   0,102,4572   0,2,2 ** 4572 m above mean sea level U-Component of Wind [m/s]
UGRDsig995   0,104,0.995   0,2,2 ** 0.995 sigma level U-Component of Wind [m/s]
UGRD30_0mb  0,108,3000,0   0,2,2 ** 30-0 mb above ground U-Component of Wind [m/s]
UGRD2pv   0,109,2e-06   0,2,2 ** PV=2e-06 (Km^2/kg/s) surface U-Component of Wind [m/s]
UGRDneg2pv   0,109,-2e-06   0,2,2 ** PV=-2e-06 (Km^2/kg/s) surface U-Component of Wind [m/s]
UGRDmwl   0,6,0   0,2,2 ** max wind U-Component of Wind [m/s]
UGRDtrop   0,7,0   0,2,2 ** tropopause U-Component of Wind [m/s]
USTM6000_0m  0,103,6000,0   0,2,194 ** 6000-0 m above ground U-Component Storm Motion [m/s]
VGRDprs    37,100  0,2,3 ** (1000 975 950 925 900.. 7 5 3 2 1) V-Component of Wind [m/s]
VGRD_1829m   0,102,1829   0,2,3 ** 1829 m above mean sea level V-Component of Wind [m/s]
VGRD_2743m   0,102,2743   0,2,3 ** 2743 m above mean sea level V-Component of Wind [m/s]
VGRD_3658m   0,102,3658   0,2,3 ** 3658 m above mean sea level V-Component of Wind [m/s]
VGRD_4572m   0,102,4572   0,2,3 ** 4572 m above mean sea level V-Component of Wind [m/s]
VGRDsig995   0,104,0.995   0,2,3 ** 0.995 sigma level V-Component of Wind [m/s]
VGRD30_0mb  0,108,3000,0   0,2,3 ** 30-0 mb above ground V-Component of Wind [m/s]
VGRD2pv   0,109,2e-06   0,2,3 ** PV=2e-06 (Km^2/kg/s) surface V-Component of Wind [m/s]
VGRDneg2pv   0,109,-2e-06   0,2,3 ** PV=-2e-06 (Km^2/kg/s) surface V-Component of Wind [m/s]
VGRDmwl   0,6,0   0,2,3 ** max wind V-Component of Wind [m/s]
VGRDtrop   0,7,0   0,2,3 ** tropopause V-Component of Wind [m/s]
VPOTprs    37,100  0,2,5 ** (1000 975 950 925 900.. 7 5 3 2 1) Velocity Potential [m^2/s]
VSTM6000_0m  0,103,6000,0   0,2,195 ** 6000-0 m above ground V-Component Storm Motion [m/s]
VVELprs    37,100  0,2,8 ** (1000 975 950 925 900.. 7 5 3 2 1) Vertical Velocity (Pressure) [Pa/s]
VVELsig995   0,104,0.995   0,2,8 ** 0.995 sigma level Vertical Velocity (Pressure) [Pa/s]
VWSH2pv   0,109,2e-06   0,2,192 ** PV=2e-06 (Km^2/kg/s) surface Vertical Speed Shear [1/s]
VWSHneg2pv   0,109,-2e-06   0,2,192 ** PV=-2e-06 (Km^2/kg/s) surface Vertical Speed Shear [1/s]
VWSHtrop   0,7,0   0,2,192 ** tropopause Vertical Speed Shear [1/s]
ENDVARS
View Code

 

以下翻译自http://cola.gmu.edu/grads/gadoc/descriptorfile.html#VARS 

VARS字段主要格式

VARS varnum

variable_record1

variable_record2

...

variable_record_varnum

ENDVARS

其中varnum为变量的数目,variable_record1,variable_record2,..,为变量的记录

此外,ENDVARS必须是CTL文件的最后一行,在ENDVARS之后出现任何空行都会导致open失败。

每一个变量的记录的格式如下

varname levs units description                                 (Version 2.0.1 or earlier)
varname levs <additional_codes> units description    (Version 2.0.2 or later)
 

varname和units的语法因数据格式(DTYPE)而异。其中,对于GRIB2类型的数据,还可能有<additional_codes>字段。详细的信息:

 

varname

varname 这是一个1-15位的“name"。varname可以包含字母或数字,但第一位必须为字母。

varname(DTYPE netcdf,hdfsds,或hdf5_grid)对于netcdf或者hdfsds格式,varname还可以有一下写法:当SDF中的数据变量的名称不满足GrADS命名约定,或者需要使变量名看起来更短时,需要使用该语法:

SDF_varname=>grads_varname

SDF_varname是SDF文件中给定的变量的名称。对于NetCDF文件,这个名称可以在ncdump输出中出现。SDF_varname恰恰匹配数据中的变量。SDF_varname可能包含大写字母和非数字-字母类型的字符串。

如果SDF_varname满足GrADS变量名约定,也可以直接使用它作为grads_varname

(GrADS varsion 2.0.a3+)如果SDF_varname包含了空格,对于每个空格用"~"替换。解析了描述文件后,在变量名中空格将会被替换回来。

(GrADS varsion 2.0.a7+)对于hdf5_grid类型的数据,由于他包含了多层的组(用”/"分隔开),变量名可能非常长。比如:/HDFEOS/GRIDS/EarthSurfaceReflectanceClimatology/Data~Fields/MonthlySurfaceReflectance=>msr

 

levs 

给定了变量的层数。levs必须不超过ZDEF中的znum。如果levs为0,表示变量不对应任何垂直层次。表面变量(如海平面气压)的levs为0.

  • 对于DTYPE为station或者bufr类型数据,表面变量的levs值为0,高空变量的levs值为1.(对于bufr数据有一个例外,复制的表面数据的levs值为2)
  • 对于grib2数据,(GrADS varsion 2.0)这是一个逗号分隔的一串数字,提供了变量的垂直维度。在list中的第一个数值是变量包含的垂直层数目,或者如果变量在Z方向不变化,其值为0。在GRIB2参数中剩余的数字给定了垂直层。levs可以包含最多五个逗号分隔的数字:NLEVS,LTYPE,LVAL,LVAL2,LTYPE2
         其中
         NLEVS  = 垂直层数目,如果Z不变化,其值为0(必需)
         LTYPE  = 层次类型标识符(必需)(详细定义,参见https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml
         LVAL     = 第一层的值(对于所有层次类型不是必须的)
         LVAL2    = 第二层的值(仅仅对于两个固定level直接的layer需要)
         LTYPE2 =第2层的层次类型(仅仅在它不同于LTYPE时候需要)

如果NLEVS>0且它后面仅有LTYPE,LVAL的值将由ZDEF条目决定;如果变量有NLEVS条目,且他比ZDEF中的层次数目小,那么LVAL的值将会对应Z轴的第一个NLEVS值;
如果LTYPE100(GRIB2码中描述等压面),LVAL的单位必须是Pascals;LTYPE为101表示平均海平面高度层次,102表示平均海平面以上特定高度层次,103表示地表以上特定高度层次,104表示sigma层次,105表示hybrid层次,106表示地表以下层次,107表示等熵(theta)面,8表示标准大气顶,7表示对流层顶,6表示最大风速层。
如果LVAL的值是ZDEF条目中选取的,使用OPTIONS pascals来将垂直坐标转化成百帕。对于一些level类型,如“平均海平面层”或“对流层顶”,则不需要一个LVAL,LVAL可以省略(参见下面的“slp”)。
如果需要两个LTYPE条目,但LVAL和LVAL2不相同,那么LVAL条目不能省略。相邻的逗号可以用来表示缺失值(参见下面的"cloud")。

例子

hgt            26,100           0,3,5  Geopotential Height [gpm]
hgt500   0,100,50000     0,3,5  Geopotential Height at 500mb [gpm]
slp             0,101            0,3,1        Sea Level Pressure [Pa]
t2m         0,103,2            0,0,0       2-meter Temperature [K]
soilt1       0,106,0,0.1      0,0,0       Soil Temp, 0-0.10m below surface [K]
cloud          0,1,,,8           0,6,1      Total Cloud Cover, from surface to TOA [%]

 外部实用程序 grib2scan 和 wgrib2 在确定用于 GRIB2 数据文件的 levs 字段的值时非常有用。

 

additional_codes

(DTYPE grib2) (可选的)(GrADS varsion 2.0.a3+)当 levs 和 units 字段中的元素不足时,此字段指定唯一标识记录所需的任何其他 GRIB2 代码。仅某些产品定义模板PDT需要它:概率预测(PDT 5 和 9)、百分位数(PDT 6 和 10)和气溶胶的光学特性 (PDT 48)。 additional_codes 字段始终以字母“a”(表示“附加”)开头,后跟一组逗号分隔的数字。数字的数量和含义取决于产品。(此部分略。http://cola.gmu.edu/grads/gadoc/descriptorfile.html)

 

units

units部分用于描述bufr、grib、netcdf 或 hdfsds 格式的数据。它还用于需要特殊“解包”指令的非标准二进制数据文件,以及预投影风分量的特殊情况。如果您描述的数据不属于这些类别中的任何一个,请在units字段中输入值 99。对于包含未预先投影的 4 字节浮点数据的平面二进制文件,此字段被忽略但必须包含在内。输入值 99。

  • units (DTYPE bufr)

(GrADS 版本 1.9) 对于 DTYPE bufr 文件,此字段包含命名变量的 x,y 对。 

  • units(DTYPE grib)

对于grib数据,单位字段指定变量的 GRIB 参数。 gribmap 实用程序使用此信息将描述符文件中列出的变量映射到 GRIB 文件中的数据记录。此参数最多可以包含四个逗号分隔的数字:VV,LTYPE,LVAL,TRI 或者 VV,LTYPE,LVAL,LVAL2。 其中

VV        = GRIB parameter number(必填)(参见https://apps.ecmwf.int/codes/grib/param-db)
LTYPE = 层次类型指标(必填,和levels中的LTYPE相同)
LVAL    = 第 1 级的值(如果 NLEVS=0,则为必需)
LVAL2  = 第2级的值(可选)
TRI      = “时间范围指示器”(可选)

外部实用程序 gribscan 和 wgrib 在确定 GRIB 数据文件的单位字段的值时非常有用。例子:

u     39    33,100               U Winds [m/s]
t      39    11,100               Temperature [K]
ts     0     11,1                   Surface Temperature [K]
tb     0     11,116,60,30     Temperature, 30-60mb above surface [K]
dpt   0     17,100,1000      Dew Point Temperature at 1000 mb [K] 

  • units (DTYPE grib2) 

GRIB2用“学科-类别-编号”的三级表示法表示变量。

(GrADS 2.0 版)对于GRIB2数据,这是一个以逗号分隔的值列表:DISC,CAT,NUM,SP,SP2

 其中,

DISC  = 学科 Discipline(必填) (相关学科的要素编码,如0气象,1水文、2陆面、3卫星遥感、4太空天气、10海洋等(详见https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-1.shtml)
CAT    = 类别 Category (必填)
NUM  = 编号 Number(必填)
SP     = 用于推导参数的统计过程(Statistical Process)(如果参数不是瞬时值,可能需要)(详见https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-10.shtml)
SP2   = 用于插值参数的空间过程(Spatial Process)(仅产品定义模板 4.15 需要)
一些例子是:

u            26,100         0,2,2             U-Component of Wind [m/s]
v            26,100         0,2,3             V-Component of Wind [m/s]
t2max    0,103,2        0,0,5             2-meter Temperature Maximum [K] (NCEP)
t2max    0,103,2        0,0,0,2          2-meter Temperature Maximum [K] (TIGGE)
soilm1   0,106,0,0.1  2,0,192         Soil Moisture, 0-0.10m below surface [K]
catave   10,100         0,19,22,0,3   Spatial Avg. of Clear Air Turbulence [%]
catmax  10,100         0,19,22,2,3   Spatial Max of Clear Air Turbulence [%]

注:一些再分析数据,通过varname无法知道变量名,而需要通过displine,category,number三个参数来确定变量名。参见https://blog.perillaroc.wang/post/2020/04/2020-04-02-grib-notebook-get-field-from-grib2-file/,https://blog.perillaroc.wang/post/2020/03/2020-03-28-grib-notebook-add-local-table/

注2:NCEP定义的参数转换列表:https://www.nco.ncep.noaa.gov/pmb/docs/grib2/GRIB2_parmeter_conversion_table.html

按照产品分类的参数编号:https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-2.shtml 

  • units (DTYPE netcdf,hdfsds 或 hdf5_grid)

(GrADS 版本 1.9)对于 DTYPE netcdf 或 hdfsds 或 hdf5_grid(GrADS 版本 2.0.a7+),单位字段是变量不同维度的逗号分隔列表。以 x、y、z 或 t 表示的尺寸对应于由 XDEF、YDEF、ZDEF 和 TDEF 定义的四个轴。例如,海平面压力等表面变量可能如下所示:

    presSFC=>psfc   0   y,x   Surface Pressure

随时间变化的大气变量(例如位势高度)可能如下所示:

    Height=>hght   17   t,z,y,x   Geopotential Height (m)

单位字段中列出的维度的顺序确实很重要。它们必须描述变量写入 SDF 数据文件时的形状。对于 NetCDF文件,此信息出现在 ncdump 的输出中,位于变量名旁边。
如果您的数据文件包含在非世界坐标维度上也变化的变量(例如直方图间隔、光谱带、集合数),那么您可以在将成为数组索引的变化维度列表中放置一个非负整数的额外维度。例如:
VAR=>hist0   0   0,y,x   First historgram interval for VAR
VAR=>hist1   0   1,y,x   Second historgram interval for VAR
VAR=>hist2   0   2,y,x   Third histogram interval for VAR
此示例中的另一个选项是用直方图间隔填充未使用的 Z 轴:
zdef 3 linear 1 1
...
VAR=>hist   3   z,y,x   VAR Histogram
在这种情况下,GrADS 认为变量“hist”在 Z 中变化,但用户必须记住 Z 层次对应于直方图间隔。后一种技术更容易对数据进行切片,但不是最准确的表示。而且,如果您没有可用的未使用的世界坐标轴,那么您仍然可以访问您的数据。

  • units(非标准二进制)

对于非标准的二进制文件,units 字段用于指示 GrADS 如何读取不符合默认结构或不包含 4 字节浮点数据的二进制文件。 GrADS 假设数据按以下顺序写入(从变化最快的维度开始到最慢的维度):经度 (X)、纬度 (Y)、垂直水平 (Z)、变量 (VAR)、时间 (T)。如果您的二进制数据集是根据不同的维度序列创建或“打包”的,那么您可以使用单位字段来准确告诉 GrADS 如何解包数据。
对于这些非标准二进制文件,units 字段是一系列一个或多个逗号分隔的数字,其中第一个始终为 -1。语法如下:

-1, structure <,arg>

structure有四个选项,概述如下。其中一些选项具有附加属性,他们使用 arg 指定。

-1,10,arg 

(GrADS 1.9 或更早版本)此选项表示“VAR”和“Z”已在维度序列中转置。顺序为:经度(X)、纬度(Y)、变量(VAR)、垂直水平(Z)、时间(T)。因此,所有变量一次写出一个级别。此功能旨在与“phonex”格式的 NASA GCM 数据一起使用。高空prognostic变量被转置,但diagnostic变量没有。因此 arg 为 1 意味着变量已经被 var-z 转置,而 arg 为 2 意味着变量没有。 

-1,20
此选项表示“VAR”和“T”已在维度序列中转置。顺序为:经度(X)、纬度(Y)、垂直水平(Z)、时间(T)、变量(VAR)。因此,一个变量的所有时间都按顺序写出,然后是下一个变量的所有时间,等等。“VAR”和“T”已被转置的数据文件可能不会一起模板化。

-1,30

(GrADS 1.9 或更早版本)此选项处理 X 和 Y 维度被转置并且水平网格是 (lat,lon) 而不是 (lon,lat) 数据的不寻常的情况。此选项会导致 GrADS 的工作效率非常低。但是,它对于初始检查和调试很有用。

-1,40,arg
此选项处理非浮点数据。如果同一个文件中有多个变量,它们必须都是相同的类型。维度序列假定为默认值。辅助参数告诉 GrADS 二进制文件中的数据值类型:
units = -1,40,1     = 1-byte unsigned chars (0-255)
units = -1,40,2     = 2-byte unsigned integers
units = -1,40,2,-1 = 2-byte signed integers
units = -1,40,4     = 4-byte integers 

  • units(预投影风分量)

对于需要使用 PDEF 和旋转的预投影矢量分量数据,GrADS 必须检索 u 和 v 分量才能进行旋转计算。匹配向量分量的新(和推荐)方法是使用 VECTORPAIRS 描述符文件条目。旧技术(对于早于 1.9b4 的版本)是使用变量记录的单位字段。 u 分量变量的单位值必须为 33,v 分量变量的单位值必须为 34。(这是 GRIB 约定)。如果有多个 u/v 对,则使用次要单位值。

 

description

这是变量的文本描述或长名称。最多 140 个字符。

 

@ varname attribute_type attribute_name attribute_value

(GrADS 版本 1.9b4)要补充描述符文件中的元数据,请使用属性注释。属性注释的前两个字符必须是 “@”后跟一个空格 ——这将它与普通注释区分开来(见下文)。属性注释可能出现在描述符文件的任何位置,如果与旧版本的 GrADS 一起使用,它们将被忽略。所有文件属性都可以使用“query attr”命令检索。
varname 可以设置为“global”来描述对整个数据集有效的一般属性。将varname设置为“lon”、“lat”、“lev”或“time”来描述四个坐标轴的属性;否则,请使用变量声明中列出的变量名称之一。如果变量名有别名,请使用 grads_varname 而不是本机 SDF_varname。
attribute_type 应该是以下区分大小写的类型之一:String、Byte、Int16、UInt16、Int32、UInt32、Float32、Float64。
attribute_name 可以是没有空格的任何单个单词或字符串(例如:“units”、“minimum_value”)
只要整个条目的长度不超过 512 个字符,attribute_value 可以是任何字符串。
例如:
@ precip String units mm/day
@ global String documentation http://put.your.documentation.url.here


* comment

您可以通过以 * 开头的条目在描述符文件中添加注释。使用@ 格式化属性注释(见上文)。

 


 

通过units字段查找GRIB2文件的变量信息

从上面的说明,我们知道了ctl文件的vars部分描述了什么信息,下面简要介绍如何通过vars信息来获取描述的变量。

例子:CRA40的数据(GRIB2格式),利用g2ctl.exe生成的ctl文件如下

dset ^CRA40_SINGLEA_2021010100_GLB_0P25_HOUR_V1_1_2.grib2
index ^CRA40_SINGLEA_GLB_0P25_HOUR_V1_1_2.fulltime.idx
undef 9.999E+20
title CRA40_SINGLEA_2021010100_GLB_0P25_HOUR_V1_1_2.grib2
* produced by g2ctl v0.1.8
* command line options: CRA40_SINGLEA_2021010100_GLB_0P25_HOUR_V1_1_2.grib2
* griddef=1:0:(1440 x 721):grid_template=0:winds(N/S): lat-lon grid:(1440 x 721) units 1e-06 input WE:NS output WE:SN res 48 lat 90.000000 to -90.000000 by 0.250000 lon 0.000000 to 359.750000 by 0.250000 #points=1038240:winds(N/S)

dtype grib2
ydef 721 linear -90.000000 0.25
xdef 1440 linear 0.000000 0.250000
tdef 1 linear 00Z01jan2022 6hr
zdef 1 linear 1 1
vars 111
ALBDOsfc   0,1,0   0,19,1,0 ** surface Albedo [%]
APTMP2m   0,103,2   0,0,21 ** 2 m above ground Apparent Temperature [K]
BRTMPtoa   0,8,0   0,4,4 ** top of atmosphere Brightness Temperature [K]
CPOFPsfc   0,1,0   0,1,39 ** surface Percent frozen precipitation [%]
DPT2m   0,103,2   0,0,6 ** 2 m above ground Dew Point Temperature [K]
DPT30_0mb  0,108,3000,0   0,0,6 ** 30-0 mb above ground Dew Point Temperature [K]
GUSTsfc   0,1,0   0,2,22 ** surface Wind Speed (Gust) [m/s]
HGThy1   0,105,1   0,3,5 ** 1 hybrid level Geopotential Height [gpm]
HINDEXsfc   0,1,0   2,4,2 ** surface Haines Index [Numeric]
HLCY3000_0m  0,103,3000,0   0,7,8 ** 3000-0 m above ground Storm Relative Helicity [m^2/s^2]
ICECsfc   0,1,0   10,2,0 ** surface Ice Cover [Proportion]
ICETKsfc   0,1,0   10,2,1 ** surface Ice Thickness [m]
LANDsfc   0,1,0   2,0,0 ** surface Land Cover (0=sea, 1=land) [Proportion]
LHTFLsfc   0,1,0   0,0,10 ** surface Latent Heat Net Flux [W/m^2]
PLI30_0mb  0,108,3000,0   0,7,0 ** 30-0 mb above ground Parcel Lifted Index (to 500 hPa) [K]
PRATEsfc   0,1,0   0,1,7,0 ** surface Precipitation Rate [kg/m^2/s]
PRESl212   0,212,0   0,3,0,0 ** local level type 212 0 Pressure [Pa]
PRESl213   0,213,0   0,3,0,0 ** local level type 213 0 Pressure [Pa]
PRESl222   0,222,0   0,3,0,0 ** local level type 222 0 Pressure [Pa]
PRESl223   0,223,0   0,3,0,0 ** local level type 223 0 Pressure [Pa]
PRESl232   0,232,0   0,3,0,0 ** local level type 232 0 Pressure [Pa]
PRESl233   0,233,0   0,3,0,0 ** local level type 233 0 Pressure [Pa]
PWAT30_0mb  0,108,3000,0   0,1,3 ** 30-0 mb above ground Precipitable Water [kg/m^2]
RH2m   0,103,2   0,1,1 ** 2 m above ground Relative Humidity [%]
SFCRsfc   0,1,0   2,0,1 ** surface Surface Roughness [m]
SHTFLsfc   0,1,0   0,0,11 ** surface Sensible Heat Net Flux [W/m^2]
SNODsfc   0,1,0   0,1,11 ** surface Snow Depth [m]
SNOHFsfc   0,1,0   0,0,16,0 ** surface Snow Phase Change Heat Flux [W/m^2]
SNOWCsfc   0,1,0   0,1,42,0 ** surface Snow Cover [%]
SOILM0_200cm  0,106,0,2   2,0,3 ** 0-2 m below ground Soil Moisture Content [kg/m^2]
SOTYPsfc   0,1,0   2,3,0 ** surface Soil Type [-]
SPFH2m   0,103,2   0,1,0 ** 2 m above ground Specific Humidity [kg/kg]
SPFHhy1   0,105,1   0,1,0 ** 1 hybrid level Specific Humidity [kg/kg]
TCDCclm   0,10,0   0,6,1,0 ** entire atmosphere Total Cloud Cover [%]
TCDCl211   0,211,0   0,6,1,0 ** local level type 211 0 Total Cloud Cover [%]
TCDCl214   0,214,0   0,6,1,0 ** local level type 214 0 Total Cloud Cover [%]
TCDCl224   0,224,0   0,6,1,0 ** local level type 224 0 Total Cloud Cover [%]
TCDCl234   0,234,0   0,6,1,0 ** local level type 234 0 Total Cloud Cover [%]
TCDC475mb   0,100,47500   0,6,1 ** 475 mb Total Cloud Cover [%]
TCDCl244   0,244,0   0,6,1 ** local level type 244 0 Total Cloud Cover [%]
TMPl213   0,213,0   0,0,0,0 ** local level type 213 0 Temperature [K]
TMPl223   0,223,0   0,0,0,0 ** local level type 223 0 Temperature [K]
TMPl233   0,233,0   0,0,0,0 ** local level type 233 0 Temperature [K]
TMPsfc   0,1,0   0,0,0 ** surface Temperature [K]
TMP2m   0,103,2   0,0,0 ** 2 m above ground Temperature [K]
TMPhy1   0,105,1   0,0,0 ** 1 hybrid level Temperature [K]
TSOIL0_10cm  0,106,0,0.1   2,0,2 ** 0-0.1 m below ground Soil Temperature [K]
TSOIL10_40cm  0,106,0.1,0.4   2,0,2 ** 0.1-0.4 m below ground Soil Temperature [K]
TSOIL40_100cm  0,106,0.4,1   2,0,2 ** 0.4-1 m below ground Soil Temperature [K]
TSOIL100_200cm  0,106,1,2   2,0,2 ** 1-2 m below ground Soil Temperature [K]
UFLXsfc   0,1,0   0,2,17,0 ** surface Momentum Flux, U-Component [N/m^2]
UGRD10m   0,103,10   0,2,2 ** 10 m above ground U-Component of Wind [m/s]
UGRDhy1   0,105,1   0,2,2 ** 1 hybrid level U-Component of Wind [m/s]
UGRDl220   0,220,0   0,2,2 ** local level type 220 0 U-Component of Wind [m/s]
VEGsfc   0,1,0   2,0,4 ** surface Vegetation [%]
VFLXsfc   0,1,0   0,2,18,0 ** surface Momentum Flux, V-Component [N/m^2]
VGRD10m   0,103,10   0,2,3 ** 10 m above ground V-Component of Wind [m/s]
VGRDhy1   0,105,1   0,2,3 ** 1 hybrid level V-Component of Wind [m/s]
VGRDl220   0,220,0   0,2,3 ** local level type 220 0 V-Component of Wind [m/s]
VISsfc   0,1,0   0,19,0 ** surface Visibility [m]
WEASDsfc   0,1,0   0,1,13 ** surface Water Equivalent of Accumulated Snow Depth [kg/m^2]
var01196sfc   0,1,0   0,1,196,0 ** surface desc [unit]
var01200sfc   0,1,0   0,1,200 ** surface desc [unit]
var01212sfc   0,1,0   0,1,212,0 ** surface desc [unit]
var021946000_0m  0,103,6000,0   0,2,194 ** 6000-0 m above ground desc [unit]
var021956000_0m  0,103,6000,0   0,2,195 ** 6000-0 m above ground desc [unit]
var02197sfc   0,1,0   0,2,197 ** surface desc [unit]
var02224l220   0,220,0   0,2,224 ** local level type 220 0 desc [unit]
var03194sfc   0,1,0   0,3,194,0 ** surface desc [unit]
var03195sfc   0,1,0   0,3,195,0 ** surface desc [unit]
var03196sfc   0,1,0   0,3,196 ** surface desc [unit]
var04192toa   0,8,0   0,4,192,0 ** top of atmosphere desc [unit]
var04192sfc   0,1,0   0,4,192 ** surface desc [unit]
var04193toa   0,8,0   0,4,193,0 ** top of atmosphere desc [unit]
var04193sfc   0,1,0   0,4,193 ** surface desc [unit]
var04194sfc   0,1,0   0,4,194,0 ** surface desc [unit]
var04195sfc   0,1,0   0,4,195,0 ** surface desc [unit]
var04196sfc   0,1,0   0,4,196,0 ** surface desc [unit]
var04198sfc   0,1,0   0,4,198,0 ** surface desc [unit]
var04198toa   0,8,0   0,4,198,0 ** top of atmosphere desc [unit]
var04200sfc   0,1,0   0,4,200,0 ** surface desc [unit]
var04201sfc   0,1,0   0,4,201,0 ** surface desc [unit]
var04202sfc   0,1,0   0,4,202,0 ** surface desc [unit]
var04203sfc   0,1,0   0,4,203,0 ** surface desc [unit]
var05192sfc   0,1,0   0,5,192 ** surface desc [unit]
var05193toa   0,8,0   0,5,193,0 ** top of atmosphere desc [unit]
var05193sfc   0,1,0   0,5,193 ** surface desc [unit]
var05195sfc   0,1,0   0,5,195,0 ** surface desc [unit]
var05195toa   0,8,0   0,5,195,0 ** top of atmosphere desc [unit]
var05196sfc   0,1,0   0,5,196,0 ** surface desc [unit]
var06193l200   0,200,0   0,6,193,0 ** local level type 200 0 desc [unit]
var06201sfc   0,1,0   0,6,201 ** surface desc [unit]
var201920_10cm  0,106,0,0.1   2,0,192 ** 0-0.1 m below ground desc [unit]
var2019210_40cm  0,106,0.1,0.4   2,0,192 ** 0.1-0.4 m below ground desc [unit]
var2019240_100cm  0,106,0.4,1   2,0,192 ** 0.4-1 m below ground desc [unit]
var20192100_200cm  0,106,1,2   2,0,192 ** 1-2 m below ground desc [unit]
var20193sfc   0,1,0   2,0,193 ** surface desc [unit]
var20195sfc   0,1,0   2,0,195 ** surface desc [unit]
var20196sfc   0,1,0   2,0,196 ** surface desc [unit]
var20198sfc   0,1,0   2,0,198 ** surface desc [unit]
var20201sfc   0,1,0   2,0,201 ** surface desc [unit]
var20228sfc   0,1,0   2,0,228 ** surface desc [unit]
var20229sfc   0,1,0   2,0,229,0 ** surface desc [unit]
var20230sfc   0,1,0   2,0,230,0 ** surface desc [unit]
var231920_10cm  0,106,0,0.1   2,3,192 ** 0-0.1 m below ground desc [unit]
var2319210_40cm  0,106,0.1,0.4   2,3,192 ** 0.1-0.4 m below ground desc [unit]
var2319240_100cm  0,106,0.4,1   2,3,192 ** 0.4-1 m below ground desc [unit]
var23192100_200cm  0,106,1,2   2,3,192 ** 1-2 m below ground desc [unit]
var23194sfc   0,1,0   2,3,194 ** surface desc [unit]
var23198sfc   0,1,0   2,3,198,0 ** surface desc [unit]
var23203sfc   0,1,0   2,3,203 ** surface desc [unit]
ENDVARS
CRA40_SINGLEA_2021010100.ctl

在文件的VARS部分,定义了不同的变量。

1. 对于其中部分变量,可以直接根据varname的字面意思推断出它表示了哪些变量。通常,前面几个大写的字母表示了变量名称,后面紧跟的的数字+小写字母表示了变量的所在层次。如ALBDOsfc,表示的是地表(sfc)的返照率(albedo);DPT2m,表示的是地表2m的露点温度(dew point);PWAT30_0mb表示从30到0mb之间层次的的可降水量(precipitable water);PRESl212表示在l212层次下的气压(Pressure)。

2. 而对于另一些变量,它们的varname格式为“var"后面跟一串数字和字母,则无法根据varname的字面意思直接推断出表示哪些变量。这时候,需要再看看后面的levels, units, 和descrpition字段,确定它具体表示的变量信息。比如对于这一行:

var20230sfc   0,1,0   2,0,230,0 ** surface desc [unit]

从它的varname我们仅能知道它表示的是地面变量。

接着看下一个字段,0,1,0,这个字段定义了变量的层次。其中第一个数字0表示该变量的垂直层次只有1层;第二个数字0表示的层次类型为地面层;第三个数字0表示该变量的层次高度为0(为地表变量)。

再看下一个字段,2,0,230,0,这个字段定义的是变量的内容。其中第一个数字表示变量的学科代码为2,表示是属于陆面学科;第二个数字0表示是在上述学科中编号为0的子类(查表可知是植被/生物质类别);第三个数字230,表示是在上述子类中编号230的变量(查表可知为蒸散Transpiration);第四个数字0,表示得到该参数的统计过程,查表可知,0值表示通过平均的方法得到上述变量。

最后一个以*开头的字段为注释,可以知道它表示的是地面的变量。

所以,我们知道了var20230sfc这个变量表示的是地表的蒸散。另外,也可以发现,var后面跟着的那串数字实际上就是学科代码+子类+编号。

 

可以在这个网站,查询学科代码+子类+编号:

https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-1.shtml

posted @ 2022-01-26 16:37  chinagod  阅读(1779)  评论(0编辑  收藏  举报