GrADS命令大全模板
- 格式:doc
- 大小:244.00 KB
- 文档页数:15
【grads】ncdump的使⽤总结1、参数ncdumpncdump [-c] [-h] [-v var1,...] [-b lang] [-f lang] [-l len] [-n name] [-d f_digits[,d_digits]] fileWhere:-cShow the values of coordinate variables (variables that are also dimensions) as well as the declarations of all dimensions, variables, and attribute values. Data values of non-coordinate variables are not included in the output. This is the most suitable option to use for a brief look at the structure and contents of a netCDF file.-hShow only the header information in the output, that is the declarations of dimensions, variables, and attributes but no data values for any variables. The output is identical to using the -c option except that the values of coordinate variables are not included. (At most one of -c or -h options may be present.)-v var1,...,varnThe output will include data values for the specified variables, in addition to the declarations of all dimensions, variables, and attributes. One or more variables must be specified by name in the comma-delimited list following this option. The list must be a single argument to the command, hence cannot contain blanks or other white space characters. The named variables must be valid netCDF variables in the input-file. The default, without this option and in the absence of the -c or -h options, is to include data values for all variables in the output.-b langA brief annotation in the form of a CDL comment (text beginning with the characters ``//'') will be included in the data section of the output for each `row' of data, to help identify data values for multidimensional variables. If lang begins with C or c, then C language conventions will be used (zero-based indices, last dimension varying fastest). If lang begins with F or f, then Fortran language conventions will be used (one-based indices, first dimension varying fastest). In either case, the data will be presented in the same order; only the annotations will differ. This option is useful for browsing through large volumes of multidimensional data.-f langFull annotations in the form of trailing CDL comments (text beginning with the characters ``//'') for every data value (except individual characters in character arrays) will be included in the data section. If lang begins with C or c, then C language conventions will be used (zero-based indices, last dimension varying fastest). If lang begins with F or f, then Fortran language conventions will be used (one-based indices, first dimension varying fastest). In either case, the data will be presented in the same order; only the annotations will differ. This option may be useful for piping data into other filters, since each data value appears on a separate line, fully identified.-l lenChanges the default maximum line length (80) used in formatting lists of non-character data values.-n nameCDL requires a name for a netCDF data set, for use by ncgen -b in generating a default netCDF file name. By default, ncdump constructs this name from the last component of the pathname of the input netCDF file by stripping off any extension it has. Use the -n option to specify a different name. Although the output file name used by ncgen -b can be specified, it may be wise to have ncdump change the default name to avoid inadvertantly overwriting a valuable netCDF file when using ncdump, editing the resulting CDL file, and using ncgen -b to generate a new netCDF file from the edited CDL file.-d float_digits[,double_digits]Specifies default number of significant digits to use in displaying floating-point or double precision data values for variables that don't have a `C_format' attribute. Floating-point data will be displayed with float_digits significant digits. If double_digits is also specified, double-precision values will be displayed with that many significant digits. If a variable has a `C_format' attribute, that overrides any specified floating-point default. In the absence of any -d specifications, floating-point and double-precision data are displayed with 7 and 15 significant digits respectively. CDL files can be made smaller if less precision is required. If both floating-point and double-presision precisions are specified, the two values must appear separated by a comma (no blanks) as a single argument to the command. If you really want every last bit of precision from the netCDF file represented in the CDL file for all possible floating- point values, you will have to specify this with -d 9,17.Usage Notesncdump generates an ASCII representation of a specified netCDF file on standard output. The ASCII representation is in a form called CDL (``network Common Data form Language'') that can be viewed, edited, or serve as input to ncgen. ncgen is a companion program that can generate a binary netCDF file from a CDL file. Hence ncgen and ncdump can be used as inverses to transform the data representation between binary and ASCII representations. See ncgen for a description of CDL and netCDF representations.ncdump defines a default format used for each type of netCDF data, but this can be changed if a `C_format' attribute is defined for a netCDF variable. In this case, ncdump will use the `C_format' attribute to format each value. For example, if floating-point data for the netCDF variable Z is known to be accurate to only three significant digits, it would be appropriate touse the variable attributeZ:C_format = "%.3g"ncdump may also be used as a simple browser for netCDF data files, to display the dimension names and sizes; variable names, types, and shapes; attribute names and values; and optionally, the values of data for all variables or selected variables in a netCDF file.ExamplesLook at the structure of the data in the netCDF file foo.nc:ncdump -c foo.ncProduce an annotated CDL version of the structure and data in the netCDF file foo.nc, using C-style indexing for the annotations:ncdump -b c foo.nc > foo.cdlOutput data for only the variables uwind and vwind from the netCDF file foo.nc, and show the floating-point data with only three significant digits of precision:ncdump -v uwind,vwind -d 3 foo.ncProduce a fully-annotated (one data value per line) listing of the data for the variable omega, using Fortran conventions for indices, and changing the netCDF dataset name in the resulting CDL file to omega:ncdump -v omega -f fortran -n omega foo.nc > Z.cdl2、注意①它是在dos底下⽤的,如果在gradsnc中⽤,请在命令前加感叹号。
第一个命令:这样将得到一个动画显示的序列,现在输入:claerset lon -90set lat -90 90set lev 1000 100set t 1d td u该情况下我们设置y(纬度)和z(高度)变化,所以我们得到一个竖直切面图。
我们显示了两个变量,他们重叠在一起。
你可以让任意多的变量重叠在一起,只要你不使用clear命令就行了。
另一个例子,这种情况X和T是变化的(哈莫图):cset lon -180 0set lat 40set lev 500set t 1 5d z现在已经知道怎样使用选定的部分数据绘图了,下面我们学习怎样操作数据。
设置维数环境为Z,Y变化:clearset lon -180 0set lat 0 90set lev 500set t 1现在假设我们想显示华氏温度代替开尔文温度。
可以这样转换:display (t-273.16)*9/5 32任何由标准的运算符,-,* 和/ 组成的表达式都是允许的,并且操作数可以包含常量,变量,或者函数。
一个包含函数的例子:d sqrt(u*u v*v)有一个函数用来计算风的级数。
d mag(u,v)另一个内建函数计算平均值:clear d ave(a,t=1,t=5)这种情况我们可以计算5天的平均。
我们也可以从数据中移除平均值(距平值):d z-ave(z,t=1,t=5)也可以在x方向作平均并求距平:cleard z-ave(z,x=1,x=72)也可以做时间差分:cleard z(t=2)-z(t=1)完整规范的变量名是:name.file(dim |-|=va lue,…) 如果我们打开了两个文件,也许一个是模式输出,另一个是分析,我们应该区分用如下方法二者:display z.2-z.1另一个内置的函数通过有线差分计算水平涡度相关cleard hcurl(u,v)还有另外一个计算数值方向的质量积分:cleard vint(ps,q,275)这儿我们计算了可降水量(单位mm)现在来讨论控制图形输出的话题。
grads基本命令d ave(olr,t+0,t+359,12) ave表示求平均,olr 为变量, t+0表示起始点为当前时次,即00z01jul1974;t+359表示终止时次为当前时次后推359个时次,即00z01jul2003;12表示每12个时次取一次数据;打开nc文件:ga->sdfopen查询信息:ga->q filega->q dimga->q ctlinfo写标题:ga-> draw title清除图面:ga-> c同时打开两个文件: ga->open model.ctlga->open model.le.ctl删除所有设置重新回到刚进入GrADS状态:ga->reinit删除open命令后的所有设置:ga->reset由风场导出涡度场:ga->d hcurl(u,v)以分色图形方式输出:ga->set gxout shaded以等值线方式输出(缺省方式):ga->set gxout contour画图例:ga->cbarn 1 0 (1:相对长短,>1放大;0:水平;1:垂直。
)以箭头方式表示矢量场: ga->gxout vector风矢量场:ga->d u; v; q (显示矢量时,d x分量;y分量<;标量>。
“<>”内的部分只起标颜色的作用。
)以流线方式表示矢量场:ga->set gxout stream风流线场:ga->d u; v; q以WMO风标方式表示矢量场: ga->set gxout barb风标:ga->d u; v; q直接输出网格点数值:ga->set gxout grid设置保留小数位数:ga->set dignum 0设置数字大小:ga->set digsize 0.1ga->set mpdraw on 如为off,不画地图背景(非经纬度数据需此项)ga->set poli on 如为off不画国界省界等。
d ave(olr,t+0,t+359,12) ave表示求平均,olr 为变量, t+0表示起始点为当前时次,即00z01jul1974;t+359表示终止时次为当前时次后推359个时次,即00z01jul2003;12表示每12个时次取一次数据;打开nc文件:ga->sdfopen查询信息:ga->q filega->q dimga->q ctlinfo写标题:ga-> draw title清除图面:ga-> c同时打开两个文件: ga->open model.ctlga->open model.le.ctl删除所有设置重新回到刚进入GrADS状态:ga->reinit删除open命令后的所有设置:ga->reset由风场导出涡度场:ga->d hcurl(u,v)以分色图形方式输出:ga->set gxout shaded以等值线方式输出(缺省方式):ga->set gxout contour画图例:ga->cbarn 1 0 (1:相对长短,>1放大;0:水平;1:垂直。
)以箭头方式表示矢量场: ga->gxout vector风矢量场:ga->d u; v; q (显示矢量时,d x分量;y分量<;标量>。
“<>”内的部分只起标颜色的作用。
)以流线方式表示矢量场:ga->set gxout stream风流线场:ga->d u; v; q以WMO风标方式表示矢量场: ga->set gxout barb风标:ga->d u; v; q直接输出网格点数值:ga->set gxout grid设置保留小数位数:ga->set dignum 0设置数字大小:ga->set digsize 0.1ga->set mpdraw on 如为off,不画地图背景(非经纬度数据需此项)ga->set poli on 如为off不画国界省界等。
目录前言 (5)第一章启动GrADS 及打开文件 (5)一.启动GrADS (5)二.打开文件 (6)第二章维数环境 (6)set lat|lon|lev|time val1<val2> (6)set x|y|z|t vall <val2 > (6)第三章显示命令及动画 (7)一、显示命令 (7)二、动画 (7)set loopdim x︱y|z|t (7)set looping on|off (7)第四章图形输出类型 (8)对格点数据: (8)bar: 直方图 (8)barb:风向杆形式绘二维风场 (8)contour:二维等值现图 (8)errbar:单线图及误差分布 (8)frgid:用指定颜色填充二维格点场 (8)fwrite:图形不在屏幕上显示,而是将输出结果存入一个由“set fwrite 文件名”所指定的文件中。
(8)gid:以网格形式在各网点中央标出该点数值 (8)line:单线图 (8)linefill:两单曲线之间填色 (8)scatter:散点图 (8)shaded:二维填色图 (8)stat:输出有关的统计量 (8)stream:流线形式绘二维风场 (8)vector:向量间箭头形式绘二维风场 (8)对站点数据: (8)barb:在各站点绘风向标 (8)findstn:搜索最近的站点(详见描述语言部分) (8)model:以天气图形式将天气观测各分量填放在站点四周 (8)value:在各站点标值 (8)wxsym:绘wx天气符号 (8)Draw wxsym symbol x y size<color<thicks>> (9)对于model,命令为set gxout model ,然后再添图,形式为displayu;v;t;d;slp;delta;cld;wx;vis (9)第五章 GrADS资料格式 (9)格点资料资料描述文件 (9)以下是一个资料描述文件的例子: (9)1、DSET data-set-name (11)2、TITLE string (11)3、UNDEF value (11)4、OPTIONS <keywords> (12)5、XDEF number<LINEAR start increment>或XDEF number<LEVELS value-list> (12)6、YDEF number mapping start<increment>或YDEF number<LEVELS value-list> (13)7、ZDEF number mapping <start increment>或ZDEF number<value-list> (13)8、TDEF number LINEAR start-time increment (14)9、VARS number (14)二. 台站资料资料描述文件 (15)第六章变量名和表达式 (15)一、变量名和表达式 (15)二、表达式 (16)第七章函数 (16)一. aave函数 (16)二.abs函数 (16)三.acos函数 (17)四、asin函数 (17)五、atan2函数 (17)六、ave函数 (17)七、cdiff函数 (17)八、const函数 (18)九、cos函数 (18)十、exp函数 (18)十一、gr2stn函数 (19)十二、hcurl函数 (19)十三、hdivg函数 (19)十四、log函数 (19)十五、log10函数 (19)十六、mag函数 (19)十七、maskout函数 (20)十八、oacres函数 (20)十九、pow函数 (20)二十、sin函数 (20)二十一、skip函数 (20)二十二、smth9函数 (21)二十三、sqrt函数 (21)二十四、stnave函数 (21)二十五、stnmin函数 (21)二十六、stnmax函数 (21)二十七、tan函数 (22)二十八、tloop函数 (22)二十九、tvrh2q函数 (22)三十、tvrh2t函数 (22)三十一、vint函数 (23)第八章图形要素设置 (23)对于图形类型为contour起作用的设置 (23)set ccolor color——设置等值线颜色 (23)set ccolor rainbow——设定等值线颜色用彩虹表示 (23)set cstyle style——设定等值线线型 (23)Set cthick thckns——设定等值线线宽hckns(取值范围1~20) (23)Set cterp on|off——设置样条差值光滑开关 (23)Set clab on|off|forced|string|auto——控制等值线的标记方式。