grads常用命令

合集下载

【grads】ncdump的使用总结

【grads】ncdump的使用总结

【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中⽤,请在命令前加感叹号。

GrADS命令大全

GrADS命令大全
set rbcols c1 c2<c3…cn>
设置彩虹色颜色序列值(缺省:9,14,4,11,5,13,3,10,7,12,8,2,6)
set rbcols <auto>
打开系统缺省设置的彩虹色设置
set rbrange low high
彩虹色颜色对应等值线开始和结结束的范围
set grid on|off|<style>
清干净图形显示区并重新初始化,但1)不关闭任何文件,2)不取消变量定义,3)不改变set display设置
option=events; graphics; hbuff; norset
reinit
与reset相似,但关闭所有文件并取消所有定义
quit
退出
!shell-command
在GrADS命令交互模式下运行外部系统命令
用三次样条或线性插值的方式计算细网格的值
set cint value
设置固定等直线间隔值
set cmax value
设置最大等直线的值,超过的不再画出
set cmin value
设置最小等直线的值,小于的不再画出
set clevs lev1 lev2…
按lev1 lev2…指定值绘等直线
set ccols col1 col2…
按顺序执行fname文件中的命令组
clear <option>
c <option>
清干净图形显示区,但不关闭当前数据文件可带参数:命令可简写为“c”并可带以下参数:
events
清空事件缓冲区
graphics
清空图形缓冲区,但不清空组件缓冲区
hbuff
在双缓冲区模式下,清空显示缓冲区

GrADS命令大全

GrADS命令大全
每间隔val条等直线作标注
set cthick thickness
设置等直线粗细,thickness=1~10
set csmooth on|off|linear
用三次样条或线性插值的方式计算细网格的值
set cint value
设置固定等直线间隔值
set cmax value
设置最大等直线的值,超过的不再画出
GrADS快速参考手册
(GrADS Version 1.7 beta 7 ) 编:Meier-fleischer@dkrz.de 译: 朱 禾
命令行参数grads -options
-c‘命令组’
启动GrADS后执行该命令组
-b
以批处理方式运行
-l
以landscape 模式运行
-p
以portrait 模式运行
是否标注台站号
set wxcols c1 c2 c3 c4 c5 c6
设置气象符号底颜色
坐标轴及边框设定参数
设置x轴标注的范围和<增量>
设置y轴标注的范围和<增量>
按lab1 lab2…标注x轴
按lab1 lab2…标注y轴
设置x轴标注的间隔
设置y轴标注的间隔
x轴y轴颠倒(缺省:x轴水平;y轴垂直)
modify varname<time type>
定义变量为气候序列平均,时间类型如下:
seasonal
月平均
diurnal
一日内多时刻平均
query <option>
q <option>
查询命令及其参数:
files
列出所有已打开的数据描述文件
file n

grads基本命令

grads基本命令

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不画国界省界等。

第二讲GrADS绘图的各种设置

第二讲GrADS绘图的各种设置
符串中反斜杠表示起新行。
draw xlab string draw ylab string 分别在水平坐标轴或垂直坐标轴左侧写字符串
string,作为x轴或y轴的说明。
set annot color <thickness> 设置上述图注所用的颜色和线宽,缺省为白色,
线宽为6,该命令同时设置了坐标轴线以及刻 度的颜色和线宽,坐标刻度和标尺的线宽为图 注设置的线宽再减1。
例:draw title Geopotential Hight (October 2010)
set xyrev on 交换水平和垂oj 设置当前地图投影方式。
常用proj取值包括: latlon:缺省设置,用固定的投影角进行Lat/lon投影
; scaled:用不固定的投影角进行latlon投影,地图比例
失效; nps | sps:北半球|南半球极地投影; robinson:robinson投影,x:-180 180;y:-90 90 off:不画出地图,坐标轴也不代表lat/lon。
(缺省时即按数据描述文件的维数进行绘图。)
特别地, 当数据文件为全球多层次多时次资料时,例如全球
144*73*12的多时次资料,缺省时维数为x、y方向为 (0-360E,90S-90N),z方向和t为第一个点。
GrADS最擅长画2-D图,即全球数据的缺省维数。
维数说明分为两类:
set lon | lat | lev | time val1 <val2> set x | y | z | t val1 <val2> 两者对应于同一组数据,前者是地球坐标
set grid on|off|value|horizontal|vertical <style> <color>

grads基本命令

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不画国界省界等。

GRADS中文说明

GRADS中文说明

目录前言 (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——控制等值线的标记方式。

GrADS第4章 各类参数设置

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>
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

第一个命令:这样将得到一个动画显示的序列,现在输入: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 选择默认的画线间隔。

我们可以这样自己设定:set cint 30d z也可以控制线的颜色:clearset ccolor 3d z可以使用交替的方式显示数据:clearset gxout shadedd hcurl(u,v)这看起来不很平滑,可以使用三次平滑:clearset csmooth ond hcurl(u,v)我们也可以使用不同的图形样式set gxout contourset ccolor 0set cint 30d z使用注解:draw title 500mb Heights and Vorticity风矢量:clearset gxout vectord u,v这里我们显示两个表达式,第一个是U分量矢,第二个是V分量矢。

我们也可以使用第三个字段使图像彩色化d u;v;q或者:d u;v;hcurl(u,v)你也可以显示任何区域以显示伪矢量:cleard mag(u,v);q*10000此处U分量是风速和V分量是湿度。

我们也可以查看流线(并且着色)clearset gxout streamd u;v;hcurl(u,v)或者我们可以查看实际的格点值clearset gxout gridd u我们可能希望改变地图背景:clearset lon -110 -70set lat 30 45set mpdset namset digsize 0.2set dignum 2d u改变投影:set lon -140 -40set lat 15 80set mpvals -120 -75 25 65set mpproj npsset gxout contourset cint 30d z我们让grads可以操作纬度从140W到40W之间,经度从15N到80N之间的数据。

但是我们告诉它使用从120W到75W和25N到65N极坐标投影绘图。

多余的部分被投影程序修剪掉了。

该简单教程到此结束。

此时,你可能希望深入查看数据集,或者你可能希望浏览GrADS文档并且尝试此处描述的其它选项。

英文原文并没有完全按原文翻译。

reinit 初始化、关闭文件q/query file 查询文件,xyz格点数,时间,变量,(变量层<小于z>,)q ctlinfo 路径名字缺色值xyz格点数,初始值,stepsopen 打开文件d/display (temp) 绘图输出c/clear 清除draw title (name)给图添加名字,如果加上反斜杠,名字分两行保存文件enable print <routine<file.gmf>>printdisable print格式转换,gv32,打开文件.gmfquit 退出系统维数环境设置set lat纬度(负南纬)/lon经度/lev(海平面之上百帕以下位势米)/time val1<val2>set time 12zsep格点坐标set x/y/z/t val1<val2> 如,set x 10 30 set t 1 40改变缺省图形处处类型set gxout graphics_typeset z 40(不用此命令,默认输出第一层)set gxout shaded(二维填色图)(用于等温图)添加温度与颜色的对照图cbarn/cbard tempvector矢量形式绘二维风场set gxout vectord u;vd skip(u,4,4);skip(v,4,4)每四个格点取一个计算风速大小d sqrt(u*u*,v*v*)d mag(u,v)chapter 2 图形要素设置set ccolor <color number>设置图形颜色set cstyle <style number>设置等值线线型set cthick <thickness number>设置等值线线宽set cterp on/off 设置样条差值光滑开关off可使添色图与等值线的边缘重合set clab on/off/forced/dtring/autoon快速标记,缺省值水平位置offforce强迫标记所有等值线clab %g<需要的字符如%gK,%g%%>set clopts color<thickness><size> 默认值为-1,-1,0.09set cint value 设置等值线间隔,clear之后重设set clevs lev1 lev2设置特定的等值线,即lev1,2 的等值线显示set ccols col1 col2设置等值线的颜色,各数值对应于set clevs命令对应的个等值线set cmin/cmax value 画出不低于/高于value的等值线set black val1 val2 画出介于v1 v2之间的等值线clear之后均重置set stream value 设置流线密度,value值在1到10之间,5为缺省set rbcols clo1 clo2 <clo3> 设置新的彩虹序列,set color 用set rgb命令定义set rbcols auto启用内定的彩虹颜色set rbrange low high设置彩虹颜色序列对应的等值线范围,介于最高最低值之间的等值线按彩虹排列,之外的同色(两种)对于line类型的设置set cmark cmarker设置线条上的标记符号0无标记set wrang vlo vhi 设置坐标轴通常指y轴标尺的取值范围set missconn on/offvectorset arrscl size 设置矢量箭头长度0.5-1.0set arrowhead sizeset zlog on/off z方向取对数尺度的开关,重设后才改变set xaxis/yaxis start end <incr>设置坐标轴的起始值和结束值,以incr作为增量set grid on/off 设置是否显示网格线set annot color<thickness> 设置坐标轴的线宽和颜色set xyrev on 交换水平竖直坐标轴set xflip/yflip on 水平/竖直坐标轴维数转向地图投影设置set mproj proj设置地图投影方式nps/sps北/南半球基地投影set map color style thicknessset mpdraw on/off off不绘地图背景,但是地图标尺起作用chapter 5页面控制set vpage xmin xmax ymin ymax 设置一个给定的虚页set vpage offset parea xmin xmas ymin ymax 在给定位置绘图set parea offchapter 6 基础绘图指令draw string x y string在xy位置上写一串字符string性质由set string 和set strsiz命令指令,如”drawstring 2 7 sunjia”set strsiz hsiz<vsiz>设置字符大小,hsiz高度vsiz宽度set string colordraw line x1 y1 x2 y2set line color<style <thickness>设置线条draw rec xlo ylo xhi yhi 画一个矩形draw recf xlo ylo xhi yhi 在矩形中添色draw mark marktype x y size 在xy位置处画一个标记为marker的标记chapter 7 函数ave()求平均值aave(expr,x=x1,x=x2,y=y1,y=y2)求面积平均abs(expr)绝对值cdiff(expr,dim)中央差分函数hcurl(u,v)涡度mag(u,v) 求风速chapter 9 定义变量define varname=vpr。

相关文档
最新文档