GrADSctl文件编写
GrADS学习资料:第2章 数据处理
big-endian、little-endian 用于自动改变二进制位存放顺序
<template> 多个时间序列原始数据文件用一个数据描 述文件统一地描述描述这些原始数据时采用的选项, 这些数据文件的文件名形式由 dset 定义的形式命名 文件名,提示所含数据的时次。
例如:
正确的替换为: %y2 两位数年 %y4 4 位数年 %m1 1 或2 位数月 %m2 2 位数月(用 0补齐 1 位数) %mc 3 字符月份缩写 %d1 1 或2 位数天 %d2 2 位数天 %h1 1 或2 位数小时 %h2 2 位小时
设置X方向格点与经度的对应关系
XDEF number <LINEAR Start increment> 或 XDEF number <LEVELS value-list>
number(>=1)给定格点数,整形; LINEAR指明是等间隔分布格点, Start起点坐标,负数表示西经; increment网格间距。 LEVELS参数指明是不等间隔分布格点,列 出具体每个格点的坐标值(以空格分开)。
open(1,file='u.dat')
open(2,file='v.dat')
open(3,file='sst.dat')
! 打开目标文件
open(12,file='mhy.grd',form='binary')
! 把数据文件读入
do 100 it=1,nt do 50 iz=1,nz
read(1,*) ((u(i,j,iz,it),i=1,nx),j=1,ny) 50 continue
Grads使用手册
1
令。详见§6。 (4) .exe 系统命令文件,是 GrADS 系统在 DOS 环境下的各执行文件。如 grads.exe 为 GrADS
图形分析和显示命令;dos4gw.exe 为 DOS 的扩展环境;gxps.exe、gxpsc.exe、gxpscw.exe 都是图元文件转换为 postscript 文件的执行文件;gxtran.exe 是图元文件转换到显示器上 显示的执行文件;gx.exe 是将图元文件转换为各种不带 ps 解释器的打印机输出的执行文 件。详见§1.3。 (5) .gmf(.met) GrADS 系统图元输出文件,格式由 GrADS 内定,文件名随用户自定,
中国科学院大气物理研究所 大气科学和地球流体力学数值模拟国家重点实验室 National Key Laboratory of Numerical Modelling for Atmospheric Sciences and Geophysical Fluid Dynamics ( LASG ) Institute of Atmospheric Physics, Chinese Academy of Sciences
gradsnc
GrADS with readline, printim, LATS, read/write NetCDF
gradshdf GrADS with readline, printim, LATS, read/write HDF, read NetCDF
gribmap
"Maps" a GRIB data set to a GrADS descriptor file
§1.3 基本操作
新版本的 GrADS 交互环境中可以使用上下左右箭头键对曾经使用的命令进行调用和编 辑,但仅限于本次启动 GrADS 交互环境后所使用的命令。
GrADS学习资料:实习五各类参数设置综合练习 实习六
it=1
while(it<=5)
‘set lev 500 ’
‘set lon 120 270’ ‘set lat –10 10’
(设置维数环境)
‘set t ‘it’’
‘d u ’
it=it+1
endwhile
‘disable fwrite’
(关闭文件u.grd)
实习六 练习描述语言的使用
ctl写法见第二章,注意数据的维度设置要 按照数据实际大小来设置。
缺测值一定要与原数据一致。
fortran转换数据,与第一个实习刚好相反, 自己编程.
3.实习要求: 2)根据所得数据资料,利用For十进制数据文件sst.txt。 3)根据所得sst.grd数据文件,编写相应的数
据描述文件sst.ctl,并绘制图形。请将所绘 图形与使用原来sst.mnmean.nc资料在相同维 数环境下所画图形进行比较,看是否一致。
1. 实习目的: 掌握GrADS软件数据提取方法,学会资料处
理。
实习六 练习描述语言的使用
2.实习资料:
“data”文件夹下有全球海表温度资料 sst.mnmean.nc。
注意:海温时间从1854年1月开始。
nc文件打开:sdfopen 路径\ sst.mnmean.nc
nc文件的维数设置、格距、缺测值的查询: q ctlinfo
实习五 各类参数设置综合练习
3. 实习要求: 利用所提供的数据文件,编写.gs文件:
绘制出2002年1-12月120 E、 0-40N 200hPa 纬向风的纬度-时间剖面图。
(1)纬向风为西风时填色,东风绘制等值线, 给出色标,0值线加粗;
(2)X轴标注为“time”,Y轴标注为“lat”,标 题标注为“u 120E”。
grads处理多个ctl文件和nc文件
grads处理多个ctl文件和nc文件2011-10-10 21:03:59| 分类:grads学习| 标签:|举报|字号大中小订阅下载LOFTER我的照片书 |用grads处理多个相同格式的数据时若单个单个处理非常麻烦,当文件非常多的时候是单个处理是不实际的。
下面介绍一种方法;第一步,在这种情况下可以重新写一个ctl描述文件,其文件变量都和已知的ctl相同,若原来的n 文件只是时间不同,那么新描述文件的时间维数是所有原文件的时间的和。
同样,若其他维数不同时也用同样的方法处理。
第二步,在第一行之后添加一行:options template 表示多个时间序列原始数据文件想用一个描述文件统一地描述。
这些原数据的原文件名由dset定义的形势命名文件名。
第三步,修改dset 的文件名。
原路径不变,把文件名用%表示。
其中:%y2 代表两位数年%y4 代表四位数年%m1 代表一位或者两位数的月%m2 代表两位数月(用0补齐1位数)%mc 3个字符月份的缩写%d1 1或2位天%d2 两位天%h1 1或者2位时%h2 2位时例如:原文件其中之一的文件名为gdas2006050812f00,且所有文件只有天和时的变化那么新描述文件的文件名为:gdas200605%d2%h2f00另外如果源文件里有index项的话,需要修改其idx的文件名,假设改成fnl.idx。
并用在dos下用gribmap函数生成一个新的idx文件。
gribmap -e -i fnl.ctl(加绝对路径)open fnl.ctl就可以打开所有文件。
*************************************************************************************************************** *******************若想要提取从1951-2006年56年nc文件中的某些数据,一个一个处理非常麻烦,这里介绍种较为简易的方法。
GrADS读取NetCDF和HDF的ctl文件SDF文件的描述文件
GrADS读取NetCDF和HDF的ctl⽂件SDF⽂件的描述⽂件翻译⾃使⽤GrADS阅读NetCDF和HDF⽂件NetCDF和HDF格式的⽂件被称作⾃描述⽂件(self-describing file, SDF),因为数据和元数据⼀块保存在同⼀个⽂件中。
GrADS可以读取NetCDF和HDF格式的⽂件,只要数据是存储在⼀个规范⽹格。
HDF格式是⾮常通⽤的;GrADS接⼝仅适⽤于5-D的(lon/lat/lev/time/ensemble)⽹格化数据集。
GrADS处理HDF4科学数据集和部分HDF5⽂件。
为了读取⾃描述⽂件SDF,GrADS需要⼀个特定的源数据为了将,GrADS需要⼀定数量的元数据,从⽽将数据放置在内部⽹格空间中。
有三种⽅式可以做到这些:1. 使⽤命令打开⽂件。
这为⽤户省去了最少的⼯作-只需提供⽂件名(或OPeNDAP URL),其余的⼯作由GrADS完成。
如果使⽤sdfopen命令打开SDF,则GrADS所需的⽂件中的所有元数据都必须符合。
"sdfopen"界⾯不⽀持HDF5格式。
如果sdfopen不起作⽤,则...2. 使⽤命令打开⽂件。
这需要进⾏更多的⼯作-您必须编写⼀个数据描述⽂件来补充或替换现有的元数据,以便GrADS能够理解它。
xdfopen使⽤的描述符⽂件的语法与栅格化⼆进制数据(gridded binary data)的描述符⽂件中使⽤的语法不完全相同-有关更多详细信息,请参见。
xdfopen命令提供对更多SDF⽂件的访问,包括许多不符合任何已知标准的SDF。
"xdfopen"界⾯不⽀持HDF5格式。
如果xdfopen不起作⽤,则...3. 使⽤命令打开⽂件。
这要求⽤户编写⼀个完整的GrADS描述符⽂件,以覆盖⽂件中的所有元数据。
下⾯给出了为NetCDF,HDF-SDS或HDF5⽹格数据⽂件组成完整描述符⽂件的指南。
另请参考。
grads批处理ctl文件和用cmd生成idx文件的步骤
grads批处理ctl文件和用cmd生成idx文件的步骤(2009-07-31 14:30:09)
分类:科研笔记标签:grads软件ctl idx批处理气
象教育
一:grads批处理涉及idx文件的grib资料时,编辑grads批处理所需要的ctl文件:(一般可以把已存在的第一个时次的ctl文件进行更改后另存为一个新的ctl文件即可,比如本次批处理的原来的ctl名字都是200206xxxx.ctl形式,则可以新建一个200206.ctl 作为grads将来要调用的ctl文件)
)
grib200206%d2%h2时间循环
options template多个时间序列原始数据文件想用一个数据描述文件统一地描述这些原始数据时采用的选项。
必不可少,且注意其位置。
grib200206.idx将要生成的idx文件
120本次批处理总共的时次个数
00Z01jun2002批处理的起始时间
6hr相邻时次的时间间隔
其他的部分不需要更改。
二:用cmd生成idx文件
进入cmd界面
“>”后输入’gribmap –e’,然后回车键,出现以下界面
提示行后输入ctl文件的路径和名字
按回车键后开始运行
运行结束后显示以下界面,idx文件生成。
至此,有了ctl文件和idx文件,然后就可以用GrADS软件快速方便的进行批处理了。
GrADS第4章 各类参数设置
'set gxout line' 'set cstyle 1' 'set cmark 0' 'set ccolor 2' set lfcols col1 col2 'd v.4' 'set gxout line' d line1;line2 当line1<line2时,用颜色1(col1) 'set cstyle 1' 'set cmark 0' 当line1>line2时,用颜色2(col2) 'set ccolor 1' 'd v.5 ' 'set gxout linefill' 'set lfcols 4 10' 'd v.4; v.5'
不固定 不固定
不固定
一维曲线图
4.2 图形类型的设置
当维数环境确定后,缺省情况下, 一维变量输出的图形为单线图,二 维变量为等值线图,改变缺省图形 输出类型的命令为: set gxout graphics_type
1. 格点数据
contour: 二维等值线图(缺省设置) set gxout contour shaded: 二维填色图(通常与contour并用) 先画填色图,再画等值线图;否则等值线会 被覆盖。 set gxout shaded d hgt set gxout contour d hgt
3. 维数环境的定义
(1)一种是地球坐标(world coordinate)
以经纬度为度量单位。 形式如下: set lon|lat|lev|time val1 <val2> (2)一种是格点坐标(gridcoordinate) 以网格点数为度量单位。 形式如下: set x | y | z | t val1 <val2>
GrADSctl文件编写
Components of a GrADS Data Descriptor FileDSET data_filenameback to topThis entry specifies the filename of the data file being described. If the data and the descriptor file are not in the same directory, then data_filename must include a full path. If a ^ character is placed in front of data_filename,then data_filename is assumed to be relative to the path of the descriptor file. If you are using the ^ character in the DSET entry, then the descriptor file and the data file may be moved to a new directory without changing any entries in the data descriptor file, provided their relative paths remain the same. For example:If the data descriptor file is:/data/wx/grads/sa.ctland the binary data file is:/data/wx/grads/sa.datthen the data file name in the data descriptor file can be:DSET ^sa.datinstead of:DSET /data/wx/grads/sa.datIf data_filename does not include a full path or a ^, then GrADS will only look for data files in the directory where you are running GrADS.GrADS allows you use a single DSET entry to aggregate multiple data files and handle them as if they were one individual file. The individual data files must be identical in all dimensions except time, and the time range of each individual file must be indicated it its filename. To accomplish this, the DSET entry has a substitution template instead of a filename. See the section on Using Templates for a description of all the possible components of the template. Second, the OPTIONS entry must contain the template keyword.CHSUB t1 t2 stringback to top(GrADS version 1.9b4) This entry is used with a new option for templating data files that allows for any user-specified string substitution, instead of only date string substitution. This is useful when none of the standard template options match the time ranges in the files you wish to aggregate, or if the files are located on different disks. When you put the %ch template inyour DSET entry, then you also need to put additional CHSUB entries in the descriptor file. The string will be substituted for%ch in the data file name for the time steps beginning with t1 and ending with t2.See the section on Using Templates for examples.DTYPE keywordback to topThe DTYPE entry specifies the type of data being described. There are four options: grib, hdfsds, netcdf, or station. If the data type is none of these, then the DTYPE entry is omitted completely from the descriptor file and GrADS will assume the data type is gridded binary.bufr (GrADS version 1.9) Data file is a BUFR station data file. This data type must be accompanied by the following special entries: XVAR, YVAR, TVAR, STID. Optional special entries are: ZVAR, TOFFVAR.grib Data file is an indexed GRIB (version 1) file. This data type requires a secondary entry in the descriptor file:INDEX. The INDEX entry provides the filename (including the full path or a ^) for the GRIB index file. Theindex file is created by the gribmap utility. You must run gribmap and create the index file before you candisplay the GRIB data in GrADS.grib2 (GrADS version 2.0) Data file is an indexed GRIB2 file. This data type requires a secondary entry in the descriptor file: : INDEX. The INDEX entry provides the filename (including the full path or a ^) for the GRIB2index file. The index file is created by the gribmap utility. You must run grib2map and create the index filebefore you can display the GRIB2 data in GrADS.hdfsds (GrADS version 1.9) Data file is an HDF Scientific Data Set (SDS). Although HDF-SDS files are self-describing and may be read automatically using the sdfopen/xdfopen commands, this DTYPE gives youthe option of overriding the file's own metadata and creating a descriptor file for some or all of the variablesin the file. This DTYPE may also be used if the metadata in the HDF-SDS file is insufficient or is notcoards-compliant. This data type requires a special entry in the units field of the variabledeclaration. The undef and unpack entries contain special options for this dtype.hdf5_grid (GrADS version 2.0.a7+) Data file is HDF5 gridded format. The HDF5 format is extremely general and is designed to store a variety of data types. The GrADS interface is only for grids, and requires a completedescriptor file -- there is no sdfopen/xdfopen interface for HDF5.netcdf (GrADS version 1.9) Data file is NetCDF. Although NetCDF files are self-describing and may be read automatically using the sdfopen/xdfopen commands, this DTYPE gives you the option of overriding the file'sown metadata and creating a descriptor file for some or all of the variables in the file. This DTYPE may alsobe used if the metadata in the NetCDF file is insufficient or is not coards-compliant. This data type requires aspecial entry in the units field of the variable declaration. The undef and unpack entries contain specialoptions for this dtype.station Data file is in GrADS station data format. This data type requires a secondary entry in the descriptor file: STNMAP. The STNMAP entry provides the filename (including the full path or a ^) for the station data mapfile. The map file is created by the stnmap utility. You must run stnmap and create the map file before youcan display the station data in GrADS.INDEX filenameback to topThis entry specifies the name of the grib map file. It is required when using the DTYPE grib or grib2 entry to read GRIB formatted data. The file is generated by running the external utility gribmap. or grib2map. Filenaming conventions are the same as those described for the DSET entry.STNMAP filenameback to topThis entry specifies the name of the station map file. It is required when using the DTYPE station entry to readGrADS-formatted station data. The file is generated by running the external utility stnmap. Filenaming conventions are thesame as those described for the DSET entry.TITLE stringback to topThis entry gives brief description of the contents of the data set. String will be included in the output from a query command and it will appear in the directory listing if you are serving this data file with the GrADS-DODS Server (GDS), so it is helpful to put meaningful information in the title field. For GDS use, do not use double quotation marks (") in the title.UNDEF value<undef_attribute_name>back to topThis entry specifies the undefined or missing data value. UNDEF is a required entry even if there are no undefined data. GrADS operations and graphics routines will ignore data with this value from this data set.(GrADS version 1.9b4) An optional second argument has been added for data sets of DTYPE netcdf or hdfsds -- it is the name of the attribute that contains the undefined value. This should be used when individual variables in the data file have different undefined values. After data I/O, the missing values in the grid are converted from the variable undef to the file-wide undef (the numerical value in the first argument of the UNDEF record). Then it appears to GrADS that all variables have the same undef value, even if they don't in the original data file. If the data require a transformation using the attributes named in the UNPACK entry, GrADS assumes the variable undef value corresponds to the data values as they appear in the file,i.e.,before they are transformed using a scale factor and offset. Missing packed data values are thus assigned the file-wide undef value and are never unpacked. Attribute names are case sensitive, and it is assumed that the name is identical for all variables in the netcdf or hdfsds data file. If the name given does not match any attributes, or if no name is given, the file-wide undef value will be used.Example: UNDEF 1e+33 _FillValueUNPACK scale_factor_attribute_name <add_offset_attribute_name>back to top(GrADS version 1.9) This entry is used with DTYPE netcdf, hdfsds, or hdf5_grid (GrADS version 2.0.a7+) for data variables that are 'packed' -- i.e. non-float data that need to be converted to float by applying the following formula:y = x * scale_factor + add_offsetIf your self-describing file does not have an offset attribute, the 2nd argument may be omitted, and the offset will be assigned the default value of 0.0. If your self-describing file has an offset attribute, but not a scale factor, use "NULL" forthe scale_factor_attribute_name. (This "NULL" option is in GrADS version 2.0.0+). Attribute names are case sensitive, and it is assumed that the names are identical for all variables in the netcdf or hdfsds data file. If the names given do not match any attributes, the scale factor will be assigned a value of 1.0 and the offset will be assigned a value of 0.0. The transformation of packed data is done after the undef test has been applied.Examples:UNPACK scale_factor add_offsetUNPACK NULL add_offsetUNPACK Slope InterceptFILEHEADER lengthback to topThis optional entry tells GrADS that your data file has a header record of length bytes that precedes the data. GrADS will skip past this header, then treat the remaineder of the file as though it were a normal GrADS binary file after that point. This optional descriptor file entry is only valid for GrADS gridded data sets.THEADER length HEADERBYTES length<back to topThese two equivalent optional entries tell GrADS that the data file has a header record of length bytes preceding each time block of binary data. Use one or the other but not both. These entries are only valid for GrADS gridded data sets. See the section on structure of a gridded binary data file for more information.TRAILERBYTES lengthback to topThis optional entry tell GrADS that the data file has a trailer record of length bytes following each time block of binary data. This entry is only valid for GrADS gridded data sets. See the section on structure of a gridded binary data file for more information.XYHEADER lengthback to topThis optional entry tells GrADS that the data file has a header record of length bytes preceding each horizontal grid (XY block) of binary data. This entry is only valid for GrADS gridded data sets. See the section on structure of a gridded binary datafile for more information.XVAR x,yback to top(GrADS version 1.9) This entry provides the x,y pair for the station's longitude. This entry is required for DTYPE bufr.YVAR x,yback to top(GrADS version 1.9) This entry provides the x,y pair for the station's latitude. This entry is required for DTYPE bufr.ZVAR x,yback to top(GrADS version 1.9) This entry provides the x,y pair for the station data's vertical coordinate (e.g., pressure). This is an optional entry for DTYPE bufr.STID x,yback to top(GrADS version 1.9) This entry provides the x,y pair for the station ID. This entry is required for DTYPE bufr.TVAR yr x,y mo x,y dy x,y hr x,y mn x,y sc x,yback to top(GrADS version 1.9) This entry provides the x,y pairs for all the base time coordinate variables. Each time unit (year=yr, month=mo, day=dy, hour=hr, minute=mn, second=sc) is presented as a 2-letter abbreviation followed by the x,y pair that goes with that time unit. The time for any individual station report is the base time plus the offset time (see TOFFVAR). All six base time units are not required to appear in the TVAR record, only those that are in the data file. This entry is requiredfor DTYPE bufr.TOFFVAR yr x,y mo x,y dy x,y hr x,y mn x,y sc x,yback to top(GrADS version 1.9) This entry provides the x,y pairs for all the offset time coordinate variables. The syntax is the same as TVAR. The time for any individual station report is the base time plus the offset time. All six offset time units are not required to appear in the TOFFVAR record, only those that are in the data file. This is an optional entry for DTYPE bufr.CACHESIZE bytesback to top(GrADS version 2.0.a8+) This entry overrides the default size of the cache for reading HDF5 or NetCDF4 files. It is not relevant for other data types. It should not be necessary to set the cache size explicitly unless the data file has especially large chunks. Please see the documentation on compression.OPTIONS keywordback to topThis entry controls various aspects of the way GrADS interprets the raw data file. It replaces the old FORMAT record.The keyword argument may be one or more of the following:pascals (GrADS version 2.0) (For DTYPE grib2 only) Indicates that pressure values that appear in the descriptor file (in the ZDEF entry and in the GRIB2 codes in the variable declarations) are given inunits of Pascals. The gribmap utility requires pressure to be given in Pascals. If this keyword ispresent, the pressure level values will be converted to millibars after the gribmap index is generatedand the descriptor file is opened with GrADS. If this keyword is omitted, pressure levels will remain inPascals, and many of the internal functions (which assume a vertical dimension in units of millibars)will not work properly.yrev Indicates that the Y dimension (latitude) in the data file has been written in the reverse order from what GrADS assumes. An important thing to remember is that GrADS still presents the view that thedata goes from south to north. The YDEF statement does not change; it still describes thetransformation from a grid space going from south to north. The reversal of the Y axis is done as thedata is read from the data file.zrev Indicates that the Z dimension (pressure) in the data file has been written from top to bottom, rather than from bottom to top as GrADS assumes. The same considerations as noted above for yrev alsoapply.template Indicates that a template for multiple data files is in use. For more information, see the section on Using Templates.sequential Indicates that the file was written in sequential unformatted I/O. This keyword may be used with either station or gridded data. If your gridded data is written in sequential format, then each record must bean X-Y varying grid. If you have only one X and one Y dimension in your file, then each record in thefile will be one element long (it may not be a good idea to write the file this way).365_day_calendar Indicates the data file was created with perpetual 365-day years, with no leap years. This is used for some types of model ouput.byteswapped Indicates the binary data file is in reverse byte order from the normal byte order of your machine.Putting this keyword in the OPTIONS record of the descriptor file tells GrADS to swap the byte orderas the data is being read. May be used with gridded or station data.The best way to ensure hardware independence for gridded data is to specify the data's source platform. This facilitates moving data files and their descriptor files between machines; the data may be used on any type of hardware without having to worry about byte ordering. The following three OPTIONS keywords are used to describe the byte ordering of a gridded or station data file:big_endian Indicates the data file contains 32-bit IEEE floats created on a big endian platform (e.g., sun, sgi)little_endian Indicates the data file contains 32-bit IEEE floats created on a little endian platform (e.g., iX86, and dec)cray_32bit_ieee Indicates the data file contains 32-bit IEEE floats created on a cray.PDEFback to topPDEF is so powerful it has its own documentation page.XDEF xnum mapping <additional arguments>back to topThis entry defines the grid point values for the X dimension, or longitude. The first argument, xnum, specifies the number of grid points in the X direction. xnum must be an integer >= 1. mapping defines the method by which longitudes are assigned to X grid points. There are two options for mapping:LINEAR Linear mappingLEVELS Longitudes specified individuallyThe LINEAR mapping method requires two additional arguments: start and increment. start is a floating point value that indicates the longitude at grid point X=1. Negative values indicate western longitudes. increment is the spacing between grid point values, given as a positive floating point value.The LEVELS mapping method requires one additional argument, value-list, which explicitly specifies the longitude value for each grid point. value-list should contain xnum floating point values. It may continue into the next record in the descriptor file, but note that records may not have more than 255 characters. There must be at least 2 levels in value-list; otherwise use the LINEAR method.Here are some examples:XDEF 144LINEAR 0.0 2.5XDEF 72LINEAR 0.0 5.0XDEF 12LEVELS 0 30 60 90 120 150 180 210 240 270 300 330XDEF 12LEVELS 15 45 75 105 135 165 195 225 255 285 315 345YDEF ynum mapping <additional arguments>back to topThis entry defines the grid point values for the Y dimension, or latitude. The first argument, ynum, specifies the number of gridpoints in the Y direction. ynum must be an integer >= 1. mapping defines the method by which latitudes are assigned to Y grid points. There are several options for mapping:LINEAR Linear mappingLEVELS Latitudes specified individuallyGAUST62 Gaussian T62 latitudesGAUSR15 Gaussian R15 latitudesGAUSR20 Gaussian R20 latitudesGAUSR30 Gaussian R30 latitudesGAUSR40 Gaussian R40 latitudesThe LINEAR mapping method requires two additional arguments: start and increment. start is a floating point value that indicates the latitude at grid point Y=1. Negative values indicate southern latitides. increment is the spacing between grid point values in the Y direction. It is assumed that the Y dimension values go from south to north, so increment is always positive.The LEVELS mapping method requires one additional argument, value-list, which explicitly specifies the latitude for each grid point, from south to north. value-list should contain ynum floating point values. It may continue into the next record in the descriptor file, but note that records may not have more than 255 characters. There must be at least 2 levels in value-list; otherwise use the LINEAR method.The Gaussian mapping methods require one additional argument: start. This argument indicates the first gaussian grid number. If the data span all latitudes, start would be 1, indicating the southernmost gaussian grid latitude.Here are some examples:YDEF 73LINEAR -90 2.5YDEF 180LINEAR -90 1.0YDEF 18LEVELS -85 -75 -65 -55 -45 -35 -25 -15 -5 5 15 25 35 45 55 65 75 85YDEF 94GAUST62 1YDEF 20GAUSR40 15The NCEP/NCAR Reanalysis surface variables are on the GAUST62 grid.The final example shows that there are 20 Y dimension values which start at Gaussian Latitude 15 (64.10 south) on the Gaussian R40 gridZDEF znum mapping <additional arguments>back to topThis entry defines the grid point values for the Z dimension. The first argument, znum, specifies the number of pressure levels. znum must be an integer >= 1. mapping defines the method by which level values are assigned to Z grid points. There are two options for mapping:LINEAR Linear mappingLEVELS Pressure levels specified individuallyThe LINEAR mapping method requires two additional arguments: start and increment. start is a floating point value that indicates the level value at grid point Z=1. increment is the spacing between grid point values in the Z direction, or from lower to higher. increment must be non-zero and non0negative.The LEVELS mapping method requires one additional argument, value-list, which explicitly specifies the pressure level for each grid point in ascending order. value-list should contain znum floating point values. It may continue into the next record in the descriptor file, but note that records may not have more than 255 characters.Here are some examples:ZDEF 7LEVELS 1000 850 700 500 300 200 100ZDEF 17LEVELS 1000 925 850 700 600 500 400 300 250 200 150 100 70 50(GrADS version 2.0) (For DTYPE grib2 only) If your Z axis is pressure, the gribmap utility requires the level values to be given in units of Pascals instead of millibars. Use the "options pascals" keyword to convert the unit of the level values to millibars after the gribmap index is generated and when the descriptor file is opened with GrADS. Pressure level values may remain in Pascals, but then many of the internal functions (which assume a vertical dimension in units of millibars) will not work properly.TDEF tnum LINEAR start incrementback to topThis entry defines the grid point values for the T dimension. The first argument, tnum, specifies the number of timesteps.tnum must be an integer >= 1. The method by which times are assigned to T grid points is always LINEAR.start indicates the initial time value at grid point T=1. start must be specified in the GrADS absolute date/time format:hh:mm Z ddmmmyyyywhere:hh = hour (two digit integer)mm = minute (two digit integer)dd = day (one or two digit integer)mmm = 3-character monthyyyy = year (may be a two or four digit integer; 2 digits implies a year between 1950 and 2049)If not specified, hh defaults to 00, mm defaults to 00, and dd defaults to 1. The month and year must be specified. No intervening blanks are allowed in the GrADS absolute date/time format.increment is the spacing between grid point values in the T direction. increment must be specified in the GrADS absolute time increment format:vvkkwhere:vv = an integer number, 1 or 2 digitskk = mn (minute)hr (hour)dy (day)mo (month)yr (year)Here are some examples:TDEF 60LINEAR 00Z31dec1999 1mnTDEF 73LINEAR 3jan1989 5dyTDEF 730LINEAR 00z1jan1990 12hrTDEF 12LINEAR 1jan2000 1moTDEF 365LINEAR 12Z1jan1959 1dyTDEF 40LINEAR 1jan1950 1yrEDEF enum NAMES <list of names>back to topEDEF enumensemble_record_1 ensemble_record_2 ...ensemble_record_enum ENDEDEFback to top(GrADS version 2.0) This entry defines the ensemble dimension. All ensemble members must have identical X, Y, and Z dimensions, the same list of variables, and the same time axis increment. There are two different syntaxes for the EDEF entry: the first is simpler and requires only the names for each ensemble member, the second expanded form contains a name, individual time axis information, and optional GRIB2 codes.Both EDEF syntaxes begin with the enum argument, an integer >=1 which specifies the number of ensemble members.If all of the ensemble members have an identical time axis (i.e. length, initial time, and increment are the same for each one), then it is only necessary to distinguish the ensembles by their names, and the simplified EDEF syntax with the NAMES keyword may be used. A simple space-delimited list of names is all that is required. Ensemble names must have between 1 and 15 alphanumeric characters, lower case only. (In version 2.0.0 and later, mixed case ensemble names are allowed). Some examples are:EDEF 10NAMES 1 2 3 4 5 6 7 8 9 10EDEF 12NAMES m01 m02 m03 m04 m05 m06 m07 m08 m09 m10 m11 ensmEDEF 7NAMES e1 e2 e3 e4 e5 e6 e7When the OPTIONS TEMPLATE entry is used with EDEF, the ensemble names are used in the %e substitution template to generate the file name. See Using Templates for more details.If the ensemble members do not have identical time axes (i.e., their lengths or initial times are not the same), or if you need to include the GRIB2 codes, then you must use the expanded EDEF syntax: a collection of records framed by EDEF and ENDEDEF. The format of the ensemble records is as follows:ensname length start <grib2 codes>The ensname is the 1-15 character "name" for the ensemble member. The length is the size of the time axis of the ensemble, which must be less than or equal to the tnum argument in the TDEF entry. (The time axis described by TDEF must span all the ensemble members.) The start argument is the initial time of the ensemble member and must be given in GrADS absolute date/time format. (See TDEF for details).The grib2 codes are required if (1) the DTYPE is grib2 and (2) there is more than one ensemble member (enum > 1). The expanded form of the EDEF entry must be used when grib2 codes are required, even if the length and start times are the same for all members. For GRIB2 ensembles, support currently exists for four different Product Definition Template (PDT) numbers: 1, 2, 11, and 12. These are grouped into two types: individual ensemble forecasts (PDT 1 and 11) or derived forecasts based on all ensemble members (PDT 2 and 12). For individual ensemble forecasts (PDT 1 and 11), twocomma-delimited grib2 codes are required: the ensemble type and perturbation number. For derived forecasts based on all ensemble members (PDT 2 and 12), only one grib2 code is required: the derived forecast. Clarification of all the GRIB2 nomenclature may be found in the documentation at WMO and NCEP. Two examples are given below.The first example illustrates ensemble members with different lengths and start times:TDEF 591 linear 12z09dec1980 12hrEDEF 16ensm 591 12z09dec1980m01 591 12z09dec1980m02 589 12z10dec1980m03 587 12z11dec1980m04 585 12z12dec1980m05 583 12z13dec1980m06 571 12z19dec1980m07 569 12z20dec1980m08 567 12z21dec1980m09 565 12z22dec1980m10 563 12z23dec1980m11 549 12z30dec1980m12 547 12z31dec1980m13 545 12z01jan1981m14 543 12z02jan1981m15 541 12z03jan1981ENDEDEFThe second example illustrates the use of GRIB2 codes:TDEF 31 linear 00z24apr2007 12hrEDEF 23p01 31 00z24apr2007 3,1p02 31 00z24apr2007 3,2p03 31 00z24apr2007 3,3p04 31 00z24apr2007 3,4p05 31 00z24apr2007 3,5p06 31 00z24apr2007 3,6p07 31 00z24apr2007 3,7p08 31 00z24apr2007 3,8p09 31 00z24apr2007 3,9p10 31 00z24apr2007 3,10p11 31 00z24apr2007 3,11p12 31 00z24apr2007 3,12p13 31 00z24apr2007 3,13p14 31 00z24apr2007 3,14p15 31 00z24apr2007 3,15p16 31 00z24apr2007 3,16p17 31 00z24apr2007 3,17p18 31 00z24apr2007 3,18p19 31 00z24apr2007 3,19p20 31 00z24apr2007 3,20c00 31 00z24apr2007 1,0avg 31 00z24apr2007 0spr 31 00z24apr2007 2ENDEDEFVECTORPAIRS U-component,V-componentback to top(GrADS version 1.9b4) This entry is for explicity identifying vector component pairs. This is only necessary if the data are on a native projection other than lat/lon (i.e. you are using PDEF) and if the winds have to be rotated from a grid-relative sense to an Earth-relative sense. (GrADS has to retrieve both the u and v component in order to do the rotation calculation.)Using this entry replaces the old technique of putting 33 (for U) or 34 (for V) in the first element of the units field in the variable declaration. The U-component and V-component arguments should be variable names that appear in the VARS list. They are separated by a comma, with no spaces. More than one pair of components may be listed; in this case, the pairs should be separated by a space. For example:VECTORPAIRS u,v u10,v10 uflx,vflxVARS varnum variable_record_1back to topvariable_record_2...variable_record_varnumENDVARSThis ensemble of entries describes all the variables contained in the data set. varnum indicates the number of variables in the data set and is therefore also equal to the number of variable records that are listed between the VARS and ENDVARS entries. ENDVARS must be the final line of the Grads data descriptor file. Any blank lines after the ENDVARS statement may cause open to fail!The format of the variable records is as follows:varname levs units description (Version 2.0.1 or earlier)varname levs <additional_codes> units description (Version 2.0.2 or later)The syntax of varname and units is different depending on what kind of data format (DTYPE) you are describing.The<additional_codes> are only necessary for certain types of GRIB2 data sets. Details provided below:varname This is a 1-15 character "name" or abbreviation for the data variable. varname may contain alphabetic and numeric characters but it must start with an alphabetic character (a-z).varname (DTYPE netcdf, hdfsds, orhdf5_grid) (GrADS version 1.9+) For DTYPE netcdf or hdfsds, varname may have a different syntax. This syntax is required when the name of the data variable in the SDF does not conform to the GrADS naming conventions (see below for list of criteria), but it may also be used to shorten or change the variable name to make it easier to work with inside GrADS. The syntax is:SDF_varname=>grads_varnameSDF_varname is the name the data variable was given when the SDF file was originally created. For NetCDF files, this name appears in the output from ncdump. It is important that SDF_varname exactly matches the variable name in the data file. SDF_varname may contain uppercase letters andnon-alpha-numeric characters.The classic varname syntax (i.e., when "SDF_varname =>" is omitted) may be used if SDF_varname meets the criteria for GrADS variable names: it must be less than 16 characters, start with an alphabetic character, and cannot contain any upper case letters or non-alpha-numeric characters.(GrADS version 2.0.a3+) If the SDF_varname contains spaces, substitute "~" for each space -- the spaces in the variable name string will be swapped back in later after the descriptor file has been parsed.(GrADS version 2.0.a7+) For dtype hdf5_grid, the SDF_varname may be particularly long since it must contain the names of all the nested groups (separated by "/") to which the data set belongs.For example:/HDFEOS/GRIDS/EarthSurfaceReflectanceClimatology/Data~Fields/MonthlySurfaceReflectance=>msr。
第十章GradsGrADS 描述语言及编程
GRADS (Grid Analysis and Display System)讲义(10)GrADS 描述语言及编程一、描述语言概述描述语言是GrADS软件包中自带的高级语言,可以用于GrADS的高级操作,更方便地使用GrADS 的功能。
通过描述语言可以编写具有复杂功能的命令集(即gs文件)。
二、gs文件中的两类型语句1)描述语句:不用引号,需要经过编译的。
2)指令性语句:GrADS命令,需用引号括起来。
通过描述语句来控制指令描述语言用到指令性语句中要用引号,即,i=1‘set t ‘i’’(或者‘set t ’ i )三、描述语言程序特点1、程序通过GrADS的run命令来编译执行;run file-name options2、可以有变量、流程控制也可以执行GrADS的命令。
3、描述语言可以1)编写函数子程序,2)制作屏幕菜单,3)可以显示动画图形,4)可以使用从GrADS的query命令中得到的信息作注释等。
3、描述语言的所有变量都是字符串型的,描述变量可以进行计算。
流程控制是通过if/else/endif和while/endwhile语句块实现。
循环过程可以用continue或break命令改变。
变量中包含的或者由表达式结果产生的字符串可以作为GrADS命令项使用。
而由GrADS命令执行后产生的文字结果可以读入变量并在描述语言程序中使用。
描述语言也支持函数子程序功能。
四、描述语言的组成1、一个描述语言程序是由许多语句组成,每个语句之间由换行号或分号分隔。
2、下面是GrADS描述语言中语句的类型:赋值语句If / Else / Endifwhile / endwhilebreak / continuefunction header / returnsay / pull3、描述表达式描述表达式是由运算对象和运算符组成。
运算对象:描述变量、子程序函数或常数;运算符:数学、逻辑或连结运算符。
下面分别介绍变量、运算符、表达式4、描述语言变量1)构成变量名是由1至8个字符组成,以字母开头,仅可以包含字母和数字,变量名区分大小写。
第十章GradsGrADS 描述语言及编程
GRADS (Grid Analysis and Display System)讲义(10)GrADS 描述语言及编程一、描述语言概述描述语言是GrADS软件包中自带的高级语言,可以用于GrADS的高级操作,更方便地使用GrADS的功能。
通过描述语言可以编写具有复杂功能的命令集(即gs文件)。
二、gs文件中的两类型语句1)描述语句:不用引号,需要经过编译的。
2)指令性语句:GrADS命令,需用引号括起来。
通过描述语句来控制指令描述语言用到指令性语句中要用引号,即,i=1‘set t ‘i’’(或者‘set t ’ i )三、描述语言程序特点1、程序通过GrADS的run命令来编译执行;run file-name options2、可以有变量、流程控制也可以执行GrADS 的命令。
3、描述语言可以1)编写函数子程序,2)制作屏幕菜单,3)可以显示动画图形,4)可以使用从GrADS的query命令中得到的信息作注释等。
3、描述语言的所有变量都是字符串型的,描述变量可以进行计算。
流程控制是通过if/else/endif和while/endwhile语句块实现。
循环过程可以用continue或break命令改变。
变量中包含的或者由表达式结果产生的字符串可以作为GrADS命令项使用。
而由GrADS命令执行后产生的文字结果可以读入变量并在描述语言程序中使用。
描述语言也支持函数子程序功能。
四、描述语言的组成1、一个描述语言程序是由许多语句组成,每个语句之间由换行号或分号分隔。
2、下面是GrADS描述语言中语句的类型:赋值语句If / Else / Endifwhile / endwhilebreak / continuefunction header / returnsay / pull3、描述表达式描述表达式是由运算对象和运算符组成。
运算对象:描述变量、子程序函数或常数;运算符:数学、逻辑或连结运算符。
下面分别介绍变量、运算符、表达式4、描述语言变量1)构成变量名是由1至8个字符组成,以字母开头,仅可以包含字母和数字,变量名区分大小写。
grads处理多个ctl文件和nc文件解析
grads处理多个ctl文件和nc文件2011-10-10 21:03:59| 分类:grads学习| 标签:|举报|字号大中小订阅下载LOFTER我的照片书 |用grads处理多个相同格式的数据时若单个单个处理非常麻烦,当文件非常多的时候是单个处理是不实际的。
下面介绍一种方法;第一步,在这种情况下可以重新写一个ctl描述文件,其文件变量都和已知的ctl相同,若原来的n文件只是时间不同,那么新描述文件的时间维数是所有原文件的时间的和。
同样,若其他维数不同时也用同样的方法处理。
第二步,在第一行之后添加一行:options template 表示多个时间序列原始数据文件想用一个描述文件统一地描述。
这些原数据的原文件名由dset定义的形势命名文件名。
第三步,修改dset 的文件名。
原路径不变,把文件名用%表示。
其中:%y2 代表两位数年%y4 代表四位数年%m1 代表一位或者两位数的月%m2 代表两位数月(用0补齐1位数)%mc 3个字符月份的缩写%d1 1或2位天%d2 两位天%h1 1或者2位时%h2 2位时例如:原文件其中之一的文件名为gdas2006050812f00,且所有文件只有天和时的变化那么新描述文件的文件名为:gdas200605%d2%h2f00另外如果源文件里有index项的话,需要修改其idx的文件名,假设改成fnl.idx。
并用在dos下用gribmap函数生成一个新的idx文件。
gribmap -e -i fnl.ctl(加绝对路径)open fnl.ctl就可以打开所有文件。
*************************************************************************************************************** *******************若想要提取从1951-2006年56年nc文件中的某些数据,一个一个处理非常麻烦,这里介绍种较为简易的方法。
grads处理多个ctl文件和nc文件
grads处理多个ctl文件和nc文件2011-10-10 21:03:59| 分类:grads学习| 标签:|举报|字号大中小订阅下载LOFTER我的照片书 |用grads处理多个相同格式的数据时若单个单个处理非常麻烦,当文件非常多的时候是单个处理是不实际的。
下面介绍一种方法;第一步,在这种情况下可以重新写一个ctl描述文件,其文件变量都和已知的ctl相同,若原来的n文件只是时间不同,那么新描述文件的时间维数是所有原文件的时间的和。
同样,若其他维数不同时也用同样的方法处理。
第二步,在第一行之后添加一行:options template 表示多个时间序列原始数据文件想用一个描述文件统一地描述。
这些原数据的原文件名由dset定义的形势命名文件名。
第三步,修改dset 的文件名。
原路径不变,把文件名用%表示。
其中:%y2 代表两位数年%y4 代表四位数年%m1 代表一位或者两位数的月%m2 代表两位数月(用0补齐1位数)%mc 3个字符月份的缩写%d1 1或2位天%d2 两位天%h1 1或者2位时%h2 2位时例如:原文件其中之一的文件名为gdas2006050812f00,且所有文件只有天和时的变化那么新描述文件的文件名为:gdas200605%d2%h2f00另外如果源文件里有index项的话,需要修改其idx的文件名,假设改成fnl.idx。
并用在dos下用gribmap函数生成一个新的idx文件。
gribmap -e -i fnl.ctl(加绝对路径)open fnl.ctl就可以打开所有文件。
*************************************************************************************************************** *******************若想要提取从1951-2006年56年nc文件中的某些数据,一个一个处理非常麻烦,这里介绍种较为简易的方法。
GrADS常用指令
1.ctl文件的编写dset d:\test\test1.dat 数据文件路径名和文件名title monthly precipitation data 数据标题options 365_day_calendar 特殊格式说明365_day_calendar/template(多个文件) undef -9999.0 缺测值,若有多个则用fortran改写成同一个缺测值xdef 144 linear 0 2.5 x维数格点数/排列方式/起始值/间隔*linear线性/levels列举ydef 73 linear -90 2.5 y维数zdef 5 linear 1000 850 700 500 200 z维数tdef 24 linear 00z01Jan1979 1mo 时间维数*mo月yr年vars 1 变量数precip 1 99 *precipitation data 变量名/层数/排列顺序/说明endvars*变量循环顺序:x经度y维度z高度v变量t时间*注释行第一列用‘*’,注释行不能出现在变量列表中2.维数环境设置set lon/lat/lev/time var1 <var2> *实际值set x/y/z/t var1 <var2> *格点数值*两种坐标可以混用3.图形文件的保存gxprint/printim **.png/jpg/pdf/eps…. whiteenable print **.gmfprintdisableprint4.图形类型的设置set gxout typecontour 二位等值线图*默认shaded 二维填色等值线图vector 矢量箭头二维风场图*d u;v时为默认bar 直方图line 折线图*默认…………………5.图形要素设置gxout=contour or shadedset cint value 设置等值线间隔set clevs lev1,lev2,……设置特定等值线set ccols col1,col2,……设置对应于set clevs的等值线的颜色cbarn size 0/1 x y 设置色标gxout=line or contourset ccolor color 设置线条颜色set cstyle style设置线条样式1实线2长虚线3短虚线……set cthick thickns 设置线条粗细1~10set cmark marker 设置数据点标记0无标记*line时有效gxout=barset bargap val 设置直方条间隔*0~100百分比,0为无间隔set barbase val/bottom/top 设置直方条起始值gxout=vectorset arrscl size <magnitude> 设置箭头长度set arrowhead size 设置箭头大小,缺省为0.056.gs文件的编写将命令用单引号括起来7.变量define varname=expression 定义变量‘d air(t=3)’‘d air(t=3,z=5)’‘d air(lev=1000)-air(lev=500)’设置变量维数8.平均函数ave(expr,dimexpr1,dimexpr2,<timeint>) 一维平均aave(expr,dimexpr1,dimexpr2, dimexpr3,dimexpr4,) 二维平均*不能对z、t *需将维度设置成点9.地图投影设置set mproj proj 设置地图投影方式latlon 缺省nps 北半球极地投影sps 南半球极地投影set map color style thickness 设置背景地图线条颜色、线型、宽度10.绘图区域设置set parea xmin xmax ymin ymax11.坐标要素控制set frame on/off/circle 绘制图形边框/不绘制/绘制圆形边框set grads on/off 标记grads及绘图时间draw title <string> 绘制标题draw xlab/ylab <string> 绘制x轴/y轴图注set xyrev on/off xy轴互换set zlog on/off z方向用对数坐标set xlint/ylint value 设置x/y轴坐标刻度间隔set vrange val1 val2 设置y轴范围set vrange2 val1 val2 设置x轴范围set xlopts/ylopts color thickness size x/y轴刻度值的颜色、线宽、大小*缺省1,4,0.12 set tlsupp year 去掉年份显示12.颜色的定义‘define_colors’使用内部默认颜色标号13.基本绘图命令set line color style thickness 设置颜色、线型、线宽draw line x1 y1 x2 y2 绘制直线draw rec/recf x1 y1 x2 y2 绘制不填色/填色矩形draw mark type x y size 绘制标记*1叉2空心圆3实心圆4空心方框5实心方框draw string x y string 绘制字符串set strsiz hsiz <vsiz> 设置字符大小14.文件操作(1)输出二进制变量设置维数环境‘set gxout fwrite’‘set fwrite ***.dat’‘d var’(2)读写有格式文件result=read(filename)result 第一行:返回码(0 OK,1打开错误2文件结束8文件状态为写入9I/O错误)result 第二行:读取的文件内容Text = sublin(result,2) 将result相应行的内容赋值给Textaa=subwrd(Text,#n) 将Text的第n个值赋值给aaresult=write(filename, text, <append>)15.维数查询q w2xy lon lat 将经纬度坐标转换为图形窗口坐标返回值:X=*** Y=*** q xy2w X Y 将图形窗口坐标转为经纬度坐标返回值:Lon=*** Lat=***q w2gr lon lat 将经纬度坐标转换为格点坐标返回值:Xdim=*** Ydim=***q gr2w xdim ydim 将格点坐标转换为经纬度坐标返回值:Lon=*** Lat=***q xy2gr X Y 将图形窗口坐标转换为格点坐标返回值:Xdim=*** Ydim=***q gr2xy xdim ydim 将格点坐标转换为经纬度坐标返回值:X=*** Y=***16.气候平均设置季节变量‘set t 1 12’‘define climate=ave(var,t+0,t=tmax,12)’‘modify climate seasonal’滑动平均‘set t 1 tmax’‘define running_mean=ave(var,t-n,t+n)’17.站点资料绘图(1)转换生成数据文件及格点文件数据文件的顺序为先循环站号再循环时间,每条记录包含站号-纬度-经度-时间-nlev-flag-数据,每循环完一个时间后要加一个不写数据且nlev=0的记录(2)编写ctldtype stationstnmap ***.map**变量层数为0(3)生成.map映射文件!stnmap –i */*/*.ctl(4)插值‘open ***\grid.ctl’‘open ***dat.ctl’‘define varname=oacres(grid,var.2)’(5)绘图‘cnbasemap varname’18.绘制路径图。
grads处理多个时次的ncep数据
Step1:利用grib2ctl.exe生成初始时刻ncep数据的ctl文件;示例中生成的是fnl_20090801_00_00_c数据的文件。
Step2:将ctl中相应的信息进行修改:a、将dset的数据集文件名写成代换模块格式;如:dset D:\fog\fnl_200212%d2_%h2_00_c%y2 ===> 两位数年;%y4 ===> 四位数年;%m1 ===> 1或2位数月;%m2 ===> 2位数月(用0补齐一位数);%mc ===> 3字符月份缩写;%d1 ===> 1或2位天;%d2 ===> 2位天;%h1 ===> 1或2位时;%h2 ===> 2位时;b、在第一行后添加一行“options template”定义时间范围和增量;c、tdef number LINEAR start increment,将其中的number和increment(ncep时间间隔为6小时,可写成6hr)设成与所拥有的ncep资料一致;(修改后的信息如图所示,里面的路径需自己设置);Step3:利用gribmap.exe生成与改过后的ctl相对应的idx文件;这样就可以编写gs文件提取所需要时刻的ncep数据了。
gs如下:'reinit''open E:\Morakot_fnl\fnl200908Morakot.ctl''set lat 15 40''set lon 110 145''set fwrite E:\program\data.dat''set gxout fwrite't=1while(t<=61)'set t ' tz=1while(z<=21)'set z ' z'd HGTprs''d RHprs''d TMPprs''d UGRDprs''d VGRDprs''d VVELprs'z=z+1endwhilet=t+1endwhile'disable fwrite''reinit'(注意:此过程为基于GrADs 2.0.a3.oga.1版本的试验,其它版本是否一致不敢保证)。
GrADS绘图软件使用手3
GrADS绘图软件使用手3第三章GrADS数据格式每一组GrADS数据应至少包括两组数据文件,数据描述文件—ASCII 码和数据文件—二进制,数据的真正存放地。
数据文件中只是用户数据的有序排放,而关于数据种类、排放次序等是单独放在一个文件中的称—数据描述文件。
而象GRIB和NETCDF等通用数据格式,以上两者是存于同一个文件的—或称为自定义/自解释格式数据。
但考虑到GrADS传统,对这类自定义格式数据仍将生成相应的数据描述文件。
上一章中我们已使用过了这样的一组数据。
以此为例,介绍用户如何按GrADS的格式,将自己的数据生成相应的数据文件和数据描述文件。
1.格点数据描述文件model.le.ctl文件清单:以某开始的行为注解行。
1.1数据描述文件各项解释1.DSET数据文件名定义与此数据描述文件相对应的数据文件名。
若两者位于同一目录,前面的路经可以省略或以“^”开始,代表两者位于同一目录。
若不在同一目录下,应给出路经参数。
如:c:/pcgrad/ample/model.le.dat56注意路经的给法与DOS不同,而与UNI某环境一致,便于移植!或c:\\pcgrad\\ample\\model.le.dat,两种都行。
2.TITLE数据文件说明文字串。
3.UNDEFvaule定义缺测值。
一般给一很大的正/负值,表示,当取值超过这一正值/低于定义的负值,认为该值无效。
(GrADS采用跳过或用周围有效点的值处理。
)4.OPTIONS这里定义了与二进制存储有关的选项,二进制存储的一大特点是可移植性差,因此通过keyword项来增加可移植性。
若keyword省略,则OPTIONS也可省略。
可取:equential:顺序无格式方式。
yrev:Y维与YDEF定义相反方式存放。
zrev:Z维与ZDEF定义相反方式存放。
big_endian:如数据是在un,gi,hpcray机器上生成的,而目前不在此类机器上使用。
grads处理多个ctl文件和nc文件
grads处理多个ctl文件和nc文件2011-10-10 21:03:59| 分类:grads学习| 标签:|举报|字号大中小订阅下载LOFTER我的照片书 |用grads处理多个相同格式的数据时若单个单个处理非常麻烦,当文件非常多的时候是单个处理是不实际的。
下面介绍一种方法;第一步,在这种情况下可以重新写一个ctl描述文件,其文件变量都和已知的ctl相同,若原来的n文件只是时间不同,那么新描述文件的时间维数是所有原文件的时间的和。
同样,若其他维数不同时也用同样的方法处理。
第二步,在第一行之后添加一行:options template 表示多个时间序列原始数据文件想用一个描述文件统一地描述。
这些原数据的原文件名由dset定义的形势命名文件名。
第三步,修改dset 的文件名。
原路径不变,把文件名用%表示。
其中:%y2 代表两位数年%y4 代表四位数年%m1 代表一位或者两位数的月%m2 代表两位数月(用0补齐1位数)%mc 3个字符月份的缩写%d1 1或2位天%d2 两位天%h1 1或者2位时%h2 2位时例如:原文件其中之一的文件名为gdas2006050812f00,且所有文件只有天和时的变化那么新描述文件的文件名为:gdas200605%d2%h2f00另外如果源文件里有index项的话,需要修改其idx的文件名,假设改成fnl.idx。
并用在dos下用gribmap函数生成一个新的idx文件。
gribmap -e -i fnl.ctl(加绝对路径)open fnl.ctl就可以打开所有文件。
****************************************************************************************************** ****************************若想要提取从1951-2006年56年nc文件中的某些数据,一个一个处理非常麻烦,这里介绍种较为简易的方法。
GrADS
实习一数据文件的转换及数据描述文件的建立1.实习目的:(1)通过编写程序,熟悉数据GrADS的数据格式;(2)熟练编写将ASCII码数据转换为二进制格式的Fortran程序;(3)熟练建立相应的CTL文件。
2. 实习要求:(1)编写Fortran程序,将ASCII码数据资料文件转换成二进制文件:月平均风场(uv.grd)月平均高度场(hgt.grd)(2)写出二进制文件相应的数据描述文件:uv.ctl,hgt.ctl(3)利用GrADS基本操作命令显示该地区850hPa和200hPa uv风场,最后保存图nm形。
3 实习步骤:(1) 利用“写字板”程序打开*.dat数据文件,熟悉该数据资料;(2 )按要求编写Fortran程序,将所给的ASCII码数据资料文件转换成二进制无格式直接存取文件,结果保存为**.grd;(3) 通过“写字板”或“记事本”程序编写相应的数据描述文件,保存为**.ctl;(4) 画出2002年1月850hPa风场图,与图1比较验证数据正确性;4.实习报告1)所用资料“data”文件夹下有ASCII码数据资料文件:月平均风场:u200.dat、u850.dat、v200.dat、v850.dat月平均高度场:hgt500.dat经纬度范围:60-150°E,0-40°N时间范围:2002.1-2005.12 共48个月水平范围:37×17个网格点,分辨率为2.5°×2.5°2)所编写的Fortran程序parameter(nx=37,ny=17,nt=48)dimension u200(nx,ny,nt),v200(nx,ny,nt),h500(nx,ny,nt), u850(nx,ny,nt),v850(nx,ny,nt)open(1,file='e:\dwj\u200.dat')open(2,file='e:\dwj\v200.dat')open(3,file='e:\dwj\u850.dat')open(4,file='e:\dwj\v850.dat')open(5,file='e:\dwj\hgt500.dat')do it=1,ntread(1,*)((u200(i,j,it),i=1,nx),j=1,ny)read(2,*)((v200(i,j,it),i=1,nx),j=1,ny)read(3,*)((u850(i,j,it),i=1,nx),j=1,ny)read(4,*)((v850(i,j,it),i=1,nx),j=1,ny)read(5,*)((h500(i,j,it),i=1,nx),j=1,ny)enddoclose(1);close(2);close(3);close(4);close(5)open(12,file='e:\dwj\uv0.grd',form='binary')do it=1,ntwrite(12) ((u850(i,j,it),i=1,nx),j=1,ny)write(12) ((u200(i,j,it),i=1,nx),j=1,ny)write(12) ((v850(i,j,it),i=1,nx),j=1,ny)write(12) ((v200(i,j,it),i=1,nx),j=1,ny)enddoclose(12)open(12,file='e:\dwj\hgt0.grd',form='binary')do it=1,ntwrite(12) ((h500(i,j,it),i=1,nx),j=1,ny)enddoclose(12)end3)所编写的数据描述文件'reinit''open F:\1\uv.ctl''set lon 60 150''set lat 0 40''set t 1''d u;v''printim F:\1\shuang.jpg';4)所绘制的图形实习二基本命令的上机使用1. 实习目的:熟悉GrADS的工作环境及使用流程,掌握基本操作命令,练习编写和使用gs文件。
GrADS数据格式
2. 数据描述文件的形式 以上述格点数据描述文件为例:
DSET D:\model.le.dat
UNDEF 2.56E33 TITLE 5 Days of Sample Model
Output
XDEF 72 LINEAR 0.0 5.0 YDEF 46 LINEAR -90.0 4.0 ZDEF 7 LEVELS 1000 850 700 500 300 200 100
3.数据描述文件的建立
数据描述文件为纯文本格式,可 用一般的文本编辑器产生(如记事本, 写字板等)。描述文件编辑完成后, 保存时后缀名为.ctl。
*关于plate使用
多个连续时间序列原始数据文件想用一个数据描 述文件统一地描述这些原始数据时采用该选项。
dset h%y4%m2.grd sample grid 9999 template
在使用GrADS绘图前,必须确保
所用数据文件满足GrADS的数据格式 要求。
2.1 常用数据格式的文件特点
• Binary(二进制)数据格式:可以是 格点数据或站点数据,可以用Fortran
或者C语言读写。
• NetCDF网络通用数据格式:自定义
数据格式,精确性好,便于传输。
• GRIB码数据格式:是自定义的数据
• DTYPE <option> option:grid 或 station
说明数据文件的数据类型。 默认设置: dtype grid
• OPTIONS <keywords>
定义数据存放方式的选项,keywords 有: <yrev> <zrev> <sequential> 详见P22 <byteswapped> <big-endian> <little-endian> <template>
GrADS站点资料的使用
GrADS站点资料的使用台站型离散资料画图的一般原则1、把台站资料r.dat写成二进制文件r.grd一般而言,台站资料都是文本格式的,须用专门的程序写成带有站号、经度、纬度等的二进制文件。
例如:对某一时次的降水资料r.dat有如下形式:lon lat Precipitation119.8 30.6 0119.8 30.616 0119.8 30.632 0119.8 30.648 0119.8 30.664 0119.8 30.68 0119.8 30.696 0119.8 30.712 0119.8 30.728 0119.8 30.744 0119.8 30.76 0119.8 30.776 0。
该数据只有一个时次则相应的程序stn.f如下:parameter(n=10201)integer r1(n)real lat(n),lon(n),r(n)character*8 zh(n)open(1,file='d:\common\1.txt',form='formatted',status='old')do i=1,nread(1,*)lon(i),lat(i),r1(i)r(i)=r1(i)enddodo i=1,nzh(i)=char(i)enddo!!!!!!!!!!!!!!!!!!!!!!!!!!!!!open(9,file='d:\common\r.grd',form='binary',status='unknown')open(99,file='d:\common\rr.txt')do 100 i=1,ntim=0.0nlev=1nflag=1write(9)zh(i),lat(i),lon(i),tim,nlev,nflagwrite(9)r(i)write(99,200)lon(i),lat(i),r(i)200 format(f8.3,f8.3,f6.2)100 continuenlev=0write(9)zh(i-1),lat(i-1),lon(i-1),tim,nlev,nflagclose(9)! do i=1,160do i=1,nif(r(i).lt.0.0)thenwrite(*,*)lon(i),lat(i),r(i)endifenddo! write(*,*)i,zh(5000),lat(5000),lon(5000),tim,nlev,nflag,r(5000)pause! enddoend2、编写r.grd数据的数据说明文件r.ctldset d:\common\r.grddtype stationstnmap d:\common\r.mapundef -999.0title station datatdef 1 linear jan1998 1movars 1r 0 99 grid data prepared for oacres functionendvars3、用r.ctl生成r.map文件实际上,是在GrADS中运行可执行文件stnmap.exe,如何运行对于自带显示窗口的GrADS1.8版本的:进入命令窗口后,在提示符下输入“!stnmap”ga_>!stnmap在出现的信息提示处输入r.ctlEnter stn ctl filename: D:\r.ctl4、生成格点文件因为GrADS只识别格点数据,所以需要把站点上的资料通过插值函数插值到某个格点文件上才能被识别。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Components of a GrADS Data Descriptor FileDSET data_filenameback to topThis entry specifies the filename of the data file being described. If the data and the descriptor file are not in the same directory, then data_filename must include a full path. If a ^ character is placed in front of data_filename,then data_filename is assumed to be relative to the path of the descriptor file. If you are using the ^ character in the DSET entry, then the descriptor file and the data file may be moved to a new directory without changing any entries in the data descriptor file, provided their relative paths remain the same. For example:If the data descriptor file is:/data/wx/grads/sa.ctland the binary data file is:/data/wx/grads/sa.datthen the data file name in the data descriptor file can be:DSET ^sa.datinstead of:DSET /data/wx/grads/sa.datIf data_filename does not include a full path or a ^, then GrADS will only look for data files in the directory where you are running GrADS.GrADS allows you use a single DSET entry to aggregate multiple data files and handle them as if they were one individual file. The individual data files must be identical in all dimensions except time, and the time range of each individual file must be indicated it its filename. To accomplish this, the DSET entry has a substitution template instead of a filename. See the section on Using Templates for a description of all the possible components of the template. Second, the OPTIONS entry must contain the template keyword.CHSUB t1 t2 stringback to top(GrADS version 1.9b4) This entry is used with a new option for templating data files that allows for any user-specified string substitution, instead of only date string substitution. This is useful when none of the standard template options match the time ranges in the files you wish to aggregate, or if the files are located on different disks. When you put the %ch template inyour DSET entry, then you also need to put additional CHSUB entries in the descriptor file. The string will be substituted for%ch in the data file name for the time steps beginning with t1 and ending with t2.See the section on Using Templates for examples.DTYPE keywordback to topThe DTYPE entry specifies the type of data being described. There are four options: grib, hdfsds, netcdf, or station. If the data type is none of these, then the DTYPE entry is omitted completely from the descriptor file and GrADS will assume the data type is gridded binary.bufr (GrADS version 1.9) Data file is a BUFR station data file. This data type must be accompanied by the following special entries: XVAR, YVAR, TVAR, STID. Optional special entries are: ZVAR, TOFFVAR.grib Data file is an indexed GRIB (version 1) file. This data type requires a secondary entry in the descriptor file:INDEX. The INDEX entry provides the filename (including the full path or a ^) for the GRIB index file. Theindex file is created by the gribmap utility. You must run gribmap and create the index file before you candisplay the GRIB data in GrADS.grib2 (GrADS version 2.0) Data file is an indexed GRIB2 file. This data type requires a secondary entry in the descriptor file: : INDEX. The INDEX entry provides the filename (including the full path or a ^) for the GRIB2index file. The index file is created by the gribmap utility. You must run grib2map and create the index filebefore you can display the GRIB2 data in GrADS.hdfsds (GrADS version 1.9) Data file is an HDF Scientific Data Set (SDS). Although HDF-SDS files are self-describing and may be read automatically using the sdfopen/xdfopen commands, this DTYPE gives youthe option of overriding the file's own metadata and creating a descriptor file for some or all of the variablesin the file. This DTYPE may also be used if the metadata in the HDF-SDS file is insufficient or is notcoards-compliant. This data type requires a special entry in the units field of the variabledeclaration. The undef and unpack entries contain special options for this dtype.hdf5_grid (GrADS version 2.0.a7+) Data file is HDF5 gridded format. The HDF5 format is extremely general and is designed to store a variety of data types. The GrADS interface is only for grids, and requires a completedescriptor file -- there is no sdfopen/xdfopen interface for HDF5.netcdf (GrADS version 1.9) Data file is NetCDF. Although NetCDF files are self-describing and may be read automatically using the sdfopen/xdfopen commands, this DTYPE gives you the option of overriding the file'sown metadata and creating a descriptor file for some or all of the variables in the file. This DTYPE may alsobe used if the metadata in the NetCDF file is insufficient or is not coards-compliant. This data type requires aspecial entry in the units field of the variable declaration. The undef and unpack entries contain specialoptions for this dtype.station Data file is in GrADS station data format. This data type requires a secondary entry in the descriptor file: STNMAP. The STNMAP entry provides the filename (including the full path or a ^) for the station data mapfile. The map file is created by the stnmap utility. You must run stnmap and create the map file before youcan display the station data in GrADS.INDEX filenameback to topThis entry specifies the name of the grib map file. It is required when using the DTYPE grib or grib2 entry to read GRIB formatted data. The file is generated by running the external utility gribmap. or grib2map. Filenaming conventions are the same as those described for the DSET entry.STNMAP filenameback to topThis entry specifies the name of the station map file. It is required when using the DTYPE station entry to readGrADS-formatted station data. The file is generated by running the external utility stnmap. Filenaming conventions are thesame as those described for the DSET entry.TITLE stringback to topThis entry gives brief description of the contents of the data set. String will be included in the output from a query command and it will appear in the directory listing if you are serving this data file with the GrADS-DODS Server (GDS), so it is helpful to put meaningful information in the title field. For GDS use, do not use double quotation marks (") in the title.UNDEF value<undef_attribute_name>back to topThis entry specifies the undefined or missing data value. UNDEF is a required entry even if there are no undefined data. GrADS operations and graphics routines will ignore data with this value from this data set.(GrADS version 1.9b4) An optional second argument has been added for data sets of DTYPE netcdf or hdfsds -- it is the name of the attribute that contains the undefined value. This should be used when individual variables in the data file have different undefined values. After data I/O, the missing values in the grid are converted from the variable undef to the file-wide undef (the numerical value in the first argument of the UNDEF record). Then it appears to GrADS that all variables have the same undef value, even if they don't in the original data file. If the data require a transformation using the attributes named in the UNPACK entry, GrADS assumes the variable undef value corresponds to the data values as they appear in the file,i.e.,before they are transformed using a scale factor and offset. Missing packed data values are thus assigned the file-wide undef value and are never unpacked. Attribute names are case sensitive, and it is assumed that the name is identical for all variables in the netcdf or hdfsds data file. If the name given does not match any attributes, or if no name is given, the file-wide undef value will be used.Example: UNDEF 1e+33 _FillValueUNPACK scale_factor_attribute_name <add_offset_attribute_name>back to top(GrADS version 1.9) This entry is used with DTYPE netcdf, hdfsds, or hdf5_grid (GrADS version 2.0.a7+) for data variables that are 'packed' -- i.e. non-float data that need to be converted to float by applying the following formula:y = x * scale_factor + add_offsetIf your self-describing file does not have an offset attribute, the 2nd argument may be omitted, and the offset will be assigned the default value of 0.0. If your self-describing file has an offset attribute, but not a scale factor, use "NULL" forthe scale_factor_attribute_name. (This "NULL" option is in GrADS version 2.0.0+). Attribute names are case sensitive, and it is assumed that the names are identical for all variables in the netcdf or hdfsds data file. If the names given do not match any attributes, the scale factor will be assigned a value of 1.0 and the offset will be assigned a value of 0.0. The transformation of packed data is done after the undef test has been applied.Examples:UNPACK scale_factor add_offsetUNPACK NULL add_offsetUNPACK Slope InterceptFILEHEADER lengthback to topThis optional entry tells GrADS that your data file has a header record of length bytes that precedes the data. GrADS will skip past this header, then treat the remaineder of the file as though it were a normal GrADS binary file after that point. This optional descriptor file entry is only valid for GrADS gridded data sets.THEADER length HEADERBYTES length<back to topThese two equivalent optional entries tell GrADS that the data file has a header record of length bytes preceding each time block of binary data. Use one or the other but not both. These entries are only valid for GrADS gridded data sets. See the section on structure of a gridded binary data file for more information.TRAILERBYTES lengthback to topThis optional entry tell GrADS that the data file has a trailer record of length bytes following each time block of binary data. This entry is only valid for GrADS gridded data sets. See the section on structure of a gridded binary data file for more information.XYHEADER lengthback to topThis optional entry tells GrADS that the data file has a header record of length bytes preceding each horizontal grid (XY block) of binary data. This entry is only valid for GrADS gridded data sets. See the section on structure of a gridded binary datafile for more information.XVAR x,yback to top(GrADS version 1.9) This entry provides the x,y pair for the station's longitude. This entry is required for DTYPE bufr.YVAR x,yback to top(GrADS version 1.9) This entry provides the x,y pair for the station's latitude. This entry is required for DTYPE bufr.ZVAR x,yback to top(GrADS version 1.9) This entry provides the x,y pair for the station data's vertical coordinate (e.g., pressure). This is an optional entry for DTYPE bufr.STID x,yback to top(GrADS version 1.9) This entry provides the x,y pair for the station ID. This entry is required for DTYPE bufr.TVAR yr x,y mo x,y dy x,y hr x,y mn x,y sc x,yback to top(GrADS version 1.9) This entry provides the x,y pairs for all the base time coordinate variables. Each time unit (year=yr, month=mo, day=dy, hour=hr, minute=mn, second=sc) is presented as a 2-letter abbreviation followed by the x,y pair that goes with that time unit. The time for any individual station report is the base time plus the offset time (see TOFFVAR). All six base time units are not required to appear in the TVAR record, only those that are in the data file. This entry is requiredfor DTYPE bufr.TOFFVAR yr x,y mo x,y dy x,y hr x,y mn x,y sc x,yback to top(GrADS version 1.9) This entry provides the x,y pairs for all the offset time coordinate variables. The syntax is the same as TVAR. The time for any individual station report is the base time plus the offset time. All six offset time units are not required to appear in the TOFFVAR record, only those that are in the data file. This is an optional entry for DTYPE bufr.CACHESIZE bytesback to top(GrADS version 2.0.a8+) This entry overrides the default size of the cache for reading HDF5 or NetCDF4 files. It is not relevant for other data types. It should not be necessary to set the cache size explicitly unless the data file has especially large chunks. Please see the documentation on compression.OPTIONS keywordback to topThis entry controls various aspects of the way GrADS interprets the raw data file. It replaces the old FORMAT record.The keyword argument may be one or more of the following:pascals (GrADS version 2.0) (For DTYPE grib2 only) Indicates that pressure values that appear in the descriptor file (in the ZDEF entry and in the GRIB2 codes in the variable declarations) are given inunits of Pascals. The gribmap utility requires pressure to be given in Pascals. If this keyword ispresent, the pressure level values will be converted to millibars after the gribmap index is generatedand the descriptor file is opened with GrADS. If this keyword is omitted, pressure levels will remain inPascals, and many of the internal functions (which assume a vertical dimension in units of millibars)will not work properly.yrev Indicates that the Y dimension (latitude) in the data file has been written in the reverse order from what GrADS assumes. An important thing to remember is that GrADS still presents the view that thedata goes from south to north. The YDEF statement does not change; it still describes thetransformation from a grid space going from south to north. The reversal of the Y axis is done as thedata is read from the data file.zrev Indicates that the Z dimension (pressure) in the data file has been written from top to bottom, rather than from bottom to top as GrADS assumes. The same considerations as noted above for yrev alsoapply.template Indicates that a template for multiple data files is in use. For more information, see the section on Using Templates.sequential Indicates that the file was written in sequential unformatted I/O. This keyword may be used with either station or gridded data. If your gridded data is written in sequential format, then each record must bean X-Y varying grid. If you have only one X and one Y dimension in your file, then each record in thefile will be one element long (it may not be a good idea to write the file this way).365_day_calendar Indicates the data file was created with perpetual 365-day years, with no leap years. This is used for some types of model ouput.byteswapped Indicates the binary data file is in reverse byte order from the normal byte order of your machine.Putting this keyword in the OPTIONS record of the descriptor file tells GrADS to swap the byte orderas the data is being read. May be used with gridded or station data.The best way to ensure hardware independence for gridded data is to specify the data's source platform. This facilitates moving data files and their descriptor files between machines; the data may be used on any type of hardware without having to worry about byte ordering. The following three OPTIONS keywords are used to describe the byte ordering of a gridded or station data file:big_endian Indicates the data file contains 32-bit IEEE floats created on a big endian platform (e.g., sun, sgi)little_endian Indicates the data file contains 32-bit IEEE floats created on a little endian platform (e.g., iX86, and dec)cray_32bit_ieee Indicates the data file contains 32-bit IEEE floats created on a cray.PDEFback to topPDEF is so powerful it has its own documentation page.XDEF xnum mapping <additional arguments>back to topThis entry defines the grid point values for the X dimension, or longitude. The first argument, xnum, specifies the number of grid points in the X direction. xnum must be an integer >= 1. mapping defines the method by which longitudes are assigned to X grid points. There are two options for mapping:LINEAR Linear mappingLEVELS Longitudes specified individuallyThe LINEAR mapping method requires two additional arguments: start and increment. start is a floating point value that indicates the longitude at grid point X=1. Negative values indicate western longitudes. increment is the spacing between grid point values, given as a positive floating point value.The LEVELS mapping method requires one additional argument, value-list, which explicitly specifies the longitude value for each grid point. value-list should contain xnum floating point values. It may continue into the next record in the descriptor file, but note that records may not have more than 255 characters. There must be at least 2 levels in value-list; otherwise use the LINEAR method.Here are some examples:XDEF 144LINEAR 0.0 2.5XDEF 72LINEAR 0.0 5.0XDEF 12LEVELS 0 30 60 90 120 150 180 210 240 270 300 330XDEF 12LEVELS 15 45 75 105 135 165 195 225 255 285 315 345YDEF ynum mapping <additional arguments>back to topThis entry defines the grid point values for the Y dimension, or latitude. The first argument, ynum, specifies the number of gridpoints in the Y direction. ynum must be an integer >= 1. mapping defines the method by which latitudes are assigned to Y grid points. There are several options for mapping:LINEAR Linear mappingLEVELS Latitudes specified individuallyGAUST62 Gaussian T62 latitudesGAUSR15 Gaussian R15 latitudesGAUSR20 Gaussian R20 latitudesGAUSR30 Gaussian R30 latitudesGAUSR40 Gaussian R40 latitudesThe LINEAR mapping method requires two additional arguments: start and increment. start is a floating point value that indicates the latitude at grid point Y=1. Negative values indicate southern latitides. increment is the spacing between grid point values in the Y direction. It is assumed that the Y dimension values go from south to north, so increment is always positive.The LEVELS mapping method requires one additional argument, value-list, which explicitly specifies the latitude for each grid point, from south to north. value-list should contain ynum floating point values. It may continue into the next record in the descriptor file, but note that records may not have more than 255 characters. There must be at least 2 levels in value-list; otherwise use the LINEAR method.The Gaussian mapping methods require one additional argument: start. This argument indicates the first gaussian grid number. If the data span all latitudes, start would be 1, indicating the southernmost gaussian grid latitude.Here are some examples:YDEF 73LINEAR -90 2.5YDEF 180LINEAR -90 1.0YDEF 18LEVELS -85 -75 -65 -55 -45 -35 -25 -15 -5 5 15 25 35 45 55 65 75 85YDEF 94GAUST62 1YDEF 20GAUSR40 15The NCEP/NCAR Reanalysis surface variables are on the GAUST62 grid.The final example shows that there are 20 Y dimension values which start at Gaussian Latitude 15 (64.10 south) on the Gaussian R40 gridZDEF znum mapping <additional arguments>back to topThis entry defines the grid point values for the Z dimension. The first argument, znum, specifies the number of pressure levels. znum must be an integer >= 1. mapping defines the method by which level values are assigned to Z grid points. There are two options for mapping:LINEAR Linear mappingLEVELS Pressure levels specified individuallyThe LINEAR mapping method requires two additional arguments: start and increment. start is a floating point value that indicates the level value at grid point Z=1. increment is the spacing between grid point values in the Z direction, or from lower to higher. increment must be non-zero and non0negative.The LEVELS mapping method requires one additional argument, value-list, which explicitly specifies the pressure level for each grid point in ascending order. value-list should contain znum floating point values. It may continue into the next record in the descriptor file, but note that records may not have more than 255 characters.Here are some examples:ZDEF 7LEVELS 1000 850 700 500 300 200 100ZDEF 17LEVELS 1000 925 850 700 600 500 400 300 250 200 150 100 70 50(GrADS version 2.0) (For DTYPE grib2 only) If your Z axis is pressure, the gribmap utility requires the level values to be given in units of Pascals instead of millibars. Use the "options pascals" keyword to convert the unit of the level values to millibars after the gribmap index is generated and when the descriptor file is opened with GrADS. Pressure level values may remain in Pascals, but then many of the internal functions (which assume a vertical dimension in units of millibars) will not work properly.TDEF tnum LINEAR start incrementback to topThis entry defines the grid point values for the T dimension. The first argument, tnum, specifies the number of timesteps.tnum must be an integer >= 1. The method by which times are assigned to T grid points is always LINEAR.start indicates the initial time value at grid point T=1. start must be specified in the GrADS absolute date/time format:hh:mm Z ddmmmyyyywhere:hh = hour (two digit integer)mm = minute (two digit integer)dd = day (one or two digit integer)mmm = 3-character monthyyyy = year (may be a two or four digit integer; 2 digits implies a year between 1950 and 2049)If not specified, hh defaults to 00, mm defaults to 00, and dd defaults to 1. The month and year must be specified. No intervening blanks are allowed in the GrADS absolute date/time format.increment is the spacing between grid point values in the T direction. increment must be specified in the GrADS absolute time increment format:vvkkwhere:vv = an integer number, 1 or 2 digitskk = mn (minute)hr (hour)dy (day)mo (month)yr (year)Here are some examples:TDEF 60LINEAR 00Z31dec1999 1mnTDEF 73LINEAR 3jan1989 5dyTDEF 730LINEAR 00z1jan1990 12hrTDEF 12LINEAR 1jan2000 1moTDEF 365LINEAR 12Z1jan1959 1dyTDEF 40LINEAR 1jan1950 1yrEDEF enum NAMES <list of names>back to topEDEF enumensemble_record_1 ensemble_record_2 ...ensemble_record_enum ENDEDEFback to top(GrADS version 2.0) This entry defines the ensemble dimension. All ensemble members must have identical X, Y, and Z dimensions, the same list of variables, and the same time axis increment. There are two different syntaxes for the EDEF entry: the first is simpler and requires only the names for each ensemble member, the second expanded form contains a name, individual time axis information, and optional GRIB2 codes.Both EDEF syntaxes begin with the enum argument, an integer >=1 which specifies the number of ensemble members.If all of the ensemble members have an identical time axis (i.e. length, initial time, and increment are the same for each one), then it is only necessary to distinguish the ensembles by their names, and the simplified EDEF syntax with the NAMES keyword may be used. A simple space-delimited list of names is all that is required. Ensemble names must have between 1 and 15 alphanumeric characters, lower case only. (In version 2.0.0 and later, mixed case ensemble names are allowed). Some examples are:EDEF 10NAMES 1 2 3 4 5 6 7 8 9 10EDEF 12NAMES m01 m02 m03 m04 m05 m06 m07 m08 m09 m10 m11 ensmEDEF 7NAMES e1 e2 e3 e4 e5 e6 e7When the OPTIONS TEMPLATE entry is used with EDEF, the ensemble names are used in the %e substitution template to generate the file name. See Using Templates for more details.If the ensemble members do not have identical time axes (i.e., their lengths or initial times are not the same), or if you need to include the GRIB2 codes, then you must use the expanded EDEF syntax: a collection of records framed by EDEF and ENDEDEF. The format of the ensemble records is as follows:ensname length start <grib2 codes>The ensname is the 1-15 character "name" for the ensemble member. The length is the size of the time axis of the ensemble, which must be less than or equal to the tnum argument in the TDEF entry. (The time axis described by TDEF must span all the ensemble members.) The start argument is the initial time of the ensemble member and must be given in GrADS absolute date/time format. (See TDEF for details).The grib2 codes are required if (1) the DTYPE is grib2 and (2) there is more than one ensemble member (enum > 1). The expanded form of the EDEF entry must be used when grib2 codes are required, even if the length and start times are the same for all members. For GRIB2 ensembles, support currently exists for four different Product Definition Template (PDT) numbers: 1, 2, 11, and 12. These are grouped into two types: individual ensemble forecasts (PDT 1 and 11) or derived forecasts based on all ensemble members (PDT 2 and 12). For individual ensemble forecasts (PDT 1 and 11), twocomma-delimited grib2 codes are required: the ensemble type and perturbation number. For derived forecasts based on all ensemble members (PDT 2 and 12), only one grib2 code is required: the derived forecast. Clarification of all the GRIB2 nomenclature may be found in the documentation at WMO and NCEP. Two examples are given below.The first example illustrates ensemble members with different lengths and start times:TDEF 591 linear 12z09dec1980 12hrEDEF 16ensm 591 12z09dec1980m01 591 12z09dec1980m02 589 12z10dec1980m03 587 12z11dec1980m04 585 12z12dec1980m05 583 12z13dec1980m06 571 12z19dec1980m07 569 12z20dec1980m08 567 12z21dec1980m09 565 12z22dec1980m10 563 12z23dec1980m11 549 12z30dec1980m12 547 12z31dec1980m13 545 12z01jan1981m14 543 12z02jan1981m15 541 12z03jan1981ENDEDEFThe second example illustrates the use of GRIB2 codes:TDEF 31 linear 00z24apr2007 12hrEDEF 23p01 31 00z24apr2007 3,1p02 31 00z24apr2007 3,2p03 31 00z24apr2007 3,3p04 31 00z24apr2007 3,4p05 31 00z24apr2007 3,5p06 31 00z24apr2007 3,6p07 31 00z24apr2007 3,7p08 31 00z24apr2007 3,8p09 31 00z24apr2007 3,9p10 31 00z24apr2007 3,10p11 31 00z24apr2007 3,11p12 31 00z24apr2007 3,12p13 31 00z24apr2007 3,13p14 31 00z24apr2007 3,14p15 31 00z24apr2007 3,15p16 31 00z24apr2007 3,16p17 31 00z24apr2007 3,17p18 31 00z24apr2007 3,18p19 31 00z24apr2007 3,19p20 31 00z24apr2007 3,20c00 31 00z24apr2007 1,0avg 31 00z24apr2007 0spr 31 00z24apr2007 2ENDEDEFVECTORPAIRS U-component,V-componentback to top(GrADS version 1.9b4) This entry is for explicity identifying vector component pairs. This is only necessary if the data are on a native projection other than lat/lon (i.e. you are using PDEF) and if the winds have to be rotated from a grid-relative sense to an Earth-relative sense. (GrADS has to retrieve both the u and v component in order to do the rotation calculation.)Using this entry replaces the old technique of putting 33 (for U) or 34 (for V) in the first element of the units field in the variable declaration. The U-component and V-component arguments should be variable names that appear in the VARS list. They are separated by a comma, with no spaces. More than one pair of components may be listed; in this case, the pairs should be separated by a space. For example:VECTORPAIRS u,v u10,v10 uflx,vflxVARS varnum variable_record_1back to topvariable_record_2...variable_record_varnumENDVARSThis ensemble of entries describes all the variables contained in the data set. varnum indicates the number of variables in the data set and is therefore also equal to the number of variable records that are listed between the VARS and ENDVARS entries. ENDVARS must be the final line of the Grads data descriptor file. Any blank lines after the ENDVARS statement may cause open to fail!The format of the variable records is as follows:varname levs units description (Version 2.0.1 or earlier)varname levs <additional_codes> units description (Version 2.0.2 or later)The syntax of varname and units is different depending on what kind of data format (DTYPE) you are describing.The<additional_codes> are only necessary for certain types of GRIB2 data sets. Details provided below:varname This is a 1-15 character "name" or abbreviation for the data variable. varname may contain alphabetic and numeric characters but it must start with an alphabetic character (a-z).varname (DTYPE netcdf, hdfsds, orhdf5_grid) (GrADS version 1.9+) For DTYPE netcdf or hdfsds, varname may have a different syntax. This syntax is required when the name of the data variable in the SDF does not conform to the GrADS naming conventions (see below for list of criteria), but it may also be used to shorten or change the variable name to make it easier to work with inside GrADS. The syntax is:SDF_varname=>grads_varnameSDF_varname is the name the data variable was given when the SDF file was originally created. For NetCDF files, this name appears in the output from ncdump. It is important that SDF_varname exactly matches the variable name in the data file. SDF_varname may contain uppercase letters andnon-alpha-numeric characters.The classic varname syntax (i.e., when "SDF_varname =>" is omitted) may be used if SDF_varname meets the criteria for GrADS variable names: it must be less than 16 characters, start with an alphabetic character, and cannot contain any upper case letters or non-alpha-numeric characters.(GrADS version 2.0.a3+) If the SDF_varname contains spaces, substitute "~" for each space -- the spaces in the variable name string will be swapped back in later after the descriptor file has been parsed.(GrADS version 2.0.a7+) For dtype hdf5_grid, the SDF_varname may be particularly long since it must contain the names of all the nested groups (separated by "/") to which the data set belongs.For example:/HDFEOS/GRIDS/EarthSurfaceReflectanceClimatology/Data~Fields/MonthlySurfaceReflectance=>msr。