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
以下翻譯自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值;
如果LTYPE是100(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
在文件的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