科学网

 找回密码
  注册
科学网 标签 GMT 相关日志

tag 标签: GMT

相关日志

Nature论文中的三维图原来是这么画的
zhikuiguo 2020-7-29 23:15
高水平科研结果必须要用高水平数据可视化方式展现给编辑、审稿人和读者才能赢得更多的理解和支持!利用GMT可以容易的实现三维数据可视化,这里将我多年摸索得来的独家秘方全部奉上!用GMT绘制三维图,学这一个例子就够了。提供全套解决方案,包括修复三维绘图bug之后的独家GMT版本,还有教程中所需要的所有的运行环境和程序,全部打包为Docker镜像。再也不用担心有些命令无法在你电脑上运行了。Nature子刊作者手把手教学,附带三小时4K教学视频和全部代码,将三维绘图和一些常用gmt命令和数据处理一网打尽! 幻灯片预览 教程内容 效果展示 先上一个效果展示图, 符合你的预期再往下看 图1 Nature Communications( 10.1038/s41467-020-15062-w )论文中的图1用GMT绘制的效果 绘图过程简介 GMT绘图复杂组合图,建议采用先拆分后组合的策略! Figure1(a,b) 这是两个二维图,完全没有难度,直接上图。 Figure 1 (a) Figure 1 (b) Figure1(c) 海底地形三维立体图+三维散点,这个必须使用我修复bug之后的gmt才能画出这种效果,所需要的所有程序都在docker镜像里面。只需简单的三个命令就可以使用,完全无压力! Figure1(d) 海底地形三维立体图+三维散点+切片数据+切片投点和曲线,这个必须使用我修复bug之后的gmt才能画出这种效果,所需要的所有程序都在docker镜像里面。只需简单的三个命令就可以使用,完全无压力! 最终组合 图1的最主要的四个子图,每一个都能够单独绘制,然后将其进行组合布局。因为gmt不是一个所见即所得的绘图软件,所以为了更方便的设置每个子图的位置,可以通过一个A4纸大小的网格作为辅助底图进行布局调整。 三小时高清精讲视频和全部绘图代码 见 三维数据可视化之GMT风格 图1的不完整绘图代码示例 总共两百行代码就可搞定上面的三维+二维组合图 function preset () { path_data=../../data/raw bathy= ${path_data} /bathy/bathy_Longqi_cart.nc basalt= ${path_data} /sites/site_basalt_cart_zhao_bathy.txt #数据范围 zmin=-6 zmax=-1.5 zrange= $zmin / $zmax xmin=-18.35 xmax=33.35 ymin=-29.9826 ymax=11.653 range= $xmin / $xmax / $ymin / $ymax range_xyz= ${range} / $zrange xmin_eq=0 xmax_eq=20 ymin_eq=-10 range_xyz_eq= $xmin_eq / $xmax_eq / $ymin_eq / $ymax_eq / $zmin_eq / $zmax_eq #视角 angle_h=-40 angle_v=45 angle_view= ${angle_h} / $angle_v #图片大小 width_x_fig=8 } gmtbeginFigure1pdf #(a) move_x=0 move_y=12 #gmtbasemap-JM$figwidth_inset-R$range_inset-Bwsen--MAP_FRAME_TYPE=plain #gmtbasemap gmtcoast-Ggray-JL $lon0_inst / $lat0_inst / $lat_min_inset / $l gmtgrdcontour $bathy_AUV -C0.02-A+f3p,Helvetica+ggreen-W0.2p-GD500e-p #采样点 symbol_sample=c gmtpsxy $path_data /sites/M-active.txt-S $symbol_sample $si #legend #(d) move_x=-1 move_y=-4 gmtbasemap-JX $width_x_fig_eq / $width_y_fig_eq -JZ $width_z gmtgrdview $bathy -JZ-p-C $bathy_cpt -N ${zmin_eq} +g $color_profile -Qi-I0+a45-Wf0.5p,black awk '{print$1/1000.0,$2/1000.0}' $earthquake |gmtgrdtrack-G $bathy |gmtpsxyz-JZ-p-Sc $size_eq -Ggreen-Wblack #东西方向 gmtbasemap-JX $width_x_fig_eq / $width_z_fig_eq -JZ $width_y_ #boundarybetweentitleandlegend #symbolspacelegendtypelength(-)thickness,colorspaceLegendName #N3 H10pHelveticaLegendoffigure(c) N2 G ${gap_rows} c S ${left_symbol} ca0.3c $color_active 0.2p, $color_active ${symbol_text} cActivehydrothermalfield S1cc ${size_symbol} c $color_basalt 0 gmtend rmtmp*gmt.historybox.eq
个人分类: 科研作图很简单|6701 次阅读|0 个评论
GMT 6中的-B选项
zhoufcumt 2019-12-11 07:05
-B选项用于控制底图边框的绘制。 二维底图有四条边,分别用东西南北(WSEN或wsen)或左右上下(lrtb)的单词首字母表示,每条边都有四种状态: 不出现某个字母 -- 不绘制该字母所对应的边 出现大写字母WSEN -- 绘制某条边,该边有刻度、有标注 出现小写字母wsen -- 绘制某条边,该边有刻度、无标注 出现小写字母lrtb -- 绘制某条边,该边无刻度、无标注 效果图: 对应bat脚本: gmtbegin2D-axes-examplespng gmt set FONT_TITLE15p gmtsubplotbegin1x7-Fs4c/4c-M5p/10p gmtbasemap-R0/4/0/4-BWS+t -BWS -c gmtbasemap-R0/4/0/4-BWSEN+t -BWSEN -c gmtbasemap-R0/4/0/4-BWSen+t -BWSen -c gmtbasemap-R0/4/0/4-BWSrt+t -BWSrt -c gmtsubplotend gmtend bat脚本附件(将后缀txt改为bat): Boption.txt
个人分类: GMT|3772 次阅读|0 个评论
GMT常用备份(持续更新中)
zhoufcumt 2019-12-9 14:46
GMT绘制符号: Word 字号与GMT 中字号(p) 对应关系: GMT 支持的35 种字体的名字及对应的编号: GMT特殊字符: 如果文本使用了12 号字体(Symbol)或34 号字体(ZapfDingbats),则此时八进制码具有不同的含义。需要查询下表: 欧洲特殊字母: GMT转义字符:
个人分类: GMT|3312 次阅读|0 个评论
GMT 6添加文字
zhoufcumt 2019-12-8 09:13
将-F+f font 中的 font 修改为不同的值,可获得不同效果的文字,如下图: bat脚本: gmtbegintext_exampleseps,png gmtbasemap-JX15c/6c-R0/10/0/12.5-Bxa1-Bya2-BWS gmtbasemap-Bne set font =30p set offset = 1 (echo 1 %offset% LM %font% TEXT echo 3.2 %offset% LM15p,8,black %font% ) ^ |gmttext-F+j+f set font =30p,8 set offset = 3 (echo 1 %offset% LM %font% TEXT echo 3.2 %offset% LM15p,8,black %font% ) ^ |gmttext-F+j+f set font =30p,8,red set offset = 5 (echo 1 %offset% LM %font% TEXT echo 3.2 %offset% LM15p,8,black %font% ) ^ |gmttext-F+j+f set font =30p,Courier-Bold,blue set offset = 7 (echo 1 %offset% LM %font% TEXT echo 3.2 %offset% LM15p,8,black %font% ) ^ |gmttext-F+j+f set font =30p,5,blue=1p,black,solid set offset = 9 (echo 1 %offset% LM %font% TEXT echo 3.2 %offset% LM15p,8,black %font% ) ^ |gmttext-F+j+f set font =30p,5,-=1p,black,solid set offset = 11 (echo 1 %offset% LM %font% TEXT echo 3.2 %offset% LM15p,8,black %font% ) ^ |gmttext-F+j+f gmtend bat脚本附件(需将后缀名txt改为bat): text.txt
个人分类: GMT|5020 次阅读|0 个评论
GMT颜色表
zhoufcumt 2019-12-7 20:03
GMT支持通过颜色名指定663种颜色,附件给出了GMT支持的所有颜色名及其对应的RGB值。 GMT_RGBchart_a4.pdf GMT_RGBchart_letter.pdf GMT填充图案: GMT_patterns.pdf
个人分类: GMT|8853 次阅读|0 个评论
MAC shell脚本运行 GMT
mycoon 2019-5-17 10:01
使用GMT绘图时,不知道在MAC下如何运行脚本,现在已经知道如何运行脚本,但是尚未解决GMT脚本的运行,可能是安装的GMT环境变量未设置。 1、 新建以文本文件,命名为f.sh,注意使用unix下的格式,否则运行会提示错误 2、cd路径:cd 文件路径(到文件名的上一层) 3、赋予终端运行shell文件的权限:chmod +x f.sh 4、拖入文件名到终端或者:.\\f.sh
个人分类: 感性|2835 次阅读|0 个评论
关于GMT5.X版本安装在Windows上的方法
xiaoairen322 2019-4-22 10:18
感谢GMT中文社区 GMT,全称Generic Mapping Tools,中文一般译为“通用制图工具”,是地球科学最广泛使用的制图软件。GMT具有强大的绘图功能和数据处理功能。 绘图方面,GMT支持绘制多种类型的底图,包括30多种地图投影、笛卡尔线性坐标轴、对数轴、指数轴、极坐标系,支持绘制统计直方图、等值线图、2D网格图以及3D视角图等,也支持绘制线段、海岸线、国界、多种符号、图例、色标、文字等。 数据处理方面,GMT具有数据筛选、重采样、时间序列滤波、二维网格滤波、多项式拟合、线性回归分析等功能。 gmt 5.x 安装在Windows上需要以下软件来支持 依次对这些软件进行安装,进行配置 对GMT 进行安装 安装时勾选 dcw ,对gmt pscosat 进行绘图支持,然后将需要的中文字体复制到 安装目录下 然后安装gs 921.. 默认安装即可 最后安装gsview 默认安装 安装毕 进行高级选项配置; 在option选项下 选择 advanced configure 在第二 第三编辑框内 加上Windows字体库所在位置 即C:\\windows\\fonts即可。 查看 是否汉语字体配置成功 在dos 下输入 gmt pstext -L 然后打开 一个带有汉语文字的gmt ps 的图
个人分类: gnss|4012 次阅读|0 个评论
关于Windows系统下GMT中文支持(补充)
xudy 2018-8-1 12:24
关于在windows平台下GMT显示中文字体的问题,GMT 中文社区已经有非常详细的解答( https://docs.gmt-china.org/install/cn-windows/ )。本文在此做一些补充,主要为 如何添加所需的中文字体与一些注意事项。 1注意事项 1)必须安装 gsview ,否则无法支持显示中文; 2) 安装 ghostscript时, 需要勾选 Generate cidfmap for Windows CJK TrueType fonts ; 3) 若使用记事本编辑 bat 文件,则保存时应注意编码方式为 ANSI,Unicode 或 Unicode big endian ,若使用 UTF-8 编码则会出现乱码;另外,很多编辑器默认将文本文件以 UTF-8 编码保存,因而可能需要修改编辑器的默认编码。 这点非常重要!!! 4) pstext txtfile -J params - R ... 在 windows 平台下可能不合适,需要写成 echo...tmp;pstext tmp 的形式,见上链接中测试脚本。 echo32.535p,39,blackGMT宋体tmp echo31.035p,40,blueGMT仿宋tmp ... gmtpstexttmp-R... 5)pstext 命令后加上 psconvert 命令,使用 psconvert 命令 -C 选项告诉 ghostscript 字体路径。 可能需要 gmtpsconvert%PS%-C-sFONTPATH=C:\\Windows\\Fonts psconvert 命令语法,链接: https://modules.gmt-china.org/psconvert/ 2 如何添加需要的中文字体 1)查看所需中文字体名称: 查看 cidfmap 文件,文件位置: ghostscript 的安装目录下 lib 文件夹下,找到我们所需字体的名称,如幼圆的名称: YouYuan。 cidfmap 文件(部分): %! %cidfmapgeneratedautomaticallybymkcidfm.psfromfontsfoundin %C:/Windows/Fonts %Substitutions /FangSong/CSI /Path(C:/Windows/Fonts/simfang.ttf)/SubfontID0/FileType/TrueType; /Batang/CSI /Path(C:/Windows/Fonts/batang.ttc)/SubfontID0/FileType/TrueType; /Meiryo-Italic/CSI /Path(C:/Windows/Fonts/meiryo.ttc)/SubfontID1/FileType/TrueType; /MS-Gothic/CSI /Path(C:/Windows/Fonts/msgothic.ttc)/SubfontID0/FileType/TrueType; /MS-PMincho/CSI /Path(C:/Windows/Fonts/msmincho.ttc)/SubfontID1/FileType/TrueType; /MalgunGothicRegular/CSI /Path(C:/Windows/Fonts/malgun.ttf)/SubfontID0/FileType/TrueType; /SimHei/CSI /Path(C:/Windows/Fonts/simhei.ttf)/SubfontID0/FileType/TrueType; 注 :cidfmap 文件作用:实现 windows 自带汉字库的导入,扩展 gs 字库。 格式:字体名称,字体标准,字体路径,字体类型。 如 /FangSong /CSI /Path (C:/Windows/Fonts/simfang.ttf) /SubfontID 0 /FileType /TrueType ; 字体名称 : FangSong; 字体标准 :GB1; 字体路径 :C:/Windows/Fonts/simfang.ttf; 字体类型 :TrueType。 2)将所需字体名称 加入 GMT 字体配置文件中 配置文件位置( 找到 GMT 的安装位置 ): GMT 5.1.2 及其之前版本: C:\\...\\gmt5\\share\\pslib\\PS_font_info.d GMT 5.2.1 及其之后版本: C:\\...\\gmt5\\share\\postscriptlight\\PSL_custom_fonts.txt 如: STSong-Light--GB-EUC-H0.7001 STFangsong-Light--GB-EUC-H0.7001 STHeiti-Regular--GB-EUC-H0.7001 STKaiti-Regular--GB-EUC-H0.7001 YouYuan--GB-EUC-H0.7001 3)在DOS窗口下使用 gmt pstext -L 命令查看该加入字体的编号。如幼圆的编号为41。 4)利用字体编号显示所需中文字体 如: echo104.2030.8%fontsize%041CB成都tmp gmtpstexttmp-J%J%-R%R%-K-O-F%PS% 注: 41 就代表幼圆的字体编号,详细 pstext 语法见 http://gmt.soest.hawaii.edu/doc/5.4.4/pstext.html 如需深入了解 GMT 显示汉字的原理,见参考文献。 参考文献: 苏鹤军,张慧,李晨桦等. 2013.GMT 绘图软件汉字库配置技术应用研究.地震工程学报, 35:928-935 链接: https://pan.baidu.com/s/1fVk1s32LQNM_ptKin74MbQ 密码 :tldn
个人分类: GMT|8010 次阅读|0 个评论
gmt set 的一些东西(图片)
tao164411096 2018-7-29 11:20
复制图片来自GMT中文社区《GMT参考手册》 https://docs.gmt-china.org/conf/intro-conf/#id5 \0 \0 \0 \0 \0 \0
个人分类: GMT|3524 次阅读|0 个评论
[转载]win安装GMT
hejianhui 2018-3-30 14:02
首先下载四个必备文件: 1. gmt-5.4.3-win64.exe (64位) http://gmt.soest.hawaii.edu/projects/gmt/wiki/Download 2. Notepad++ (npp.7.4.2.installer.exe) http://notepad-plus-plus.org/ 3. Ghostscript ( gs923w64.exe) http://www.ghostscript.com/ 4 . Sumatra PDF (sumatraPDF-3.1.2-install.exe) http://www.sumatrapdfreader.org/free-pdf-reader.html 5. gawk for Windows (gawk-3.1.6-1-setup.exe和gawk-3.1.6-1-src-setup.exe) http://gnuwin32.sourceforge.net/packages/gawk.htm (下载 Complete package 和Sources) 安装步骤: 1. 安装gmt,推荐使用默认目录,装好以后,右键点击计算机,属性, 高级系统设置,环境变量,系统环境变量,找到Path,点新建, 然后 C:\\Programs\\gmt5\\bin; C:\\Programs\\gmt5\\include; C:\\Programs\\gmt5\\share; C:\\Programs\\gmt5\\lib , click确定 2. 安装Notepad++,也采用默认目录。 3. 安装Ghostscript,也是用默认目录。 4. 安装Sumatra PDF 也采用默认目录。 5. 安装两个setup时,默认c:\\Program Files\\GnuWin32\\. 装好以后,右键点击计算机,属性, 高级系统设置,环境变量,系统环境变量,找到Path,点新建, 然后 c:\\Program Files\\GnuWin32\\bin 确定 安装好以后,先配置一下Notepad++ (注意,a,b为必要步骤,其他只是一些为使用方便的步骤)。 a. 打开Notepad++,点“插件”-“Plugin Manager”-“Show Plugin Manager”会打开插件管理器,在“Available”标签页中找到一个叫 NppExec 的插件,勾选,点 install。然后会出来两次对话框,均点 “是” 即可。 b. 点 “插件”- NppExec -Follow $(CURRENT_DIRECTORY) c. 点“插件”- NppExec -NppExec Console Filters 在Filter标签页上,勾选3个选框,分别是“Enable Console Output Filter”,“Exclude duplicate....”和 “Exclude all.....”。 d. 还是在这个NppExec Console Filters里,点Filter标签页旁边的Replace标签页,最上面的两个选框打勾,“Find What”里填 : $(CURRENT_DIRECTORY) “Replace With”里填 GMT5 使用方法: 在gmt安装目录里,默认是 C:\\programs\\gmt5\\share\\doc\\examples\\ 把ex01复制到C盘以外的任意盘,比如D盘里。(自己建一个工作目录),看一下ex01文件夹里有没有 example_01.ps 文件,有的话先删除该ps文件。(为了测试上面的步骤是否安装好了)。 右键点击 example_01.bat, 用Notepad++ 打开,按F6执行,Command里填$(FULL_CURRENT_PATH),点ok。 不出意外的话,在你的ex01文件夹里会出来example_01.ps 这个图片。别着急, Sumatra PDF 要登场了 。 打开 Sumatra,点打开,浏览到你 ex01文件夹,打开里面的 example_01.ps。 如果打不开,请检查路径里是否有中文,有中文是不行的。 比如我的是在 E:\\ex01 里测试的。 然后,Notepad++在屏幕左边,Sumatra放在他的右边,在Notepad++里把第17行 Low Order Geoid中的任意一个字母换了,比如Low 改成 How,点 Ctrl+S保存,点F6,执行。然后,奇迹发生了,右边的图片自动更新了,Low变成了How,实现了实时预览。 ( 注意,每次编辑后一定要Ctrl+S保存后在F6执行,F6后,Command里一般已经填上了$(FULL_CURRENT_PATH),直接ok就行。另外,ps文件名字不要随便改,改了你就得在Sumatra里重新打开一下,相信这个一般都明白原理,就是Sumatra一直在实时监控你的example_01.ps这个文件 。) 注 :本文参考了 《 Windows下使用GMT的正确姿势 》 一文,网址为:http://seisman.info/how-to-use-gmt-under-windows.html 以及《 Windows下使用GMT(GenericMappingTools)全过程》一文,网址为:http://blog.sina.com.cn/s/blog_8fc890a20102vl8e.html
2323 次阅读|0 个评论
gmt4的一些简单命令
pan11 2018-1-14 14:24
自己习惯了gmt4的用法,一直使用,仅仅介绍一些命令的简单作用,但现在陆续开始应用GMT5,一些用法稍微改进,陆续会有更新gmt5的用法,详情见gmt主页 http://gmt.soest.hawaii.edu/gmt4/gmt/html/gmt_services.html 以及主页 http://gmt.soest.hawaii.edu/ -R 设定范围 xmin/xmax/ymin/ymax 定义直角坐标地理坐标系 xleft/yleft/xuright/yurightr 后面加r 这个表示倾斜的投影直角地理 描述最下面左边的点和最右边上边的点坐标 grdfile 描述 -Rd代表 -180/180/-90/90 -Rg表示0/360/-90/90 -R2009-08-01T/2009-09-30T/25/40 -B 设定坐标轴间距a标注间隔f为框架的间隔g网格化 WSne为大写为出现方位轴 小写为隐藏该坐标轴 -X 移动图的左右位置 -Y 移动图的上下位置 -O 链接上图 -K 链接下图 -H 头文件的个数 -P 选择portrait plot模式输出 -U 画出系统时间图附在下面 -V 描述完成过程在显示屏中 注意事项: 1、不要省略参数,在每一行参数使用变量pscoast -J$J -R$R -B$B -W1p -A1000 -K $PS psxy -J$J -R$R -Sa0.5c -Gred -O $PS EOF 2、不要省略单位,一般默认Jx10 为c厘米,添加上 1. 尽量不要在$HOME下执行GMT命令(可能会产生临时文件,难以清理) 2. 尽量不要使用命令行执行GMT命令(因为你很可能会忘记你刚刚执行过哪些命令) 3. 使用gmtset的脚本,最后一定要记得删除.gmtdefaults4 3、对于-B选项,合理的用法是仅在第一个命令中使用 1、 blockmean L2(x,y,z)值的filter或者是decimator(每十个删去一个) 2、 blockmedian L1(x,y,z)tables值的filer或是decimator(每十个删去一个) 3、 blockmode 众数估计(x,y,z)table值的filter或者是(每十个删去一个) 4、 fiter1d filter 一维table值(时间序列) 5、 fitcircle 对于一系列的点找到最佳适合的大的圆或者小的圆 6、 gmt2rgb 将sun raster或者grid的文件转换为红蓝绿的grid 7、 gmtconvert 将数据table 从一个格式到另一个格式 8、 gmtdefaults 罗列目前默认的设置 9、 gmtmath 对于table数据进行的数学计算 对于ascll数据进行第三列计算 10、gmtselect 基于多个空间标准选择table数据的子集 11、gmtset 改变在.gmtdefaults文件中的参数 12、grd2cpt 从grd文件中制作cpt文件 13、grd2xyz 将grd文件转换为table文件 14、grdblend 混杂合成几个部分重复重叠的grd一个新的grd文件 15、grdclip 在已经grdding的数据束中限制z的范围 对grd文件进行修补 约束 -Sa 大于的值设置 -Sb 小于的值设置 16、grdcontour 将二维网格化数据等高线 17、grdcut 从一个grd文件中生成子grd文件 18、grdedit 修改一个二维grd文件的头信息 19、grdfft 在频率域执行操作在grd文件 20、grdfilter 在空间域中filter的grd文件 21、grdgradient 在grd文件中计算方向导数 22、grdhisteq 均等化柱状图grd文件 23、grdimage 从一个二维grd文件中生成图像 24、grdinfo 得到grd信息 25、grdlandmask 从shoreline 数据包中生成masking数据 26、grdmask 重新设置grd的node输入或者输出clip路径到常量中 主要用于将与想要的数据 距离 或者用度数 设置为 多少 之远 范围外进行屏蔽 想要的数据进行成图,不想要的数据不显示 27、grdmath 对于grd文件的数学计算 主要是第三列进行计算科学运算 28、grdpaste 沿着公共的边缘粘帖grd文件 29、grdproject 投射grd数据到一个新的坐标系统 30、grdreformat 将grd格式转变为其他格式 31、grdsample 重新取样一个二维grd文件到一个新的grd文件 32、grdtrack 沿着一维的轨迹进行对二维grd文件取样 沿着一系列的数据进行投影 grdtrack 沿着xy的剖面进行对grd文件的取样,test文件的前两列必须与grd文件的前两列性质一样, grdtrack test -Gmi.grd junk.dat 得到的junk文件是源文件后面加一列取样值 33、grdtrend 多项式拟合趋势grd文件 34、grdvector 画出二维grd文件的矢量图 35、grdview 从3维的角度画出二维grd文件 36、grdvolume 计算在一个特定等高线的表面的体积 37、greenspline 在一维二维三维 的数据进行格林函数的插值 最小曲率样条插值 -Sc -D1 笛卡尔坐标 -sp -D3 球面坐标 连续曲率样条插值 -St -D1 笛卡尔坐标 -sq -D3 球面坐标 38、makecpt 制作cpt文件 39、mapproject 转换table数据的坐标系统 40、minmax 显示table数据的特殊值 -I 显示R范围 41、nearneighbor near-neighbor网格化 插值方法 42、project 投射table数据到一条线或者大圆中 三种方式 1 用-A 和-C 方位角和中心位置经纬度 2 用-C 和-E 起点和终点位置 3用-C和-T 中心位置和旋转轴位置 -C 起点x/y -E 投影的终点x/y -G 生成的间隔 -A 方位角 从北向开始 为o度 -L 为投影长度 -W 为投影宽度 -F 输出格式 xyzpqrs 分别为 xy为点的坐标,z为剩余不变的东西 pq为平行和垂直于投影面的距离 rs为投影到新的截面投影点的对应的原图的坐标 43、ps2raster 修剪转换ps文件为raster图像,eps格式,或者pdf格式 转换为jpeg的格式 ps2raster file.ps -A -Tj 44、psbasemap 生成底图 45、psclip 用多边形文件定义修剪路径 46、pscoast 画出海岸线、边界和河流 47、pscontour 等高线画图或者三角剖分table数据 48、pshistogram 画直方图 49、psimage 画sun raster文件 50、pslegend 画图例 51、psmask 建立一些覆盖遮住图像的一些区域 52、psrose 画扇形或者玫瑰图表 53、psscale 画灰色比例或者颜色比例 -D定义中心/上方(水平),中心/左侧(垂直),然后是图例的大小比例长/宽,默认是垂直,后加h为水平 -D6.5i/2i/7.5c/1.25c 7.5长1.25宽,离画图6i宽,4i高 54、pstext 画字符串 4.5 -1.2 27 0 1 LM -- y=sin(x)+cos(x) x坐标位置 y坐标位置 字体大小 旋转角度 字型 表示位置LM为左边的中间 表示内容 L为左边 C为中间 CM为中间的中心 R为右边 TR为右边的上边 M为中心 B为下边 LB为左边的下边 55、pswiggle 画table数据时间序列沿着轨迹 56、psxy 画符号多边形线 psxy -R0/241/0/6000 -JX6.3i/1.4i track4.d -W1p -X3.5 -Y6 -Ba40f10:km:/a1000f500:.Profile_DD::Elev(m):WnSe -K profile_D.ps -R范围,-J投影方式,文件可以为grd文件,-W画笔,-B 在文件中拥有 然后加数据 在psxy中加 -M 为画多条线段,若在文件中没有 则是仅仅画点。 有三列,psxy将解释第三列作为符号大小,如果没有符号说明,用了-S,则解释数据的最后一列, 57、psxyz 画符号多边形线在三维 58、sample1d 重新取样一维数据 59、spectrum1d 从时间序列中计算不同的谱估计 60、splitxyz 拆分xyz数据文件几部分 61、surface 连续曲率grid算法 62、trend1d 拟合多项式或者傅立叶趋势到y=f(x) trend1d ex1.dat -Nf10 -Fxmr ex1.fit #-F为x=x,y=y,m=modelf(x),r=residual y-m 输出残差到新的数据为后面最后一列 -w在拟合中用到加权为在原数据中第三列为 -N f为傅立叶拟合一般用于又cossin项的 加r为强制约束拟合,数字2为最小二乘,多项式拟合。 去趋势-Fxr 不加m,拟合用m 后面加r输出残差(拟合的数据与原先数据的差值) 63、trend2d 拟合趋势二维z=f(x,y) 64、triangulate 执行最佳的delaunay插值网格化 65、xyz2grd 转变xyz数据为grd文件 66、grdraster 从一个二进制raster文件中提取子区域并写入grd文件 67、psmeca 画震源机制图 -R 范围 -B设置边界间隔 -J 设置投影 infile输入文件为多个或者一个 -Ddmin/dmax 只绘制某个深度范围之内的地震 -E 震源求拉伸象限的颜色 -e指定T轴的颜色 -p指定p轴线条属性 -G 震源球压缩象限的颜色 -g指定p轴颜色 -t指定t轴线条属性 -L 绘制震源求外部轮廓的属性 -r在文本周围加上方框 -M 默认震源求大小与震级大小成正比,这个代表所有震源求一样大小 -Z 指定cpt文件 根据数据文件的第三列值以及cpt文件指定深度 -C 将最后的两列变成新的经纬度,然后用c进行线条颜色属性偏移 -a 计算并绘制p轴与t轴 可以指定大小与P轴t轴的符号 -Sc global cmt格式 地震矩单位dyne-cm scale指定的为震级为5的震源球大小相当于4.0e23 dyne.cm 尾数为4 指数为23 x y depth strike1 dip1 strike2 dip2 rake2 mantissa(地震矩的尾数) exponent(地震矩的指数) newx newy title -Sa 按照AkiRichards的约定 x y depth strike dip rake mag newx newy title -Sm global cmt格式 默认为这个格式 x y depth mrr mtt mff mrt mrf mtf exp newx newy title 68、pscoupe 画震源机制的十字剖面 命令基本与pemeca一样 -Aalon1/lat1/lon2/lat2/dip/p_width/dmin/dmax 两个断点的经纬度,dip为投影平面的倾角,p_width为投影平面两侧的宽度 后面为距离水平面的最小和最大距离 -Ablon1/lat1/strike/P_length/dip/p_width/dmin/dmax 69、pspolar 画震源机制下半球的极性 70、psvelo 画速度矢量,十字画以及契形图 71、nc2xy 转化netcdf格式文件为ascii xy文件 72、sphdistance 计算最近的距离来自空间球面数据的voronoi 73、sphtriangulate 对球面空间数据进行最佳delaunay插值或者voronoi构建 74、sphinterpolate 张力网格化数据对于球面空间数据 75、grdrotater 对grd文件进行欧拉极旋转
个人分类: 程序技巧|4783 次阅读|0 个评论
[转载]GMT基本绘图原理
blogyxp 2017-3-31 21:43
原文地址: GMT_绘图-整理-入门-夏少波 作者: Jeck 目录 一、 GMT 安装 二、 GMT 工作的基本原理 3 、 GMT 案例 案例 1 :日本附近地震分布图(指令 psxy ) 案例 2 :以台湾地区地形图数据为例 案例 3 :低阶大地水准面以及等高线绘制 cookbook example 1 案例 4 :台湾地区画高度 小结: 附录 NetCDF 格式 常用标签 资源网址: 一、 GMT 安装 http://gmt.soest.hawaii.edu/ 进去后点击 DOWNLOAD 在 Platform-specific Instructions 进行平台选择, Windows 下,在 GMT Windows 下进入下载界面。下载好了以后,双击安装 gmt_install32.exe 。输入 cmd 进入 dos 命令操作界面,然后输入一个测试指令 gmt2bin 。 若提示:’ gmt2bin ’不是内部命令,也不是可执行程序或批处理文件; 则加环境变量,系统变量,选择 path ,点击编辑,在变量值里面填写上 c:programsgmtbin;( 即路径名 ) 这样就安装好了。 二、 GMT 工作的基本原理 其是在 cmd 下完成操作的。你设想的东西,变成命令,输入实现,所想即所得。 一般来说,各个命令有很多参数。有必须的参数和可选的参数。可选的输入文件有: 1. 数据表。电子表格的列数有一定限制,行数不限。可以分为两类: ASCII 码文件(除非数据文件巨大,为首选格式) 二进位文件(加快输入 / 输出速度) 2. 网格数据组。 为数据矩阵(数据点在两个坐标方向等距分布)。有两种格式: 网格线配准( Grid – line registration ) 像素配准( Pixel registration ) 你可以从几个文件格式中选择(也可以定义你自己的文件格式),但 GMT 缺省 格式是 netCDF( 说明见后面 ) 。 3. 调色板表(用于影像图、彩色图和等值线图)。 输出的数据有 ps 格式的数据 1 、打开 ps 文件: coredraw 2 、或者安装:先 GhostScript ,后 Gsview 。网上有破解的,默认安装在 C:Program FilesGhostgum 下 3 、 GMT 案例 “ .gmtdefaults_In ” 等中是一些基本的配置 可以复制,不同配置。 – B : 间隔量设置 -JM: 墨卡托投影设置 类似的有 -JB –JG -JK 等 -K –O : 图需要多次覆盖重画时候的保留选项 案例 1 :日本附近地震分布图(指令 psxy ) 提供的数据: quakes.ngdc quakes.cpt quakes.ngdc 现在对经纬度和震源深度感兴趣。需要从文件中提取出这 4 个量。 Windows 下使用 gawk 来快速处理。命令如下: gawk “ {if ( NR 3 ) print $5, $4, $6, 0.02*$7} ” quakes.ngdc quakes.d 执行这条命令的过程是,程序打开数据文件 quakes.ngdc ,根据条件语句, 跳过前 3 行,由第 4 行开始读取,依次读取需要的第 5, 4, 6 和 7 列,同时对第 7 列的数据乘以系数 0.02 。输出文件 quakes.d 格式如下: X Y Z quakes.cpt 内容如下 , 是一个颜色映射表,依据深度,不同颜色。对第三行数据进行判别,赋予颜色 最后有命令: pscoast –R130/150/35/50–JM6i–B5–P –G200–Lf134/49/42.5/500 –K map.p psxy–R –JM –O–Cquakes.cpt quakes.d –Sci–W0.25p map.ps 简单的解释: pscoast 就是画海岸陆地的程序。 “ –R130/150/35/50 ”就是一个区域范围,格式为“ ” “ –JM6i ”就是设置墨卡托投影 ----- “ Jm 与 JM 的区别在于绘图大小不一样的规定方法。 m 是规定的一度的大小,比如 Jm1i ,就是用 1 inch 来代表一度。 JM 则是规定的整幅图的大小,例如: JM5i 就是定义图片是 5inch 大。” “ –B5 ”坐标轴增量是 5 “ –G200 ” 填充颜色 灰度 “ –Lf134/49/42.5/500 ” 比例尺绘制 500km 的比例 134/49/42.5 是比例尺的定位 “ –K ” 暗示,其后这个文件会被其他元素输入而覆盖上。。 “ psxy ”画点的程序, pxsy 从文件或标准输入中读取 (x,y) 数据对,并在地图上的相应位置绘线、多边形以及其他符号 “ –R ” 指定绘图区域的西、东、南和北。这里在原来基础上,默认 “ –JM ” 这里投影方式不变 “ –O ” 覆盖绘图方式 “ –Cquakes.cpt quakes.d ” “ 指定调色板文件。如果使用了 -S 选项,则所绘的符号的颜色由输入数据第三列的 z 值决定。其他字段的意义都分别向后增加一列(例如符号的大小由输入数据的第四列而不是第三列表示,等等)。如果 -S 没被指定, psxy 会等待用户提供一个多段的多边形文件(需要 -M 选项),并且在每个多段文件头中寻找 -Zval 。 val 将通过命令参数表控制颜色 ” “ –Sci ” 绘符号 , -Sc 圆形。大小为圆的直径 , size is diameter of circle “ –W0.25p ” 设置画笔属性。 结果图片: 案例 2 :以台湾地区地形图数据为例 数据下载: http://topex.ucsd.edu/cgi-bin/get_data.cgi 名字改为 tw.dx 使用批处理文件 *.bat ,进入到数据存放的目录,将 *.bat 文件拖到 dos 运行框中,回车即可。 BAT 文件内容(红色是文件语句。黑色是说明): gmtdefaults -D .gmtdefaults4 Print the system GMT defaults to standard output. Append u for US defaults or s for SI defaults. gmtset BASEMAP_TYPE Plain 设置地图 set filename=twtopo.ps 方便的输出文件名 surface tw.dx -R117.0083/125.0083/19.003/28.0051 -I1m -Gtw.grd 在 gmt 中由 xyz 文件转到 grid 的文件有两个主要命令: xyz2grd, surface, 前面已经提到 xyz2grd , xyz2grd 要求等间隔采样,有时候显得很不方便。而 surface 可以提供一个较好的方式。 A continuous curvature gridding algorithm 应该可以理解为曲率连续的网格插值算法,具体的例子在 cookbook 的 6.14 , 6.16 都有用到。 grdgradient tw.grd -Csealand -A0/45 -Gtw.grd.int -Ne1 –M Grdgradient 制作梯度信息的网格文件,得到某一个方向的方向导数,输入文件为 HI_topo2.grd ,设置方向导数的方向为 0 °, -N 表示归一化,后面的 t 表示一种归一化算法 grd2cpt tw.grd -L4000/8000 -S-8000/4000/500 topo_sealand.cpt 从网格文件中获取调色板文件,输入文件为 *.grd ,设置浮雕模式,设置为联系变化的调色板 grdimage tw.grd -Jm3 -R118.5/123.5/20/26.5 -Ctopo_sealand.cpt -Itw.grd.int -P -K -V -UXSB %filename% Grdimage 画彩图,输入文件 *grd ,梯度信息的文件是 *.grd ,增加了立体的效果,好像有一束光从北方射过来,地形的不同造成了不同的效果。 pscoast -R -Jm -Di -Ba2f1 -W0.8p,0/0/0 -P -O -V %filename% 绘图 del .gmt* del *.int del *.grd 一些删除 结果图片: 案例 3 :低阶大地水准面以及等高线绘制 cookbook example 1 echo GMT EXAMPLE 01 set ps=example_01.ps gmtset MAP_GRID_CROSS_SIZE_PRIMARY 0 ANNOT_FONT_SIZE_PRIMARY 10 psbasemap -R0/6.5/0/9 -Jx1i -B0 -P -K -UExample 1 in Cookbook %ps% #Jx 代表线性投影, B0 代表 xy 轴没有刻度,亦同不加, P 竖开, -K 追加, -U 时间戳 pscoast -Rg -JH0/6i -X0.25i -Y0.5i -O -K -Bg30 -Dc -Glightgray %ps% #Rg 代表取经度全部 0/360,Rd 代表纬度 -90/90,-JH 表示摩卡托投影 ( 分别为中央经线和大小比例 )-X -Y 表示现对原点的偏移(原点在线性投影的左下角,可负) ,-D 使用数据精度, (f)ull, (h)igh, (i)ntermediate, (l)ow, and (c)rude –Bg60/g15 表示精度上间隔为 60 ,维度上为 15. grdcontour osu91a1f_16.nc -J -C10 -A50+f7p -Gd4i -L-1000/-1 -Wcthinnest,- -Wathin,- -O -K -T0.1i/0.02i %ps% #-A 表示标注数字等高线间隔 (+s 表示标注字体大小 ) , -C 表示等高线间隔, -Gd 表示同一标注字体间的距离, -L 表示画等高线的范围 ( 最小 / 最大 ) , -Wc 表示普通等高线的线粗细 , 后面用 - 表示是虚线线型, -Wa 表示带注释的等高线的线粗细,后面跟 - 表示是虚线线型, -T 最内环标志 ( 内凹,外突 ) 的间隔和高度 grdcontour osu91a1f_16.nc -J -C10 -A50+f7p -Gd4i -L-1/1000 -O -K -T0.1i/0.02i %ps% # 与上面不同,这里不用虚线, 这两句话重复的, 2 选 1 pscoast -Rg -JH6i -Y4i -O -K -Bg30:.Low Order Geoid: -Dc -Glightgray %ps% #-Y 表示 Y 轴向上移动 4 英寸 , 这里的 JH 和上面的不同, -JH 表示摩卡托投影 ( 分别为中央经线和大小比例 ) grdcontour osu91a1f_16.nc -J -C10 -A50+f7p -Gd4i -L-1000/-1 -Wcthinnest,- -Wathin,- -O -K -T0.1i/0.02i:-+ %ps% #-C 表示等高线间隔, -A 表示标注数字等高线间隔 (+s 表示标注字体大小 ) , -Gd 表示同一标注字体间的距离, -L 表示画等高线的范围 ( 最小 / 最大 ) , -Wc 表示普通等高线的线粗细 , 后面用 - 表示是虚线线型, -Wa 表示带注释的等高线的线粗细,后面跟 - 表示是虚线线型, -T 最内环标志 ( 内凹,外突 ) 的间隔和高度 grdcontour osu91a1f_16.nc -J -C10 -A50+f7p -Gd4i -L-1/1000 -O -T0.1i/0.02i:-+ %ps% #-C 表示等高线间隔, -A 表示标注数字等高线间隔 (+s 表示标注字体大小 ) , -Gd 表示同一标注字体间的距离, -L 表示画等高线的范围 ( 最小 / 最大 ) , -T 最内环标志 ( 内凹,外突 ) 的间隔和高度 # 这两句话重复的, 2 选 1 del .gmt* 结果图: 案例 4 :台湾地区画高度 代码 gmtset PLOT_DEGREE_FORMAT ddd:mm:ssF # 设置角度的单位是度分秒 set filename=gmt2011_03a.ps # 输出的文件名字 surface tw.dx -R117.0083/125.0083/19.003/28.0051 -I1m -Gtw.grd # 格网化数据 区域 内插 1m 输出文件 grd2cpt tw.grd -Crainbow -Z tmp.cpt # 函数 将格网画的数据 用彩虹表 映射出颜色对应表 grdgradient tw.grd -A45 -Gtw.grd.int -Ne1 –M # Compute directional derivative or gradient from 2-D grid file representing z(x,y) G Name of the output grid file for the directional derivative N 归一化 Ne Nt 等不同的归一化方法 M choose this option to convert dx,dy in degrees of longitude,latitude into meters, so that the units of grdgradient are in z_units/meter 经纬度转化为 dxdy 单位 m grdview tw.grd -Jm1.8 -Jz0.0003 -R117/125/19/27/-10000/4000 -Ctmp.cpt -Itw.grd.int -E150/40 -Qi -N-10001/200/200/200 -B1/1/2500:meter:SEwnz -K -V -X3 -Y4 %filename% # grdview - Create 3-D perspective grayshaded/colored image or mesh from a 2-D grid file #Sets the vertical scaling (for 3-D maps). Same syntax as − Jx. #-R For geographic regions, these limits correspond to west, east, #south, andnorth and you may specify them in decimal degrees or in # dd:mm #format. #C 颜色表文件 #I 正则化( -1 , 1 )的数据文件 #E 设置视角 经纬度 #Q 4 种设置 4 选 1 m c i g 四选一 分辨率选择? # N Draws a plane at this z-level. − Nlevel level -10001 ; 颜色灰度 #200/200/200 #B 间隔 # S-Smooth the contours before plotting # V-Selects verbose mode, which will send progress reports to stderr . #-X-Y 移动 xy 坐标 平移 #More PostScript code will be appended later pstext bk.txt -Jm -R -G255/0/255 -K -V -O%filename% # 加文字注记 xmin, xmax, ymin, and ymax specify the Region of interest 这里不设置 则默认原图的。 G-Sets the shade or color used for drawing the text # psscale -D10/-1/15/0.3h -Ctmp.cpt -Bf200a1000/:meter: -I -O -V %filename% # 画比 例尺 -D 选项是必须的。作用是指定颜色刻度条的位置和长宽值,默认是垂直的,加上 h 变为水平。 -C 选项作用是依据指定的调色板绘制刻度条。其实也是必须的,只是如果在命令中不提前指定,就会等待标准输入。 -B 选项设定注释和刻度线的间隔及标签内容。 x 轴标签一般指定颜色对应数据的意义, y 轴指定数据的单位。如 -B5:elebation:/:m: ,其中 5 代表刻度线的间隔, / 线前指定 y 轴标签, / 后指定 x 轴标签,如果 /:m: 改为 /:m@+2: 即显示为平方米。 #I 灯光 Add illumination effects 小结: 命令很多,所想即所得 附录 NetCDF 格式 NetCDF(network Common Data Form) 网络通用数据格式是由美国大学大气研究协会( University Corporation for Atmospheric Research , UCAR) 的 Unidata 项目科学家针对科学数据的特点开发的,是一种面向数组型并适于网络共享的数据的描述和编码标准。对程序员来说,它和 zip 、 jpeg 、 bmp 文件格式类似,都是一种文件格式的标准。 netcdf 文件开始的目的是用于存储气象科学中的数据,现在已经成为许多数据采集软件的生成文件的格式。 http://blog.163.com/jey_df/blog/static/182550161201221344642388/ 常用标签 -B ,边框,轴线定义,注解和标签; -H ,表示输入的表格文件有头文件; -J 选择一种地图投影或者非地图投影方式; -K 允许在这个作图命令后追加新作图命令; -O 在一个已经存在的图上继续作图; -P 选择图的摆放方式为肖像图方向(默认的是风景图方向),前者是竖直,后者是水平; -R 定义图的边界区域(左右下上); -U 画一个时间戳; -V 报告程序的计算流程; -X 设置图的坐标原点的位置 x 方向; -Y 设置图的坐标原点的位置 y 方向; -c 设置作图的份数; - :输入的地理坐标是纬线、经线而非默认的经线、纬线 资源网址: 数据下载: http://topex.ucsd.edu/cgi-bin/get_data.cgi http://gmtrac.soest.hawaii.edu/projects/gmt/repository/show/trunk/do 学习资料: http://gmt.soest.hawaii.edu/ http://xxqhome.blog.163.com/blog/static/196733020201192181356/ http://blog.sciencenet.cn/home.php?mod=spaceuid=387do=blogid=405288 http://blog.163.com/jey_df/blog/#m=0t=1c=fks_084065083082080074084083081095085094083070081086087069085 http://basinbank.org/?p=230
个人分类: GMT|3023 次阅读|0 个评论
学习GMT札记(二)---网格化方法
zhouduo 2016-10-7 11:03
在我们所获取的数据里,通常都是 (x,y,z) 形式,而这些数据有的已经是按规则的格 网排列好的, 而大多数都是不规则分布的数据形式。 对于按规则格网排列好的 (x,y,z) 数据,只需用 xyz2grd 命令即可生成格网文件;对于不规则分布或者随意分布的数据,首先需要将这些数据进行格网化,生成按规则格网排列的 (x,y,z) 数据,然后再 转化为格网数据。这里主要讨论随意分布的数据如何格网化并生成格网数据。 blockmean :用L2 norm的方法将输入档案过滤成区块平均数据 Ex: blockmean file(s)] -Ix_inc ] –Rwest/east/south/north ] ] ] ] 指令格式说明: blockmean指令可从标准输入设备(键盘)或档案读取没有排列的位置资料(x、y、z) 为 并且可由标准输出(屏幕)输出平均值数据。Blockmean和blockmedian、blockmode指令一样 为 作为指令surface的预先处理程序 为 以 防突出的资料干扰。此指令对于小数处理或平均值的计算也很有效。你可以对.gmtdefault檔之D_FORMAT的参数 为 作输出格式的处理;也可选择输入二进位档 为 并且输出单精度或双精确度的数据。 指令选项: xyz file(s)=输入3 栏的ASCII档案。W是加权值。若无档案输入 为 预设为键盘输入。 -I =指定格点的间距。M为分间距 为 s为秒间距。 -R =指出有兴趣观察的范围。r 为 旋转观察范围。 -C =指定区块的中心为输出位置。 。 -F =指定blockmean以pixel为单位 为 意指x=1和x=2及y=1和y=2所围成的方块为一个pixel 为 在此方块内平均有几个数据点。 -H =指名输入之档案有档头。(档头:档案开始之说明部分 为 不属于栏位资料) -L =指明x字段的坐标是经纬度坐标 为 其可能会与-R选项以360度所表示的方式不同。 -S =在block中表明z值的总合。 。 -V =在标准错误输出装置输出一些信息。 -W =指定加上加权参数的影响。-W:i/o都有加权值 为 -Wi:只有input的档案有加权值 为 -Wo:只在output档加上加权值。 blockmedian:用L1 norm的方法将输入档案过滤成区块平均数据,blockmode:用mode估计法将输入档案过滤成区块平均数据。 GMT 提供了3 种预处理的方法,分别为命令blockmean 、blockmedian 和 blockmode。第一个命令对网格间隔框内的值取平均值,第二个命令返回中值,后一个命令返回众值。 作为一般规律,我们对于大多数平滑数据(比如位场 potential fields)采用平均数,而对于比较粗略的,非高斯数据(比如地形数据)采用中值或众值。
个人分类: 学习札记|9 次阅读|0 个评论
[转载]GMT绘图使用相关技巧
vuchiyuan 2016-8-1 14:56
【1】Windows 下使用 GMT 的正确姿势 #GMT技巧 #Windows 出处: http://seisman.info/how-to-use-gmt-under-windows.html 我几乎是完全在 Linux 下工作的。有过几次在 Windows 下使用 GMT 的经历,个人觉得用户体验是非常糟糕的,Windows 自带的工具太简陋,用来画 GMT 图太繁琐,浪费好多时间。虽然未来我也几乎不会在 Windows 下写 bat 脚本,但还是想将自己的一些经验写下来,希望能够提高 Windows 下 GMT 的用户体验。 在正式开始本文之前,首先要认清几个基本的事实。如果你无法认同这几个事实,那么就没有再读下去的必要了: GMT 最初是在 Linux 下开发的 ** 纯命令行 ** 工具。在 Linux 下使用 GMT 要比在 Windows 下方便很多。所以,如果能在 Linux 下使用,就不要在 Windows 下使用; 大多数图都不可能用一个 GMT 命令就完成,因而需要将一系列 GMT 命令写到 bat 脚本中; 将 GMT 命令写入 bat 脚本的目的有两个:首先是记录 GMT 绘图的过程,其次才是批量绘图; 写 bat 脚本的过程,大部分时间和精力都是花在命令的调试和图形的微调上; 花半个小时时间折腾一下工具,就可以换取更好的用户体验以及更高的调试效率,这是一笔很划算的交易; 不用 cmd 点击 “开始”-“附件”-“命令提示符”(或者点击 “开始”,然后搜索 “cmd”),会出来一个如下图所示的命令提示符窗口,简称为 cmd。 Windows 下的 GMT 用户,尤其是 GMT 初学者,都会在 cmd 中敲一系列的 GMT 命令来画图。我想,用了几次就会体会到 cmd 的这些让人无法忍受的缺点: 默认的界面又黑又丑,几乎无法自定义; 默认字体完全不适合写脚本,难以区分 1 和 l 等,写脚本的时候容易被坑; 复制粘贴比较麻烦,似乎没有简单的办法完成复制操作,这使得将命令复制到脚本中变得很麻烦; 关闭 cmd 并重启后,前一次的命令历史都没了; 有一些与 cmd 类似的工具,比如 console、console 2、ColorConsole、ConEmu 等,可以完全替代 cmd,同时又有更好看的图形界面以及更丰富的自定义功能。 但是,不建议使用 cmd 以及这些类似的工具。 用 GMT 画图时,通常需要用多个命令绘制一张图,用 cmd 之类的工具写这些命令将会非常痛苦。因为一旦其中任意一个命令出现问题,或者想要微调其中某个命令的某个参数,则必须通过各种方式(一般是通过多次按上下方向键)将命令历史一一调出来并一一重新执行。这个过程非常繁琐、非常浪费时间,出错的概率也很高。 不要使用 cmd!!! 不要使用 cmd!!! 不要使用 cmd!!! (因为 cmd 太坑,所以重复三遍。) 用 GMT 画图的正确姿势是将绘图所需的 GMT 命令都写到 bat 脚本中,即便某个命令出错或者某个命令需要微调也不用怕了,只是重新执行一下 bat 脚本即可。 不要用 notepad 既然是写脚本,就一定要使用文本编辑器。Windows 自带的文本编辑器是 notepad,也就是常说的记事本,也就是下面这货: 因为实在无法忍受 notepad 那丑陋的默认字体,我把 notepad 的字体改成了等宽的 “Courier New”。 notepad 的缺点实在太多: 没有语法高亮 没有行号 没有智能补全 用 Ctrl+Z 只能撤销最近的一个操作历史 基本上你需要的功能它都没有。当然优点也是有的,比如 “它是系统自带编辑器” 以及“它是一款很简约(简陋?)的编辑器”。 不要用 notepad 写 bat 脚本。 它本来就不是一款用于写脚本或代码的编辑器。有很多功能强大的编辑器值得你去用。 使用 notepad++ 不用 notepad,还可以用什么? 优秀的文本编辑器实在太多。比如 notepad++、sublime text、EditPlus、vim、emacs 等等。除了 vim 和 emacs 学习曲线比较陡峭之外,其余的大多数文本编辑器都是很容易直接上手使用的。 为什么要使用 notepad++? 这里并不是要推荐 notepad++,其他的文本编辑器也可以实现类似的功能,或许可以实现的更好更方便,但我没有时间也没有心思去寻找最好的那一款(其实没有最好只有最适合)。 我只是想借着 notepad++ 来展示下一个合适的文本编辑器是如何提高写脚本 / 代码的效率的。针对本文的主题,也就是要解释一下,为什么一个好用的文本编辑器可以提高 GMT 绘图时的效率。 notepad++ 和 notepad 是什么关系? 这两个编辑器没有关系,只是恰好名字类似而已。 下载与安装 到官方网站下载: http://notepad-plus-plus.org/ 安装过程没什么可说的。启动之后的界面如下图,代码高亮、行号显示、自动补全默认都实现了: 对于 bat 脚本,右键,然后 “Edit with notepad++” 即可用 notepad++ 打开脚本。 基本的配置 “设置”-“首选项” 中提供了一些基本的配置,可以简单配置一下以符合自己的习惯。 “设置”-“语言格式设置” 中可以设置字体和字号,以及对各种不同语言做各种自定义。 安装插件 NppExec “插件”-“Plugin Manager”-“Show Plugin Manager”会打开插件管理器,在 “Available” 标签页中可以找到 notepad++ 的各种插件。 用 notepad++ 写完 bat 脚本之后,就需要执行 bat 脚本以检查命令的正确性以及绘图效果。 最原始也是最常用的做法是鼠标双击 bat 脚本,然后一个黑框一闪而过。。。此时即便命令执行时有输出错误信息,用户也看不到,所以就开始抱怨自己的脚本画不出来图,但是又不懂得提供出错信息。当然这个问题可以解决,在 bat 脚本的最后加上一句 pause,则黑框在脚本执行完毕时不会自动关闭,就可以看到输出信息了,只是又要面对那又黑又丑的 cmd,又要面对无法把报错信息复制到 google 里搜索的尴尬。 NppExec 插件可以解决这个问题。安装该插件后(安装过程中需要从 sourceforge 下载数据,有时候该网站会被墙,自己想办法解决),并重启,notepad++ 的界面如下: 直观地可以看到两个变化: 整个界面被分为上下两个区:文本编辑区和 console 区 工具栏上,在倒数第二的位置出现了一个终端的小图标 写完 GMT 脚本后,Ctrl+S 保存,然后键入 F6,就会出现 “Execute” 对话框如下图: 在其中输入 $(FULL_CURRENT_PATH) ,然后点击 OK,即可执行该 bat 脚本。 注意 : 在执行 bat 脚本的过程中,可能会出现生成的 PS 文件被放到 notepad++ 的安装文件夹下,或者因为权限问题 “拒绝访问” 的错误,解决办法是在 “插件”-“NppExec” 中勾选“Follow $(CURRENT_DIRECTORY)” 选项,并重启 notepad++ 使其生效。该选项的作用是使得在执行 bat 之前,先 cd 到 bat 所在的路径,再执行 bat 脚本中的命令。 执行后的效果如下: 在 console 中可以看到 bat 脚本中的每个命令的执行,当然,如果命令有错误,也会显示报错信息。这样,在编辑器里就既可以编辑 bat 脚本,也可以执行 bat 脚本,并可以根据终端的输出来判断命令是否有错误以及警告。 如果脚本有问题就需要修改,修改完成后保存,再次键入 F6,又会出现 “Execute” 对话框,$(FULL_CURRENT_PATH) 已经输入好了,再点击一次 “OK” 即可再次运行修改后的脚本。不过,按 F6 再点击 OK 还是有些麻烦:当脚本执行过一次之后,可以用快捷键 Ctrl+F6 重新运行脚本。 每次修改代码之后都要先保存再执行也挺麻烦的,最好能够在运行之前自动保存。在 “插件”-“NppExec” 中选中 “Save all files on execute” 即可实现每次运行之前自动保存代码。 对于终端,还可以做一些额外的设置,可以在 “插件”-“NppExec” 中进一步调整: “Change Console font” 来挑选一个合适的等宽字体和字号; 一些系统级别的信息对于我来说没有用,所以勾选 “No internal messages” Ctrl 键和 F6 键离得有些远,按起来还是不太方便:在 “Advanced options” 中,把 “ToolbarBtn” 改成“ExecPre”,则点击工具栏里倒数第二个终端小图标,就相对于执行了 Ctrl+F6,好方便; “Advanced options” 中还可以改 console 中文本的颜色,这个用默认值就好啦。 console 的输出信息,对于我们测试 bat 脚本是非常重要的,所以会要求输出信息尽量完整且精简。默认的输出不太满意,在 “Console Output Filters” 中做一些修改: 终端的输出信息中有太多空白行,浪费了宝贵的空间,想要把这些空白行都 ** 过滤 ** 掉,在 Filter 标签中修改如下图: 输出信息中每行都有很长的当前路径信息,影响了输出的阅读,而且该路径信息与具体的命令之间没有空格,就更容易混淆了。在 Replace 标签页中,将当前路径都 ** 替换 ** 成 GMT5 ,具体如下图: 需要注意一下, GMT5 的大于号后面有个空格,使得提示符与命令之间更容易区分。 输出信息中包含了命令、错误信息、警告信息以及输出,通常希望将错误、警告以及输出跟命令区分一下。这里的处理方式是,先在 “Advanced Options” 中将设置 console 的输出文本颜色为蓝色: 然后在 “Highlight” 选项卡中,将以 GMT5 开头的行设置为黑色: 这样设置之后,所有的命令都是黑色显示,所有的输出、错误、警告都用蓝色显示,当然也可以将错误、警告、输出定义不同的颜色,稍稍麻烦一些,这里就不做了。 经过这么一番配置之后,再次 Ctrl+F6 执行,效果如下: 这里在命令里加了个输出,并且故意把命令写错了,所以出现了蓝色的输出和报错信息,一眼就可以看到错误信息,看上去更直观。 注意 : 似乎该插件不会输出 GMT 命令中 -V 显示的信息,原因未知。 PS 查看器 上面已经把编辑器配置得可以方便地编辑、执行脚本,并可以根据输出信息来判断脚本的正误。有些时候脚本是对的,只是绘图的效果不够理想,此时需要不断微调脚本并实时预览 PS 文件。 gsview 是 GMT 官方推荐的 PS 查看器,它可以基本实现 PS 文件的实时预览。这里说 “基本实现”,因为在每次生成 PS 文件后,总是需要将焦点切换到 gsview 软件上,gsview 才会重新载入 PS 文件。不喜欢 gsview 的另一个原因是,gsview 是商业软件,需要注册才可以使用,未注册的软件在每次打开 PS 文件时都会弹出要求注册的对话框,很是烦人。 推荐使用 SumatraPDF ,一个非常精致小巧的阅读器,支持 PDF、PS、epub 等多种格式。 在我眼中,SumatraPDF 相对于 gsview 的优势在于: 免费软件,不会弹出讨厌的注册对话框 完全自动重载 PS 文件,实时预览 PS 文件,而不是像 gsview 一样需要将焦点切换到软件上才可重载 如果觉得 SumatraPDF 不错,可以将 PS 文件的默认打开方式设置为 SumatraPDF。 默认情况下,SumatraPDF 是不能打开含中文的 PS 文件的,这就需要设置环境变量 GS_FONTPATH 为 gs 指定字体的搜索路径。具体步骤是:“我的电脑”上右键点击 “属性”-“高级系统设置”- 在“高级”选项卡中点击 “环境变量(N)…”-“新建” 系统变量 -变量名为 GS_FONTPATH ,变量值为 C:\Windows\Fonts。如果设置后依然无法打开含中文的 PS 文件,可以考虑升级 gs 的版本,gs9.05 和 9.18 经测试都是可以的。 效果图 基于以上的一些配置,定制出来一套 Windows 下我觉得很友好也很高效的 GMT 绘图系统(右键查看大图): 屏幕左边是编辑器,右边是 PS 阅读器(预览区)。编辑器上边为编辑区,下边为终端区。 试想一下,在编辑区写脚本,写完了 Ctrl+S 保存,然后 Ctrl+F6 执行,眼睛移到终端区看看有没有错误和警告,有的话就修改脚本,重复以上动作,没有的话眼睛瞟一眼预览区,看看最终的绘图效果。整个过程都不需要动一下鼠标,比 cmd、notepad、gsview 之类可高效多了。 Tips Or Bugs 要使用 SumatraPDF 查看 PS 文件,必须先安装较新版本的 ghostscript; Notepad++ 默认将文件以 UTF-8 编码保存,因而若需要在 PS 文件中添加中文,则可能会导致乱码; 编辑 bat 文件时应注意 dos 里是没有续行符的,一条命令必须在一行写完。不像 Linux 下的 \ 、Fortran90 下的 和 matlab 下的 ... 续行; 修订历史 2014-12-10:初稿; 2015-01-13:加入了与 GMT 中文相关的几个注意事项; 2015-01-17:NppExec 插件应勾选 “Follow $(CURRENT_DIRECTORY)” 选项;Thanks to Joe Wang; 2015-01-21:SumatraPDF 查看 PS 文件时依赖于 ghostscript;Thanks to Michael Song; 2015-10-13:SumatraPDF 可以查看含中文的 PS 文件; ************************分割线*************************** 【2】 GMT地形数据总结 转载出处: http://www.cnblogs.com/mazhenyu/p/4218923.html 目前接触到的地形数据主要有三种:etopo、GTOPO30以及SRTM。按照精度从低到高排序如下: etopo5: GMT网格数据之etopo5 etopo2: GMT网格数据之ETOPO2v2 etopo1: GMT网格数据之ETOPO1 GTOPO30: GMT网格数据之GTOPO30 SRTM30_PLUS: 全球地形起伏数据:SRTM30_PLUS SRTM3: 高精度地形网格数据SRTM ASTER GDEM: 全球数字高程数据:ASTER GDEM 其中etopo数据包含了全球地形和海水深度数据;GTOPO30数据包含了全球地形数据; SRTM30_PLUS 精度:30弧秒,网格精度约 1 km,包括全球地形和海洋深度数据, 大部分区域使用SRTM30中的全球地形数据, 高纬度区域使用GTOPO30数据(无SRTM数据), 南纬81度到北纬81度的海底地形数据来自于Smith和Sandwell的全球1分数据等 ;SRTM3数据包含了全球大部分区域的地形数据。 ASTER GDEM 数据覆盖范围为北纬83°到南纬83°之间的所有陆地区域,达到了地球陆地表面的99%。 对于全球尺度或者大尺度地形图来说,可以使用etopo1数据; 对于3度*3度-10度*10度的区域,可以使用GTOPO30数据; 对于3度*3度以下的区域,可以使用SRTM3数据。 etopo5是全球地形及水深数据,其网格采样间隔为5弧分,目前已经被更高精度的etopo1所取代,但是在绘制大区域地形(比如全球)时,5弧分的精度也够用; etopo 2v2与ETOPO5类似,也是高程+海底地形数据,其采样间隔为2弧分; etopoO1包含了全球地形和海洋深度,采样间隔为1弧分,是目前精度最高的global relief数据; GTOPO30是USGS公布的全球数字高程模型,其采样间隔为30弧秒; SRTM,全称为Shuttle Radar Topography Mission,该项目获取了北纬60度至南纬60度之间的雷达影像数据,进一步处理制成了数字地形高程模型(DEM),即现在的SRTM地形产品数据。 ETOPO1: 其分为两个版本,Ice Surface和Bedrock,两个版本基本一致。不同之处在于在处理南极洲和Greenland地形时,前者给出的是加上冰盖层之后的高程,后者给出的是岩床的高程。 对于每个版本又细分为 grid-registered和cell-registered,其中grid-registered是权威版本,cell-registered是衍生版本,因而推荐下载使用grid-registered版本。 在每个子版本下又有多种数据格式, netCDF,binary, xyz,tiff。 我选择的是grid-registered版本的binary格式。 下载: http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/binary/etopo1_ice_g_i2.zip 解压得.bin为二进制网络文件,.hdr为头段文件 将.bin拷贝至/usr/local/GMT-4.5.9/share/dbase: sudo cp etopo1_ice_g_i2.bin /usr/local/GMT-4.5.9/share/dbase 修改grdraster.info: 9 ETOPO1 Ice Surface m -R-180/180/-90/90 -I1m GG i 1 0 -32768 etopo1_ice_g_i2.bin L 同理对于bedrock版本的网格数据,其grdraster.info为: 10 ETOPO1 Bedrock m -R-180/180/-90/90 -I1m GG i 1 0 -32768 etopo1_bed_g_i2.bin L 如果下载的是netCDF格式的网格文件,需要利用如下命令将数据转换为binary格式: grdreformat ETOPO1_Ice_g_gmt4.grd etopo1_ice_g_i2.bin=bs -N -V 画图测试: #!/bin/bash verbose=-V #verbose= grdraster 9 -Rg -I2m -Gout.grd $verbose makecpt -Cglobe -T-10500/8000/1000 -Z $verbose colors.cpt grdimage out.grd -Ba60g30 -Rg -Yc -Xc -JN0/25c -Ccolors.cpt -K $verbose etopo5.ps psscale -Ba2500f500::/:m: -Ccolors.cpt -D12.5c/-2c/15c/.35ch -O $verbose etopo5.ps rm out.grd colors.cpt GTOPO30 : 下载: ftp://edcftp.cr.usgs.gov/data/gtopo30/global/ 解压复制:将所有DEM文件拷贝至/share/dbase 修改grdraster.info: # GTOPO30 N90-N40 11 GTOPO30 W180N90 m -R-180/-140/40/90 -I0.5m PG i 1 0 -9999 W180N90.DEM B 12 GTOPO30 W140N90 m -R-140/-100/40/90 -I0.5m PG i 1 0 -9999 W140N90.DEM B 13 GTOPO30 W100N90 m -R-100/-60/40/90 -I0.5m PG i 1 0 -9999 W100N90.DEM B 14 GTOPO30 W060N90 m -R-60/-20/40/90 -I0.5m PG i 1 0 -9999 W060N90.DEM B 15 GTOPO30 W020N90 m -R-20/20/40/90 -I0.5m PG i 1 0 -9999 W020N90.DEM B 16 GTOPO30 E020N90 m -R20/60/40/90 -I0.5m PG i 1 0 -9999 E020N90.DEM B 17 GTOPO30 E060N90 m -R60/100/40/90 -I0.5m PG i 1 0 -9999 E060N90.DEM B 18 GTOPO30 E100N90 m -R100/140/40/90 -I0.5m PG i 1 0 -9999 E100N90.DEM B 19 GTOPO30 E140N90 m -R140/180/40/90 -I0.5m PG i 1 0 -9999 E140N90.DEM B # GTOPO30 N40-S10 20 GTOPO30 W180N40 m -R-180/-140/-10/40 -I0.5m PG i 1 0 -9999 W180N40.DEM B 21 GTOPO30 W140N40 m -R-140/-100/-10/40 -I0.5m PG i 1 0 -9999 W140N40.DEM B 22 GTOPO30 W100N40 m -R-100/-60/-10/40 -I0.5m PG i 1 0 -9999 W100N40.DEM B 23 GTOPO30 W060N40 m -R-60/-20/-10/40 -I0.5m PG i 1 0 -9999 W060N40.DEM B 24 GTOPO30 W020N40 m -R-20/20/-10/40 -I0.5m PG i 1 0 -9999 W020N40.DEM B 25 GTOPO30 E020N40 m -R20/60/-10/40 -I0.5m PG i 1 0 -9999 E020N40.DEM B 26 GTOPO30 E060N40 m -R60/100/-10/40 -I0.5m PG i 1 0 -9999 E060N40.DEM B 27 GTOPO30 E100N40 m -R100/140/-10/40 -I0.5m PG i 1 0 -9999 E100N40.DEM B 28 GTOPO30 E140N40 m -R140/180/-10/40 -I0.5m PG i 1 0 -9999 E140N40.DEM B # GTOPO30 S10-S60 29 GTOPO30 W180S10 m -R-180/-140/-60/-10 -I0.5m PG i 1 0 -9999 W180S10.DEM B 30 GTOPO30 W140S10 m -R-140/-100/-60/-10 -I0.5m PG i 1 0 -9999 W140S10.DEM B 31 GTOPO30 W100S10 m -R-100/-60/-60/-10 -I0.5m PG i 1 0 -9999 W100S10.DEM B 32 GTOPO30 W060S10 m -R-60/-20/-60/-10 -I0.5m PG i 1 0 -9999 W060S10.DEM B 33 GTOPO30 W020S10 m -R-20/20/-60/-10 -I0.5m PG i 1 0 -9999 W020S10.DEM B 34 GTOPO30 E020S10 m -R20/60/-60/-10 -I0.5m PG i 1 0 -9999 E020S10.DEM B 35 GTOPO30 E060S10 m -R60/100/-60/-10 -I0.5m PG i 1 0 -9999 E060S10.DEM B 36 GTOPO30 E100S10 m -R100/140/-60/-10 -I0.5m PG i 1 0 -9999 E100S10.DEM B 37 GTOPO30 E140S10 m -R140/180/-60/-10 -I0.5m PG i 1 0 -9999 E140S10.DEM B # GTOPO30 S60-S90 38 GTOPO30 W180S60 m -R-180/-120/-90/-60 -I0.5m PG i 1 0 -9999 W180S60.DEM B 39 GTOPO30 W120S60 m -R-120/-60/-90/-60 -I0.5m PG i 1 0 -9999 W120S60.DEM B 40 GTOPO30 W060S60 m -R-60/0/-90/-60 -I0.5m PG i 1 0 -9999 W060S60.DEM B 41 GTOPO30 W000S60 m -R0/60/-90/-60 -I0.5m PG i 1 0 -9999 W000S60.DEM B 42 GTOPO30 E060S60 m -R60/120/-90/-60 -I0.5m PG i 1 0 -9999 E060S60.DEM B 43 GTOPO30 E120S60 m -R120/180/-90/-60 -I0.5m PG i 1 0 -9999 E120S60.DEM B 说明 将全球分为33个区块,如下图所示,北纬90度到南纬60度分为3份,每份纬向50度,经向40度,共计3*9=27个区块;南极附近为南纬60度到90度,经向60度,计6个区块,共计33个区块。 采样间隔30弧秒,即0.008333333333333度,全球分为21600行、43200列。 坐标参考为WGS84; 其值为垂直方向高出海平面的距离,即海拔,单位为m; 海拔范围-407到8752,这里不包含海洋深度信息,负值应该是大陆架的海拔; 海洋处海拔标记为-9999,海岸线以为大陆海拔至少为1; 小于1平方千米的岛不考虑; 文件以该区块的左上角坐标为文件名; 文件后缀:DEM为数据高程模型;其他的文件都是一些辅助信息; 维度50度*经度40度文件大小:57600000 bytes 维度30度*经度60度文件大小:28800000 bytes 其他说明: 这些DEM文件为Pixel Registration格式 数据值存储为有符号16位整型 这些数据都是Big-endian的 绘图测试: #!/bin/bash ID=11 Range=-180/-140/40/90 B=a10g10 Inc=0.5m PS=${ID}.ps verbose=-V #verbose= grdraster $ID -R$Range -I$Inc -Gout.grd $verbose makecpt -Ctopo -T1/8000/1000 -Z $verbose colors.cpt grdimage out.grd -B$B -R$Range -Yc -Xc -JQ15c -Ccolors.cpt $verbose $PS rm out.grd colors.cpt 这里只绘制一个第一个区块的地形,若需要同时绘制多个区块,需要多次调用grdraster从不同的网格文件中提取网格,然后用grdpaste粘贴成一个网格再绘图。 南极区域 在南极区域还有一个特殊的高程数据ANTARCPS.DEM,其包含了S60-S90区域的六个区块的数据,但是是经过极坐标方位立体投影的。因而横坐标范围为(-2700,2700),纵坐标范围为(-2700,2700)。这个处理起来要麻烦一点。 SRTM: SRTM地形数据主要包含两类数据:SRTM3和SRTM1。 SRTM3精度为3弧秒,即90m一个点,包括非洲、北美、南美、欧亚、澳大利亚以及部分岛屿; SRTM1精度为1弧秒,即30m一个点,仅限美国地区; 所有的数据被分为1度*1度的单元,共计上万个数据文件。文件名代表了该单元左下角的位置;不同网站下载的数据文件名不同,但文件名类似N37W105的 数据文件,其单元左下角的坐标为(37N,105W);每个SRTM3数据文件包含了1201*1201个采样点;高程数据单位为m,参考水准面为 WGS84大地水准面模型;网格划分采用gridline registration方式,因而单元的南北边及左右边与相邻单元的边重合。 数据下载 : http://srtm.datamirror.csdb.cn/admin/datademMain.jsp 中国科学院计算机网络信息中心提供:Geotiff 和 ARC ASCII格式数据,数据是5度*5度一个单元,而不是标准的1度*1度,免去了用户自己做网格合并的麻烦;GMT可以处理ARC ASCII格式,但无法处理Geotiff格式,所以下面只用ARC ASCII格式;在中国区域,还提供一些衍生数据,如坡度、坡向、坡位,数据格式为img格式,细节未知; 数据转换: 将ARC ASCII格式转换为GMT grid文件: xyz2grd srtm_63_02.asc -Gstrm_63_02.grd -E -V 绘图实例: R=130/135/50/55 B=a1f0.5WSen J=Q4i xyz2grd srtm_63_02.asc -Gstrm_63_02.grd -E -V #xyz2grd N52E130.hgt -GN52E130.grd -I3c/3c -R$R -N-32768 -ZTLhw -V grd2cpt N52E130.grd -Cnrwc.cpt colors.cpt grdimage N52E130.grd -R$R -Ccolors.cpt -B$B:.SRTM3: -J$J -K test.ps 如果是USGS下载的标准数据,例子: 较大的昆仑山区域,下载的数据为N37E085.hgt和N37E086.hgt 2个文件。 #首先使用xyz2grd将二进制的hgt文件转成GMT使用的grd文件,或者nc后缀也可。 xyz2grd N37E085.hgt -Gg001.grd -I3c -R85/86/37/38 -N-32768 -ZTLhw xyz2grd N37E086.hgt -Gg002.grd -I3c -R86/87/37/38 -N-32768 -ZTLhw #合并grd文件 grdpaste g001.grd g002.grd -Ga1.grd makecpt -Cglobe -T-500/7000/500 -Z mydata.cpt grdgradient a1.grd -A30 -Gchina.grd.int -Ne0.8 -V -M #使用grdimage绘制彩图 grdimage a1.grd -R85/87/37/38 -Yc -Xc -JM10i -Cmydata.cpt -Ichina.grd.int -K world1.ps pscoast -R -J -Di -N1 -A1000 -B0.5g0.5/0.5g0.5 -W0.25p -O -K world1.ps psscale -Ba2500f500::/:m: -Cmydata.cpt -D12.5c/-2c/15c/.35ch -O -Uauthor:YangLei world1.ps del *.cpt *.int ASTER GDEM ASTER GDEM,即先进星载热发射和反射辐射仪全球数字高程模型,与SRTM一样为数字高程DEM,其全球空间分辨率为30米。该数据是根据 NASA的新一代对地观测卫星Terra的详尽观测结果制作完成的。其数据覆盖范围为北纬83°到南纬83°之间的所有陆地区域,达到了地球陆地表面的99%。(摘自百度百科)。号称是“迄今最完整的全球地形数据”。 ASTER GDEM:空间分辨率:1弧度秒 (约30 米),精度:垂直精度20米,水平精度30米,SRTM数据的纬度覆盖范围是 ,ASTER GDEM数据的纬度覆盖范围为 ;SRTM的空间分辨率一般为90m,只有美国境内存在空间分辨率为30m的数据;ASTER GDEM的空间分辨率为30m; 网站:http://gdem.ersdac.jspacesystems.or.jp/ 网站需要注册,即可免费下载数据; 点击“Search”即可进入数据选择界面; 数据被划分为1度*1度的区块,每个区块文件名以区块左下角的经纬度值来命名; 数据选择界面有四种方式用来选择区块,界面的设计不太习惯,注意看英文; 数据可以单独下载,也可以批量下载;批量下载貌似需要处理一段时间; 下载的文件为zip压缩文件,包含了两个文件:dem和num,二者均为GeoTiff格式; dem数据即为数字高程数据; num数据也称为QA文件,即质量评估文件,其包含了每一点的高程数据的来源等信息,一般用不到; 使用GDAL提供的工具将其转换为GMT可识别的netCDF格式: gdal_translate -of GMT ASTGTM2_N36E111_dem.tif ASTGTM2_N36E111_dem.grd ************************分割线*************************** 【3】GMT中gmt.conf中的几个重要参数 出处: http://blog.163.com/p_gmt/blog/static/243063053201411251100149/ 1、MAP_TICK_LENGTH_PRIMARY 控制标记线的长短。 默认MAP_TICK_LENGTH_PRIMARY= 5p/2.5p 5p代表长标记线的长短,2.5代表短标记线的长短。 设置成MAP_TICK_LENGTH_PRIMARY = 0p/0p 后 2、MAP_FRAME_TYPE= fancy 控制坐标轴的形式。(fancy 、paint 、inside三种选项) fancy形式。 paint形式 ************************分割线*************************** 【4】GMT 绘制图中图 出处: http://seisman.info/gmt-insert-map.html 英文一般称为 inset map 或 insert map,中文还不确定有没有专门的名词,一般常称为图中图、小图、嵌入图。 所谓 insert map,即在绘制小区域地图时,在图上的某个角落里绘制一张更大范围的地图,并在大范围地图上绘制一个方框,以更清楚地表明小区域的地理位置。 若是了解 GMT 中图层的概念以及图层叠加的原理,就可以很容易地把 insert map 画出来。由于 GMT4 和 GMT5 语法上的差异,这里同时给出 GMT4 和 GMT5 两个版本的绘图脚本。二者原理是差不多的,只是语法上有些差异,因而下面只解释 GMT5 脚本中的细节,对 GMT4 脚本不做过多介绍。 效果图 GMT5 脚本 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #!/bin/bash R=115/123/35/40 # 小区域地图的范围 - R J=M20c # 小区域的投影方式 - J PS=map.ps # 打开 GMT gmt psxy -R $R -J $J -T -K $PS # 绘制小区域的地图 gmt pscoast -R $R -J $J -B1 -Df -W2p -I2p -N1/2p -A1000 -K -O $PS # ... # 此处可以任意添加其他绘图命令 # ... # 开始绘制 insert map Rg=72/135/16/55 # 大区域地图的范围 - R Jg=M7c # 大区域地图的投影方式 - J # 绘制大区域地图的海岸线及边框 gmt pscoast -R $Rg -J $Jg -B0 -B+gwhite -Df -N1 -W -A5000 -K -O --MAP_FRAME_TYPE=plain $PS # 利用 psbasemap 在大区域地图内绘制小区域所在的方框 gmt psbasemap -R $Rg -J $Jg -D $R +p2p,blue -K -O $PS # 结束 GMT 绘图 gmt psxy -R $R -J $J -T -O $PS 整个脚本的思路已经在脚本注释中做了解释。本质上就是先绘制小区域地图而不去管 insert map,待小区域地图绘制完成后,再单独绘制一个 insert map。 绘制 insert map 时,使用了两个命令:pscoast 和 psbasemap。其中,pscoast 的作用是绘制大区域地图的边框以及海岸线,psbasemap 用于在大区域地图内绘制一个矩形区域,当然也可以用 psxy 命令代替。 在使用 pscoast 命令绘制大区域地图时,有几个需要解释的地方: -B0 使得大区域地图的边框不显示刻度; 默认情况下,边框内部是透明的,此时会在 insert map 内看到下一图层里的一些元素,-B+gwhite 使得边框内填充白色; --MAP_FRAME_TYPE=plain 设置边框类型为一般的直线,默认值是 fancy 即火车轨道边框; 可以设置 MAP_FRAME_PEN 以修改边框的粗细; pscoast 命令中可以使用 - X 和 - Y 选项以调整 insert map 在图中的位置; GMT4 脚本 GMT4 脚本相对于 GMT5 脚本的主要区别在于:GMT5 中任意命令都可以通过 -B+gwhite 的语法指定边框内填充白色,而 GMT4 中只有 psbasemap 命令可以通过 -Gwhite 选项来实现填充白色。因而 GMT4 的脚本中,需要先使用 psbasemap 绘制一个白色填充的边框,再使用 pscoast 绘制海岸线。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #!/bin/bash xmin=115 xmax=123 ymin=35 ymax=40 R= $xmin / $xmax / $ymin / $ymax J=M20c PS=map.ps psxy -R $R -J $J -T -K $PS pscoast -R $R -J $J -B1 -Df -W2p -I2p -N1/2p -A1000 -K -O $PS Rg=72/135/16/55 Jg=M7c psbasemap -R $Rg -J $Jg -B0 -Gwhite -K -O --BASEMAP_TYPE=plain $PS pscoast -R $Rg -J $Jg -Df -N1 -W -A5000 -K -O $PS psxy -R $Rg -J $Jg -W2p,blue -K -O -L $PS EOF $xmin $ymin $xmin $ymax $xmax $ymax $xmax $ymin EOF psxy -R $R -J $J -T -O $PS 修订历史 2015-08-16:初稿 2015-11-02:GMT5 脚本使用 psbasemap 的 -D 选项以简化代码 ************************分割线*************************** 【5】用GMT绘制全球海岸线图 出处: http://blog.163.com/jey_df/blog/static/182550161201211288190432/ 在pscoast的帮助页面,我们可以看到这样的一个例子: To plot a green Africa with white outline on blue background, with permanent major rivers in thick blue pen, additional major rivers in thin blue pen, and national borders as dashed lines on a Mercator map at scale 0.1 inch/degree. (要求:在一个蓝色背景下,以白色轮廓线绘制绿色非洲海岸线图,对于永久不变的主要的河流用蓝色加粗绘出,其他主要河流以一般蓝色绘出,国界以短虚线给出,绘制麦卡托地图,尺寸为0.1inch/degree.) 通过命令: pscoast -R-30/60/-40/40 -Jm0.065i -B5 -I1/1p,blue -I2/0.25p,blue -N1/0.25p,- -W0.25p,white -Ggreen -Sblue -P africa.ps 我们可以得到: 下面详细介绍这个命令相关: pscoast 主要用于绘制地理底图, -R-30/60/-40/40 表示在经度为(-30,60),纬度为(-40,40)这个区域范围作图; -Jm0.065i -J 代表选择投影方式。-Jm/M表示 墨卡托投影(Mercator Projection), Mercator投影的 特点为:圆柱形的、保角、在赤道上没有畸变,其缺点在于靠近极点的区域畸变非常大 。例如,使用该投影,格陵兰岛要比南美大,但实际上南美是格陵兰岛 的八倍。 -Jm后面接的数字代表每度的长度 -JM后面接的数子代表整张图的宽 -Jx(-JX)线性投影(Linear Projection)一般绘图用 -Jx后面接的数字代表每单位的长度(预设长度单位为英寸,加c的话就变成公分) -JX后面接的数字代表轴的全长 如果要针对X轴或者Y轴做不同的设定,就再数字间加斜线 /。 -B5 设定边界尺标的间隔。 a 文字注释的间隔 f 边框标记的间隔 g 隔线的间隔 如果要针对X轴或Y轴做不同的设定,就在参数间加斜线 / NEWS(大写) 每个轴都加标记(NEWS表示北东西南四个方向,如果该方向大写则表示该方向有标记) news(小写)每个轴都不加标记 :.title:在图上面加title这个标题 :title:在轴上加title这个标题(只有在-Jx的情况下有用) 例如:-BNEWSf2a3g2:xx:/f3a3g2:yy::.title: -I1/1p,blue -I2/0.25p,blue ,-I主要绘制河流的边界, -Iriver_type , river_type如下(如果想绘制多种类型的河流,重复-I命令) 【 Default pen: width = 0.25p, color = black, texture = solid】 地方 -N1/0.25p, - -N主要用于绘制政治边界, -Nborder_type 常用的政治边界有四类,如下: 1 = National boundaries 2 = State boundaries within the Americas 3 = Marine boundaries a = All boundaries (1-3) -W0.25p,white ,-W绘制海岸线 -W pen 【 Default is no shorelines]. Append pen attributes Defaults: width = 0.25p, color = black, texture = solid 】,其中level分为四种, 1-4分别代表海岸线,湖岸线,湖中岛岸线(island-in-lake shore),湖岛湖岸线(lake-in-island-in-lake shore)。 -Ggreen -G 设定dry areas的填充属性,-Sc用于剪切区域 ; -Sblue -S 设定wet areas的填充属性,-Sc用于剪切区域 -P 选择绘制肖像模式(默认为横向) 至此,此命令的详细解释完毕! 通过命令 pscoast -R-180/180/-60/75 -JM6i -B60 -I1/1p,blue -I2/0.25p,blue -N1/0.25p,- -W0.25p,white -Ggreen -Sblue -P global.ps 我们可以得到全球的 Mercator投影,其结果在两极非常的失真,这里仅分析维度为(-60,75)范围。 However,绘制全球地图也许用线性投影,看起来更和谐一些,通过以下命令: pscoast -R-180/180/-90/90 -Jx0.04d -B60 -Y10 -I1/1p,blue -I2/0.25p,blue -N1/0.25p,- -W0.25p,white -Ggreen -Sblue -P newglobal.ps pscoast -R64/138/10/54 -Jm0.065i -B10 -K -Dh -A300 -I1/1p -I2/0.25p -W0.1p -N1/0.5p -Ggrey -Sblue cn.ps ************************分割线*************************** 【6】将ps文件转为图片格式(jpg tif...) 出处: http://blog.sina.com.cn/s/blog_8fc890a20102vm2a.html 使用GMT出图以后,一般都是 .ps 格式的图片,如何将其转换为任意分辨率的图片呢? 我先前使用 Adobe illustrator 和 photoshop打开,发现有时候图片严重丢失、改变、失真等。后来才发现原来有GMT自带的命令可以转换。方法如下: ( 事先特别提醒,非常重要!gmt画图时,-K表示开始,-K -O表示正在继续往图上添加东西,而 -O表式这是最后一笔,不再往上画了。所以,在使用gmt ps2raster时,务必使它的上一句话是 -O的,而不是 -K -O的,否则无法生成图片。 ) gmt ps2raster ex1 .ps -E300 -Tt 其中,ex1.ps 是需要转换的ps文件;-E后面跟的是要转成图片的dpi,即分辨率;-T后面跟的是转换成图片的格式,我这里用的t,就是tiff。可参考下面的解释: where b means BMP, e means EPS, E means EPS with PageSize command, f means PDF, F means multi-page PDF, j means JPEG, g means PNG, G means transparent PNG (untouched regions are transparent), m means PPM, and t means TIFF 需要关注的参数为-A、-E、-T和-P: •psfiles:要进行转换的ps文件 •-A:一般ps文件的尺寸为一张A4纸的大小(PAPER_MEDIA),很多时候绘图只占用了纸张的一小部分。这个选项可以重新定义BoudingBox,将空白的部分去除。-Au可以额外去除GMT的时间戳(-U)。(觉得这个选项去空白去得有点过了,图像周围基本一点空白都没有) •-E:设置位图的精度。默认pdf格式dpi=720,其他格式dpi=300。pdf格式是矢量格式,但是其中的图案填充以及字体是以位图的格式存储的,-E选项对这部分是有效的。 •-T:指定输出格式,默认为jpeg格式。b指bmp,e代表eps,f代表pdf,j代表jpeg,g代表png,G代表透明的png,m代表ppm,t代表tiff。对于bgjt后可加-以产生灰度图。EPS是格式转换过程的中间文件,因而可以和其他格式同时生成,比如可以使用-Tef同时产生pdf和eps文件。 •-P:Portrait mode。 按照惯例,ps2raster还有很多选项,具体请移步到GMT官方网站查看。 ************************分割线*************************** to be continued...
个人分类: GMT|10836 次阅读|0 个评论
plt_cns_lab_dep
shenxzh 2016-6-2 21:01
中国大陆地壳岩石圈厚度绘图脚本 plt_cns_lab_dep gmtset BASEMAP_TYPE fancy gmtset FRAME_PEN 1.25p gmtset FRAME_WIDTH 0.12c gmtset HEADER_FONT 5 gmtset LABEL_FONT 5 gmtset HEADER_FONT_SIZE 12p gmtset LABEL_FONT_SIZE 5p gmtset ANNOT_FONT_SIZE_PRIMARY=10p rem set projection=-JD102.5/34/36/41/14in set projection=-JM104/35/14 rem -JM102.500000/30.000000/6.01=-JM102.500000/0.000000/25.0 set region=-R68/140/15/55 set ps_filename=CNS_LAB_DEP_Sel1.ps set dat_fil=CN_LAB_Dep_Sel.dat set title=CNS Moho of China rem makecpt -Cred2blue -T25/80/2 -I moho.cpt makecpt -Crainbow -T50/200/1 -I lab.cpt makecpt -Cgraynew -T-10000/8000/50 -I topo.cpt grdimage D:\Seis_soft\Fault_Topo\chinatopo.grd -ID:\Seis_soft\Fault_Topo\chinatopo_gra.grd %region% %projection% -Ctopo.cpt -P -K -X1.3i -Y4i -Ei %ps_filename% gawk {print $1,$2,$3} %dat_fil% |surface %region% -Gchinan.grd -I0.1 -T0.1 gawk {print $1,$2,$3} %dat_fil% |psmask %region% %projection% -I0.1 -S0.5d -O -K -V %ps_filename% rem grdsample /run/media/xuzhang/Data/Seis_soft/Fault_Topo/chinatopo.grd -Gnew.grd -I0.2/0.2 %region% -T rem grdimage chinan.grd %region% %projection% -Cmoho.cpt -Inew.grd -O -K -V %ps_filename% grdimage chinan.grd %region% %projection% -Clab.cpt -t80 -O -K -V %ps_filename% psmask -C -O -K %ps_filename% rem gawk {print $3,$2,$4*$4/200} cns_eq_1973_2015.txt | psxy %region% %projection% -Sc -G255/255/255 -W0.05p -O -K %ps_filename% pscoast %region% %projection% -A300 -O -K -Dh -N1/0.10/000/000/000 -W0.01p %ps_filename% psxy D:\Seis_soft\Fault_Topo\China_Block\BLOCK2.gmt -V %region% %projection% -O -K -W1,250/250/250,solid %ps_filename% rem psxy block22.dat -V -M %region% %projection% -O -K -W5/250/250/250 %ps_filename% gawk {print $1,$2,$3} %dat_fil% |psxy -V %region% %projection% -O -K -Sx0.1c -W0.05p %ps_filename% psbasemap %region% -V %projection% -Ba10f5.000/a10f5.000:.LAB Depth of China mainland:NSWE -O -K %ps_filename% gmtset ANNOT_FONT_SIZE_PRIMARY=6p psscale -D5.9i/2.2i/2i/0.075i -Clab.cpt -B20f10/:(km): -t80 -O %ps_filename psconvert -A -P -Tf %ps_filename% pause plt_cns_lab_dep.sh #!/bin/bash gmtset FRAME_PEN 1.0p gmtset FRAME_WIDTH 0.02c gmtset HEADER_FONT 5 gmtset LABEL_FONT 5 gmtset HEADER_FONT_SIZE 10 gmtset LABEL_FONT_SIZE 12 gmtset ANOT_FONT_SIZE 10 projection=-JD102.5/34/36/41/15in # -JM102.500000/30.000000/6.01=-JM102.500000/0.000000/25.0 region=-R68/140/15/55 ps_filename=CNS_LAB_DEP_Sel.ps dat_fil=CN_LAB_Dep_Sel.dat title=CNS Moho of China # makecpt -Cred2blue -T25/80/2 -I moho.cpt makecpt -Crainbow -T50/200/1 -I lab.cpt makecpt -Cgraynew -T-10000/8000/50 topo.cpt grdimage /run/media/xuzhang/Data/Seis_soft/Fault_Topo/chinatopo.grd -I/run/media/xuzhang/Data/Seis_soft/Fault_Topo/chinatopo_gra.grd $region $projection -Ctopo.cpt -P -K -X1i -Y4i -Ei $ps_filename gawk '{print $1,$2,$3}' $dat_fil |surface $region -Gchinan.grd -I0.2 -T0.2 gawk '{print $1,$2,$3}' $dat_fil |psmask $region $projection -I0.2 -S2.5 -O -K -V $ps_filename # grdgradient chnn.grd -Ne0.6 -A45 -Gchina_moho2.grd #grdsample /run/media/xuzhang/Data/Seis_soft/Fault_Topo/chinatopo.grd -Gnew.grd -I0.2/0.2 $region -T #grdimage chinan.grd $region $projection -Cmoho.cpt -Inew.grd -O -K -V $ps_filename grdimage chinan.grd $region $projection -Clab.cpt -O -K -V $ps_filename psmask -C -O -K $ps_filename # gawk {print $3,$2,$4*$4/200} cns_eq_1973_2015.txt | psxy $region $projection -Sc -G255/255/255 -W0.05p -O -K $ps_filename pscoast $region $projection -A300 -O -K -Dh -N1/0.10/000/000/000 -W0.01p $ps_filename psxy /run/media/xuzhang/Data/Seis_soft/Fault_Topo/China_Block/BLOCK2.gmt -V -M $region $projection -O -K -W5/150/150/150 $ps_filename # psxy block22.dat -V -M $region $projection -O -K -W5/250/250/250 $ps_filename gawk '{print $1,$2,$3}' $dat_fil |psxy -V -M $region $projection -O -K -Sx0.1c -W0.05p $ps_filename psbasemap $region -V $projection -Ba10f5.000/a10f5.000:.Moho Depth of China mainland:NsWe -O -K $ps_filename psscale -D6i/2.2i/2.5i/0.15i -Clab.cpt -B50f25/:: -O -K $ps_filename
个人分类: Shell scripts|4 次阅读|0 个评论
UTC: Coordinated Universal Time 协调世界时
haibaraxx 2016-5-13 16:25
See originals: http://www.ntp.org/ntpfaq/NTP-s-time.htm http://weather.msfc.nasa.gov/utc.html Cooridinated Universal Time, abbreviated as UTC, is an international official time standard . Weather observations around the world (including surface, radar and other observations) are always taken with respect to UTC. Prior to 1972, the world's time standard was called Greenwich Mean Time (GMT, 格林尼治平均/标准时间). It was used to set the clocks on ships before they left for a long journey. GMT is based on the mean solar time (平太阳日) which varies a lot by itself. Therefore, it is replaced by UTC, based on a quantum resonance (量子共振) of a cesium (铯) atom, being quite more accurate. Zero (0) hours UTC is midnight in Greenwich England, which lies on the prime meridian (0° longitude). To convert UTC to local time, one would have to add or subtract the local time zone. China: UTC+8; Germany: UTC+2. UTC is based on a 24-hour clock, therefore, afternoon hours such as 4 pm UTC are expressed as 16:00 UTC (sixteen hours, zero minutes). U - Universal means that the time can be used everywhere in the world, meaning that it is independent from time zones (i.e. it is not local time). C - Coordinated means the several institutions contribute their estimate of the current time, and UTC is built by conbining these estimates. Standard_World_Time_Zones.png worldtime.gif
个人分类: Ocean optics|3682 次阅读|0 个评论
GMT地形数据
YF2015 2016-5-2 14:56
目前接触到的地形数据主要有三种:etopo、GTOPO30以及SRTM。按照精度从低到高排序如下: etopo5: GMT网格数据之etopo5 etopo2: GMT网格数据之ETOPO2v2 etopo1: GMT网格数据之ETOPO1 GTOPO30: GMT网格数据之GTOPO30 SRTM30_PLUS: 全球地形起伏数据:SRTM30_PLUS SRTM3: 高精度地形网格数据SRTM ASTER GDEM: 全球数字高程数据:ASTER GDEM 其中etopo数据包含了全球地形和海水深度数据;GTOPO30数据包含了全球地形数据; SRTM30_PLUS 精度:30弧秒,网格精度约 1 km,包括全球地形和海洋深度数据, 大部分区域使用SRTM30中的全球地形数据, 高纬度区域使用GTOPO30数据(无SRTM数据), 南纬81度到北纬81度的海底地形数据来自于Smith和Sandwell的全球1分数据等 ;SRTM3数据包含了全球大部分区域的地形数据。 ASTER GDEM 数据覆盖范围为北纬83°到南纬83°之间的所有陆地区域,达到了地球陆地表面的99%。 对于全球尺度或者大尺度地形图来说,可以使用etopo1数据; 对于3度*3度-10度*10度的区域,可以使用GTOPO30数据; 对于3度*3度以下的区域,可以使用SRTM3数据。 etopo5是全球地形及水深数据,其网格采样间隔为5弧分,目前已经被更高精度的etopo1所取代,但是在绘制大区域地形(比如全球)时,5弧分的精度也够用; etopo 2v2与ETOPO5类似,也是高程+海底地形数据,其采样间隔为2弧分; etopoO1包含了全球地形和海洋深度,采样间隔为1弧分,是目前精度最高的global relief数据; GTOPO30是USGS公布的全球数字高程模型,其采样间隔为30弧秒; SRTM,全称为Shuttle Radar Topography Mission,该项目获取了北纬60度至南纬60度之间的雷达影像数据,进一步处理制成了数字地形高程模型(DEM),即现在的SRTM地形产品数据。 ETOPO1: 其分为两个版本,Ice Surface和Bedrock,两个版本基本一致。不同之处在于在处理南极洲和Greenland地形时,前者给出的是加上冰盖层之后的高程,后者给出的是岩床的高程。 对于每个版本又细分为 grid-registered和cell-registered,其中grid-registered是权威版本,cell-registered是衍生版本,因而推荐下载使用grid-registered版本。 在每个子版本下又有多种数据格式, netCDF,binary, xyz,tiff。 我选择的是grid-registered版本的binary格式。 下载: http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/binary/etopo1_ice_g_i2.zip 解压得.bin为二进制网络文件,.hdr为头段文件 将.bin拷贝至/usr/local/GMT-4.5.9/share/dbase: sudo cp etopo1_ice_g_i2.bin /usr/local/GMT-4.5.9/share/dbase 修改grdraster.info: 9 ETOPO1 Ice Surface m -R-180/180/-90/90 -I1m GG i 1 0 -32768 etopo1_ice_g_i2.bin L 同理对于bedrock版本的网格数据,其grdraster.info为: 10 ETOPO1 Bedrock m -R-180/180/-90/90 -I1m GG i 1 0 -32768 etopo1_bed_g_i2.bin L 如果下载的是netCDF格式的网格文件,需要利用如下命令将数据转换为binary格式: grdreformat ETOPO1_Ice_g_gmt4.grd etopo1_ice_g_i2.bin=bs -N -V 画图测试: #!/bin/bash verbose=-V #verbose= grdraster 9 -Rg -I2m -Gout.grd $verbose makecpt -Cglobe -T-10500/8000/1000 -Z $verbose colors.cpt grdimage out.grd -Ba60g30 -Rg -Yc -Xc -JN0/25c -Ccolors.cpt -K $verbose etopo5.ps psscale -Ba2500f500::/:m: -Ccolors.cpt -D12.5c/-2c/15c/.35ch -O $verbose etopo5.ps rm out.grd colors.cpt GTOPO30 : 下载: ftp://edcftp.cr.usgs.gov/data/gtopo30/global/ 解压复制:将所有DEM文件拷贝至/share/dbase 修改grdraster.info: # GTOPO30 N90-N40 11 GTOPO30 W180N90 m -R-180/-140/40/90 -I0.5m PG i 1 0 -9999 W180N90.DEM B 12 GTOPO30 W140N90 m -R-140/-100/40/90 -I0.5m PG i 1 0 -9999 W140N90.DEM B 13 GTOPO30 W100N90 m -R-100/-60/40/90 -I0.5m PG i 1 0 -9999 W100N90.DEM B 14 GTOPO30 W060N90 m -R-60/-20/40/90 -I0.5m PG i 1 0 -9999 W060N90.DEM B 15 GTOPO30 W020N90 m -R-20/20/40/90 -I0.5m PG i 1 0 -9999 W020N90.DEM B 16 GTOPO30 E020N90 m -R20/60/40/90 -I0.5m PG i 1 0 -9999 E020N90.DEM B 17 GTOPO30 E060N90 m -R60/100/40/90 -I0.5m PG i 1 0 -9999 E060N90.DEM B 18 GTOPO30 E100N90 m -R100/140/40/90 -I0.5m PG i 1 0 -9999 E100N90.DEM B 19 GTOPO30 E140N90 m -R140/180/40/90 -I0.5m PG i 1 0 -9999 E140N90.DEM B # GTOPO30 N40-S10 20 GTOPO30 W180N40 m -R-180/-140/-10/40 -I0.5m PG i 1 0 -9999 W180N40.DEM B 21 GTOPO30 W140N40 m -R-140/-100/-10/40 -I0.5m PG i 1 0 -9999 W140N40.DEM B 22 GTOPO30 W100N40 m -R-100/-60/-10/40 -I0.5m PG i 1 0 -9999 W100N40.DEM B 23 GTOPO30 W060N40 m -R-60/-20/-10/40 -I0.5m PG i 1 0 -9999 W060N40.DEM B 24 GTOPO30 W020N40 m -R-20/20/-10/40 -I0.5m PG i 1 0 -9999 W020N40.DEM B 25 GTOPO30 E020N40 m -R20/60/-10/40 -I0.5m PG i 1 0 -9999 E020N40.DEM B 26 GTOPO30 E060N40 m -R60/100/-10/40 -I0.5m PG i 1 0 -9999 E060N40.DEM B 27 GTOPO30 E100N40 m -R100/140/-10/40 -I0.5m PG i 1 0 -9999 E100N40.DEM B 28 GTOPO30 E140N40 m -R140/180/-10/40 -I0.5m PG i 1 0 -9999 E140N40.DEM B # GTOPO30 S10-S60 29 GTOPO30 W180S10 m -R-180/-140/-60/-10 -I0.5m PG i 1 0 -9999 W180S10.DEM B 30 GTOPO30 W140S10 m -R-140/-100/-60/-10 -I0.5m PG i 1 0 -9999 W140S10.DEM B 31 GTOPO30 W100S10 m -R-100/-60/-60/-10 -I0.5m PG i 1 0 -9999 W100S10.DEM B 32 GTOPO30 W060S10 m -R-60/-20/-60/-10 -I0.5m PG i 1 0 -9999 W060S10.DEM B 33 GTOPO30 W020S10 m -R-20/20/-60/-10 -I0.5m PG i 1 0 -9999 W020S10.DEM B 34 GTOPO30 E020S10 m -R20/60/-60/-10 -I0.5m PG i 1 0 -9999 E020S10.DEM B 35 GTOPO30 E060S10 m -R60/100/-60/-10 -I0.5m PG i 1 0 -9999 E060S10.DEM B 36 GTOPO30 E100S10 m -R100/140/-60/-10 -I0.5m PG i 1 0 -9999 E100S10.DEM B 37 GTOPO30 E140S10 m -R140/180/-60/-10 -I0.5m PG i 1 0 -9999 E140S10.DEM B # GTOPO30 S60-S90 38 GTOPO30 W180S60 m -R-180/-120/-90/-60 -I0.5m PG i 1 0 -9999 W180S60.DEM B 39 GTOPO30 W120S60 m -R-120/-60/-90/-60 -I0.5m PG i 1 0 -9999 W120S60.DEM B 40 GTOPO30 W060S60 m -R-60/0/-90/-60 -I0.5m PG i 1 0 -9999 W060S60.DEM B 41 GTOPO30 W000S60 m -R0/60/-90/-60 -I0.5m PG i 1 0 -9999 W000S60.DEM B 42 GTOPO30 E060S60 m -R60/120/-90/-60 -I0.5m PG i 1 0 -9999 E060S60.DEM B 43 GTOPO30 E120S60 m -R120/180/-90/-60 -I0.5m PG i 1 0 -9999 E120S60.DEM B 说明 将全球分为33个区块,如下图所示,北纬90度到南纬60度分为3份,每份纬向50度,经向40度,共计3*9=27个区块;南极附近为南纬60度到90度,经向60度,计6个区块,共计33个区块。 采样间隔30弧秒,即0.008333333333333度,全球分为21600行、43200列。 坐标参考为WGS84; 其值为垂直方向高出海平面的距离,即海拔,单位为m; 海拔范围-407到8752,这里不包含海洋深度信息,负值应该是大陆架的海拔; 海洋处海拔标记为-9999,海岸线以为大陆海拔至少为1; 小于1平方千米的岛不考虑; 文件以该区块的左上角坐标为文件名; 文件后缀:DEM为数据高程模型;其他的文件都是一些辅助信息; 维度50度*经度40度文件大小:57600000 bytes 维度30度*经度60度文件大小:28800000 bytes 其他说明: 这些DEM文件为Pixel Registration格式 数据值存储为有符号16位整型 这些数据都是Big-endian的 绘图测试: #!/bin/bash ID=11 Range=-180/-140/40/90 B=a10g10 Inc=0.5m PS=${ID}.ps verbose=-V #verbose= grdraster $ID -R$Range -I$Inc -Gout.grd $verbose makecpt -Ctopo -T1/8000/1000 -Z $verbose colors.cpt grdimage out.grd -B$B -R$Range -Yc -Xc -JQ15c -Ccolors.cpt $verbose $PS rm out.grd colors.cpt 这里只绘制一个第一个区块的地形,若需要同时绘制多个区块,需要多次调用grdraster从不同的网格文件中提取网格,然后用grdpaste粘贴成一个网格再绘图。 南极区域 在南极区域还有一个特殊的高程数据ANTARCPS.DEM,其包含了S60-S90区域的六个区块的数据,但是是经过极坐标方位立体投影的。因而横坐标范围为(-2700,2700),纵坐标范围为(-2700,2700)。这个处理起来要麻烦一点。 SRTM: SRTM地形数据主要包含两类数据:SRTM3和SRTM1。 SRTM3精度为3弧秒,即90m一个点,包括非洲、北美、南美、欧亚、澳大利亚以及部分岛屿; SRTM1精度为1弧秒,即30m一个点,仅限美国地区; 所有的数据被分为1度*1度的单元,共计上万个数据文件。文件名代表了该单元左下角的位置;不同网站下载的数据文件名不同,但文件名类似N37W105的 数据文件,其单元左下角的坐标为(37N,105W);每个SRTM3数据文件包含了1201*1201个采样点;高程数据单位为m,参考水准面为 WGS84大地水准面模型;网格划分采用gridline registration方式,因而单元的南北边及左右边与相邻单元的边重合。 数据下载 : http://srtm.datamirror.csdb.cn/admin/datademMain.jsp 中国科学院计算机网络信息中心提供:Geotiff 和 ARC ASCII格式数据,数据是5度*5度一个单元,而不是标准的1度*1度,免去了用户自己做网格合并的麻烦;GMT可以处理ARC ASCII格式,但无法处理Geotiff格式,所以下面只用ARC ASCII格式;在中国区域,还提供一些衍生数据,如坡度、坡向、坡位,数据格式为img格式,细节未知; 数据转换: 将ARC ASCII格式转换为GMT grid文件: xyz2grd srtm_63_02.asc -Gstrm_63_02.grd -E -V 绘图实例: R=130/135/50/55 B=a1f0.5WSen J=Q4i xyz2grd srtm_63_02.asc -Gstrm_63_02.grd -E -V #xyz2grd N52E130.hgt -GN52E130.grd -I3c/3c -R$R -N-32768 -ZTLhw -V grd2cpt N52E130.grd -Cnrwc.cpt colors.cpt grdimage N52E130.grd -R$R -Ccolors.cpt -B$B:.SRTM3: -J$J -K test.ps 如果是USGS下载的标准数据,例子: 较大的昆仑山区域,下载的数据为N37E085.hgt和N37E086.hgt 2个文件。 #首先使用xyz2grd将二进制的hgt文件转成GMT使用的grd文件,或者nc后缀也可。 xyz2grd N37E085.hgt -Gg001.grd -I3c -R85/86/37/38 -N-32768 -ZTLhw xyz2grd N37E086.hgt -Gg002.grd -I3c -R86/87/37/38 -N-32768 -ZTLhw #合并grd文件 grdpaste g001.grd g002.grd -Ga1.grd makecpt -Cglobe -T-500/7000/500 -Z mydata.cpt grdgradient a1.grd -A30 -Gchina.grd.int -Ne0.8 -V -M #使用grdimage绘制彩图 grdimage a1.grd -R85/87/37/38 -Yc -Xc -JM10i -Cmydata.cpt -Ichina.grd.int -K world1.ps pscoast -R -J -Di -N1 -A1000 -B0.5g0.5/0.5g0.5 -W0.25p -O -K world1.ps psscale -Ba2500f500::/:m: -Cmydata.cpt -D12.5c/-2c/15c/.35ch -O -Uauthor:YangLei world1.ps del *.cpt *.int ASTER GDEM ASTER GDEM,即先进星载热发射和反射辐射仪全球数字高程模型,与SRTM一样为数字高程DEM,其全球空间分辨率为30米。该数据是根据 NASA的新一代对地观测卫星Terra的详尽观测结果制作完成的。其数据覆盖范围为北纬83°到南纬83°之间的所有陆地区域,达到了地球陆地表面的99%。(摘自百度百科)。号称是“迄今最完整的全球地形数据”。 ASTER GDEM:空间分辨率:1弧度秒 (约30 米),精度:垂直精度20米,水平精度30米,SRTM数据的纬度覆盖范围是 ,ASTER GDEM数据的纬度覆盖范围为 ;SRTM的空间分辨率一般为90m,只有美国境内存在空间分辨率为30m的数据;ASTER GDEM的空间分辨率为30m; 网站:http://gdem.ersdac.jspacesystems.or.jp/ 网站需要注册,即可免费下载数据; 点击“Search”即可进入数据选择界面; 数据被划分为1度*1度的区块,每个区块文件名以区块左下角的经纬度值来命名; 数据选择界面有四种方式用来选择区块,界面的设计不太习惯,注意看英文; 数据可以单独下载,也可以批量下载;批量下载貌似需要处理一段时间; 下载的文件为zip压缩文件,包含了两个文件:dem和num,二者均为GeoTiff格式; dem数据即为数字高程数据; num数据也称为QA文件,即质量评估文件,其包含了每一点的高程数据的来源等信息,一般用不到; 使用GDAL提供的工具将其转换为GMT可识别的netCDF格式: gdal_translate -of GMT ASTGTM2_N36E111_dem.tif ASTGTM2_N36E111_dem.grd
个人分类: 测绘|6641 次阅读|0 个评论
GMT:度(。)的表示
zhoufcumt 2016-4-7 23:31
可用@^o@^实现。 GMT字体: GMT字体.jpg
个人分类: GMT|2355 次阅读|0 个评论
[转载]GMT-Defaults
shenxzh 2015-8-7 00:23
From:https://www.soest.hawaii.edu/gmt/gmt/html/man/gmtdefaults.html GMTDEFAULTS NAME SYNOPSIS DESCRIPTION GMT PARAMETERS EXAMPLES BUGS SEE ALSO NAME gmtdefaults− To list current GMT defaults SYNOPSIS gmtdefaults−D | −L DESCRIPTION gmtdefaults lists the GMT parameter defaults if the option −D is used. There are three ways to change someof the settings: (1) Use the command gmtset , (2) useany texteditor to edit the file .gmtdefaults4 in your home,~/.gmt or current directory (if you do not have this file,run gmtdefaults -D ~/.gmtdefaults4 to get onewith the system default settings), or (3) override anyparameter by specifying one or more −−PARAMETER = value statements onthe commandline of any GMT command ( PARAMETER and VALUE are any combination listed below). Thefirst two options are permanent changes until explicitlychanged back, while the last option is ephemeral and onlyapplies to the single GMT command that received theoverride. GMT can provide default values in US or SIunits. This choice is determined by the contents of thegmt_setup.conf file in GMT ’s sharedirectory. −D Print the system GMT defaults to standard output. Append u forUS defaults or s for SI defaults. . −L Print theuser’s currently active defaults to standardoutput. Your currentlyactive defaults come from the .gmtdefaults4 file in thecurrent working directory, if present; else from the.gmtdefaults4 file in your home directory, if present; elsefrom the file ~/.gmt/.gmtdefaults4, if present; else fromthe system defaults set at the time GMT wascompiled. GMT PARAMETERS The followingis a list of the parameters that are user-definable in GMT . The parameter names are always given in UPPERCASE. The parameter values are case-insensitive unlessotherwise noted. The system defaults are given in brackets . Those marked * can be set on thecommand line as well (the corresponding option is given inparentheses). Note that default distances and lengths beloware given in both cm or inch; the chosen default depends onyour choice of default unit (see MEASURE_UNIT ). Youcan explicitly specify the unit used for distances andlengths by appending c (cm), i (inch), m (meter), or p (points). When no unit isindicated the value will be assumed to be in the unit set by MEASURE_UNIT . Note that the printer resolution DOTS_PR_INCH is always the number of dots or pixelsper inch. Several parameters take only TRUE or FALSE. ANNOT_FONT_PRIMARY Font used for upperannotations, etc. . Specify either the fontnumber or the font name (case sensitive!). The 35 availablefonts are: 0 Helvetica 1 Helvetica-Bold 2 Helvetica-Oblique 3 Helvetica-BoldOblique 4 Times-Roman 5 Times-Bold 6 Times-Italic 7 Times-BoldItalic 8 Courier 9 Courier-Bold 10 Courier-Oblique 11 Courier-BoldOblique 12 Symbol 13 AvantGarde-Book 14 AvantGarde-BookOblique 15 AvantGarde-Demi 16 AvantGarde-DemiOblique 17 Bookman-Demi 18 Bookman-DemiItalic 19 Bookman-Light 20 Bookman-LightItalic 21 Helvetica-Narrow 22 Helvetica-Narrow-Bold 23 Helvetica-Narrow-Oblique 24 Helvetica-Narrow-BoldOblique 25 NewCenturySchlbk-Roman 26 NewCenturySchlbk-Italic 27 NewCenturySchlbk-Bold 28 NewCenturySchlbk-BoldItalic 29 Palatino-Roman 30 Palatino-Italic 31 Palatino-Bold 32 Palatino-BoldItalic 33 ZapfChancery-MediumItalic 34 ZapfDingbats ANNOT_FONT_SIZE_PRIMARY Font size ( 0) for mapannotations . ANNOT_FONT_SECONDARY Font to use for time axissecondary annotations. See ANNOT_FONT_PRIMARY foravailable fonts . ANNOT_FONT_SIZE_SECONDARY Font size ( 0) for timeaxis secondary annotations . ANNOT_MIN_ANGLE If the angle between the mapboundary and the annotation baseline is less than thisminimum value (in degrees), the annotation is not plotted(this may occur for certain oblique projections.) Give avalue in the range 0−90. ANNOT_MIN_SPACING If an annotation would beplotted less than this minimum distance from its closestneighbor, the annotation is not plotted (this may occur forcertain oblique projections.) ANNOT_OFFSET_PRIMARY Distance from end of tickmarkto start of annotation . Anegative offset will place the annotation inside the mapborder. ANNOT_OFFSET_SECONDARY Distance from base of primaryannotation to the top of the secondary annotation (Only applies to time axeswith both primary and secondary annotations). BASEMAP_AXES Sets which axes to draw andannotate. Case sensitive: Upper case means both draw andannotate, lower case means draw axis only. . BASEMAP_FRAME_RGB Color used to draw mapboundaries and annotations. Give a red/green/blue triplet,with each element in the 0−255 range. Prepend’+’ to replicate this color to the tick-, grid-,and frame-pens. (black). BASEMAP_TYPE Choose between inside, graph,plain and fancy (thick boundary, alternating black/whiteframe; append + for rounded corners) . For some mapprojections (e.g., Oblique Mercator), plain is the onlyoption even if fancy is set as default. In general, fancyonly applies to situations where the projected x and ydirections parallel the lon and lat directions (e.g.,rectangular projections, polar projections). For situationswhere all boundary ticks and annotations must be inside themaps (e.g., for preparing geotiffs), chose inside. Finally,graph is used for linear projections only and will extendthe axis by 7.5% and add arrow heads. CHAR_ENCODING Names the eight bit characterset being used for text in files and in command lineparameters. This allows GMT to ensure that the PostScript output generates the correct characters onthe plot.. Choose from Standard, Standard+, ISOLatin1,ISOLatin1+, and ISO-8859-x (where x is in the ranges 1-10 or13-15). See Appendix F for details . COLOR_BACKGROUND Color used for the backgroundof images (i.e., when z lowest colortable entry). Givea red/green/blue triplet, with each element in the0−255 range. (black) COLOR_FOREGROUND Color used for the foregroundof images (i.e., when z highest colortable entry). Givea red/green/blue triplet, with each element in the0−255 range. (white) COLOR_IMAGE Selects which operator to usewhen rendering bit-mapped color images. Due to the lack ofthe colorimage operator in some PostScript implementations, as well as some PostScript editorsinability to handle color gradations, GMT offers twodifferent options: adobe (Adobe’s colorimage definition) . tiles (Plot image as many individualrectangles). COLOR_MODEL Selects if color palette filescontain RGB values (r,g,b in 0-255 range), HSV values (h in0-360, s,v in 0-1 range), or CMYK values (c,m,y,k in 0-1range). A COLOR_MODEL setting in the color palettefile will override this setting. Internally, colorinterpolation takes place directly on the RGB values whichcan give unexpected hues, whereas interpolation directly onthe HSV values better preserves the hues. Prepend the prefix+ to force interpolation in the selected colorsystem (does not apply to the CMYK system). For thisadditional option, the defaults take precedence over thecolor palette file . COLOR_NAN Color used for the non-definedareas of images (i.e., where z == NaN). Give ared/green/blue triplet, with each element in the 0−255range. (gray) D_FORMAT Output format (C languageprintf syntax) to be used when printing double precisionfloating point numbers. For geographic coordinates, see OUTPUT_DEGREE_FORMAT . . DEGREE_SYMBOL Determines what symbol is usedto plot the degree symbol on geographic map annotations.Choose between ring, degree, colon, or none . DOTS_PR_INCH Resolution of the plottingdevice (dpi). Note that in order to be as compact aspossible, GMT PostScript output uses integerformats only so the resolution should be set depending onwhat output device you are using. E.g, using 300 and sendingthe output to a Linotype 300 phototypesetter (2470 dpi) willnot take advantage of the extra resolution (i.e.,positioning on the page and line thicknesses are still onlydone in steps of 1/300 inch; of course, text will looksmoother) . ELLIPSOID The (case sensitive) name ofthe ellipsoid used for the map projections . Chooseamong: WGS-84 : WorldGeodetic System (1984) OSU91A : Ohio State University (1991) OSU86F : Ohio State University (1986) Engelis : Goddard Earth Models (1985) SGS-85 : Soviet Geodetic System (1985) TOPEX : Used commonly for altimetry (1990) MERIT-83 : United States Naval Observatory (1983) GRS-80 : International Geodetic Reference System (1980) Hughes-1980 : Hughes Aircraft Company for DMSP SSM/I gridproducts (1980) Lerch : For geoid modelling (1979) ATS77 : Average Terrestrial System, Canada Maritimeprovinces (1977) IAG-75 : International Association of Geodesy (1975) Indonesian : Applies to Indonesia (1974) WGS-72 : World Geodetic System (1972) NWL-10D : Naval Weapons Lab (Same as WGS-72) (1972) South-American : Applies to South America (1969) Fischer-1968 : Used by NASA for Mercury program (1968) Modified-Mercury-1968 : Same as Fischer-1968 (1968) GRS-67 : International Geodetic Reference System (1967) International-1967 : Worldwide use (1967) WGS-66 : World Geodetic System (1966) NWL-9D : Naval Weapons Lab (Same as WGS-66) (1966) Australian : Applies to Australia (1965) APL4.9 : Appl. Physics (1965) Kaula : From satellite tracking (1961) Hough : Applies to the Marshall Islands (1960) WGS-60 : World Geodetic System (1960) Fischer-1960 : Used by NASA for Mercury program (1960) Mercury-1960 : Same as Fischer-1960 (1960) Modified-Fischer-1960 : Applies to Singapore (1960) Fischer-1960-SouthAsia : Same as Modified-Fischer-1960(1960) Krassovsky : Used in the (now former) Soviet Union (1940) War-Office : Developed by G. T. McCaw (1926) International-1924 : Worldwide use (1924) Hayford-1909 : Same as the International 1924 (1909) Helmert-1906 : Applies to Egypt (1906) Clarke-1880 : Applies to most of Africa, France (1880) Clarke-1880-Arc1950 : Modified Clarke-1880 for Arc 1950(1880) Clarke-1880-IGN : Modified Clarke-1880 for IGN (1880) Clarke-1880-Jamaica : Modified Clarke-1880 for Jamaica(1880) Clarke-1880-Merchich : Modified Clarke-1880 for Merchich(1880) Clarke-1880-Palestine : Modified Clarke-1880 for Palestine(1880) Andrae : Applies to Denmark and Iceland (1876) Clarke-1866 : Applies to North America, the Philippines(1866) Clarke-1866-Michigan : Modified Clarke-1866 for Michigan(1866) Struve : Friedrich Georg Wilhelm Struve (1860) Clarke-1858 : Clarke’s early ellipsoid (1858) Airy : Applies to Great Britain (1830) Airy-Ireland : Applies to Ireland in 1965 (1830) Modified-Airy : Same as Airy-Ireland (1830) Bessel : Applies to Central Europe, Chile, Indonesia (1841) Bessel-Schwazeck : Applies to Namibia (1841) Bessel-Namibia : Same as Bessel-Schwazeck (1841) Bessel-NGO1948 : Modified Bessel for NGO 1948 (1841) Everest-1830 : India, Burma, Pakistan, Afghanistan, Thailand(1830) Everest-1830-Kalianpur : Modified Everest for Kalianpur(1956) (1830) Everest-1830-Kertau : Modified Everest for Kertau, Malaysia Singapore (1830) Everest-1830-Timbalai : Modified Everest for Timbalai, SabahSarawak (1830) Everest-1830-Pakistan : Modified Everest for Pakistan (1830) Walbeck : First least squares solution by Finnish astronomer(1819) Plessis : Old ellipsoid used in France (1817) Delambre : Applies to Belgium (1810) CPM : Comm. des Poids et Mesures, France (1799) Maupertius : Really old ellipsoid used in France (1738) Sphere : The mean radius in WGS-84 (for spherical/platetectonics applications) (1984) Moon : Moon (IAU2000) (2000) Mercury : Mercury (IAU2000) (2000) Venus : Venus (IAU2000) (2000) Mars : Mars (IAU2000) (2000) Jupiter : Jupiter (IAU2000) (2000) Saturn : Saturn (IAU2000) (2000) Uranus : Uranus (IAU2000) (2000) Neptune : Neptune (IAU2000) (2000) Pluto : Pluto (IAU2000) (2000) Note that forsome global projections, GMT may use a sphericalapproximation of the ellipsoid chosen, setting theflattening to zero, and using a mean radius. A warning willbe given when this happens. If a different ellipsoid namethan those mentioned here is given, GMT will attemptto parse the name to extract the semi-major axis ( a in m) and the flattening. Formats allowed are: a implies a zero flattening a , inv_f where inv_f is the inverseflattening a , b= b where b is the semi-minor axis (inm) a , f= f where f is the flattening This way acustom ellipsoid (e.g., those used for other planets) may beused. Further note that coordinate transformations in mapproject can also specify specific datums; see the mapproject man page for further details and how toview ellipsoid and datum parameters. FIELD_DELIMITER This setting determines whatcharacter will separate ASCII output data columns written by GMT . Choose from tab, space, comma, and none . FRAME_PEN Pen attributes used to drawplain map frame in dpi units or points (append p) . FRAME_WIDTH Width ( 0) of map bordersfor fancy map frame . GLOBAL_X_SCALE Global x-scale ( 0) toapply to plot-coordinates before plotting. Normally used toshrink the entire output down to fit a specific height/width . GLOBAL_Y_SCALE Same, but for y-coordinates . GRID_CROSS_SIZE_PRIMARY Size (= 0) of grid cross atlon-lat intersections. 0 means draw continuous gridlinesinstead . GRID_CROSS_SIZE_SECONDARY Size (= 0) of grid cross atsecondary lon-lat intersections. 0 means draw continuousgridlines instead . GRID_PEN_PRIMARY Pen attributes used to drawgrid lines in dpi units or points (append p) . GRID_PEN_SECONDARY Pen attributes used to drawgrid lines in dpi units or points (append p) . GRIDFILE_FORMAT Default file format for grids,with optional scale, offset and invalid value, written as ff / scale / offset / invalid . The2-letter format indicator can be one of . The first letter indicatesnative GMT binary, old format netCDF,COARDS-compliant netCDF, Surfer format or Sun Raster format.The second letter stands for byte, short, int, float anddouble, respectively. When / invalid is omitted theappropriate value for the given format is used (NaN orlargest negative). When / scale / offset isomitted, /1.0/0.0 is used. . GRIDFILE_SHORTHAND If TRUE, all grid file namesare examined to see if they use the file extension shorthanddiscussed in Section 4.17 of the GMT TechnicalReference and Cookbook. If FALSE, no filename expansion isdone . HEADER_FONT Font to use when plottingheaders. See ANNOT_FONT_PRIMARY for available fonts . HEADER_FONT_SIZE Font size ( 0) for header . HEADER_OFFSET Distance from top of axisannotations (or axis label, if present) to base of plotheader . HISTORY If TRUE, passes the history ofpast common command options via the hidden .gmtcommands4file . HSV_MAX_SATURATION Maximum saturation (0−1)assigned for most positive intensity value . HSV_MIN_SATURATION Minimum saturation (0−1)assigned for most negative intensity value . HSV_MAX_VALUE Maximum value (0−1)assigned for most positive intensity value . HSV_MIN_VALUE Minimum value (0−1)assigned for most negative intensity value . INPUT_CLOCK_FORMAT Formatting template thatindicates how an input clock string is formatted. Thistemplate is then used to guide the reading of clock stringsin data fields. To properly decode 12-hour clocks, append amor pm (or upper case) to match your data records. Asexamples, try hh:mm, hh:mm:ssAM, etc. . INPUT_DATE_FORMAT Formatting template thatindicates how an input date string is formatted. Thistemplate is then used to guide the reading of date stringsin data fields. You may specify either Gregorian calendarformat or ISO week calendar format. Gregorian calendar: Useany combination of yyyy (or yy for 2-digit years; if so see Y2K_OFFSET_YEAR ), mm (or o for abbreviated month namein the current time language), and dd, with or withoutdelimiters. For day-of-year data, use jjj instead of mmand/or dd. Examples can be ddmmyyyy, yy-mm-dd, dd-o-yyyy,yyyy/dd/mm, yyyy-jjj, etc. ISO Calendar: Expected templateis yyyy W ww d, where ww is ISO week and d is ISO weekday. Either template must be consistent, e.g., you cannotspecify months if you don’t specify years. Examplesare yyyyWwwd, yyyy-Www, etc. . INTERPOLANT Determines if linear (linear),Akima’s spline (akima), natural cubic spline (cubic)or no interpolation (none) should be used for 1-Dinterpolations in various programs . IO_HEADER ( * −H ) Specifieswhether input/output ASCII files have header record(s) ornot . LABEL_FONT Font to use when plottinglabels below axes. See ANNOT_FONT_PRIMARY foravailable fonts . LABEL_FONT_SIZE Font size ( 0) for labels . LABEL_OFFSET Distance from base of axisannotations to the top of the axis label . LINE_STEP Determines the maximum length( 0) of individual straight line-segments when drawingarcuate lines MAP_SCALE_FACTOR Changes the default map scalefactor used for the Polar Stereographic , UTM , and Transverse Mercator projections in orderto minimize areal distortion. Provide a new scale-factor orleave as default. MAP_SCALE_HEIGHT Sets the height ( 0) on themap of the map scale bars drawn by various programs . MEASURE_UNIT Sets the unit length. Choosebetween cm, inch, m, and point. . Note that, in GMT , one point is defined as 1/72 inch (the PostScript definition), while it is often defined as1/72.27 inch in the typesetting industry. There is nouniversal definition. N_COPIES ( * −c ) Number ofplot copies to make . N_HEADER_RECS Specifies how many headerrecords to expect if −H is turned on . NAN_RECORDS Determines what happens wheninput records containing NaNs for x or y (andin some cases z ) are read. Choose between skip , which will simply report how many bad recordswere skipped, and pass , which will passthese records on to the calling programs. For most programsthis will result in output records with NaNs as well, butsome will interpret these NaN records to indicate gaps in aseries; programs may then use that information to detectsegmentation (if applicable). OBLIQUE_ANNOTATION This integer is a sum of 6 bitflags (most of which only are relevant for obliqueprojections): If bit 1 is set (1), annotations will occurwherever a gridline crosses the map boundaries, elselongitudes will be annotated on the lower and upperboundaries only, and latitudes will be annotated on the leftand right boundaries only. If bit 2 is set (2), thenlongitude annotations will be plotted horizontally. If bit 3is set (4), then latitude annotations will be plottedhorizontally. If bit 4 is set (8), then oblique tickmarksare extended to give a projection equal to the specifiedtick_length. If bit 5 is set (16), tickmarks will be drawnnormal to the border regardless of gridline angle. If bit 6is set (32), then latitude annotations will be plottedparallel to the border. To set a combination of these, addup the values in parentheses. . OUTPUT_CLOCK_FORMAT Formatting template thatindicates how an output clock string is to be formatted.This template is then used to guide the writing of clockstrings in data fields. To use a floating point format forthe smallest unit (e.g., seconds), append .xxx, where thenumber of x indicates the desired precision. If no floatingpoint is indicated then the smallest specified unit will berounded off to nearest integer. For 12-hour clocks, appendam, AM, a.m., or A.M. ( GMT will replace a|A with p|Pfor pm). If your template starts with a leading hyphen (-)then each integer item (y,m,d) will be printed withoutleading zeros (default uses fixed width formats). Asexamples, try hh:mm, hh.mm.ss, hh:mm:ss.xxxx, hha.m., etc. . OUTPUT_DATE_FORMAT Formatting template thatindicates how an output date string is to be formatted. Thistemplate is then used to guide the writing of date stringsin data fields. You may specify either Gregorian calendarformat or ISO week calendar format. Gregorian calendar: Useany combination of yyyy (or yy for 2-digit years; if so see Y2K_OFFSET_YEAR ), mm (or o for abbreviated month namein the current time language), and dd, with or withoutdelimiters. For day-of-year data, use jjj instead of mmand/or dd. As examples, try yy/mm/dd, yyyy=jjj, dd-o-yyyy,dd-mm-yy, yy-mm, etc. ISO Calendar: Expected template isyyyy W ww d, where ww is ISO week and d is ISO weekday. Either template must be consistant, e.g., you cannotspecify months if you don’t specify years. Asexamples, try yyyyWww, yy-W-ww-d, etc. If your templatestarts with a leading hyphen (-) then each integer item(y,m,d) will be printed without leading zeros (default usesfixed width formats) . OUTPUT_DEGREE_FORMAT Formatting template thatindicates how an output geographical coordinate is to beformatted. This template is then used to guide the writingof geographical coordinates in data fields. The template isin general of the form D or ddd ] . By default, longitudes will bereported in the -180/+180 range. The various terms have thefollowing purpose: + Output longitude in the 0 to 360 range - Output longitude in the -360 to 0 range D Use D_FORMAT for floating pointdegrees. ddd Fixed format integer degrees : delimiter used mm Fixed format integer arc minutes ss Fixed format integer arc seconds F Encode sign using WESN suffix The default is+D. PAGE_COLOR Sets the color of the imagingbackground, i.e., the paper. Give a red/green/blue triplet,with each element in the 0−255 range. (white). PAPER_MEDIA Sets the physical format of thecurrent plot paper . The following formats(and their widths and heights in points) are recognized(Additional site-specific formats may be specified in thegmt_custom_media.conf file in $GMT_SHAREDIR /conf or~/.gmt; see that file for details): Media width height A0 2380 3368 A1 1684 2380 A2 1190 1684 A3 842 1190 A4 595 842 A5 421 595 A6 297 421 A7 210 297 A8 148 210 A9 105 148 A10 74 105 B0 2836 4008 B1 2004 2836 B2 1418 2004 B3 1002 1418 B4 709 1002 B5 501 709 archA 648 864 archB 864 1296 archC 1296 1728 archD 1728 2592 archE 2592 3456 flsa 612 936 halfletter 396 612 statement 396 612 note 540 720 letter 612 792 legal 612 1008 11x17 792 1224 tabloid 792 1224 ledger 1224 792 For acompletely custom format (e.g., for large format plotters)you may also specify Custom_WxH, where W and H are in pointsunless you append a unit to each dimension ( c , i , m or p ). To force theprinter to request a manual paper feed, append’-’ to the media name, e.g., A3- will requirethe user to insert a A3 paper into the printer’smanual feed slot. To indicate you are making an EPS file,append ’+’ to the media name. Then, GMT will attempt to issue a tight bounding box . PAGE_ORIENTATION ( * −P ) Sets theorientation of the page. Choose portrait or landscape . PLOT_CLOCK_FORMAT Formatting template thatindicates how an output clock string is to be plotted. Thistemplate is then used to guide the formatting of clockstrings in plot annotations. See OUTPUT_CLOCK_FORMAT for details. . PLOT_DATE_FORMAT Formatting template thatindicates how an output date string is to be plotted. Thistemplate is then used to guide the plotting of date stringsin data fields. See OUTPUT_DATE_FORMAT for details.In addition, you may use a single o instead of mm (to plotmonth name) and u instead of W ww to plot Week##. Both of these text strings will be affected by the TIME_LANGUAGE , TIME_FORMAT_PRIMARY and TIME_FORMAT_SECONDARY setting. . PLOT_DEGREE_FORMAT Formatting template thatindicates how an output geographical coordinate is to beplotted. This template is then used to guide the plotting ofgeographical coordinates in data fields. See OUTPUT_DEGREE_FORMAT for details. In addition, youcan append A which plots the absolute value of thecoordinate. The default is ddd:mm:ss. Not all items may beplotted as this depends on the annotation interval. POLAR_CAP Controls the appearance ofgridlines near the poles for all azimuthal projections and afew others in which the geographic poles are plotted aspoints (Lambert Conic, Hammer, Mollweide, Sinusoidal, andvan der Grinten). Specify either none (in which case thereis no special handling) or pc_lat / pc_dlon . Inthat case, normal gridlines are only drawn between thelatitudes - pc_lat /+ pc_lat , and above thoselatitudes the gridlines are spaced at the (presumablycoarser) pc_dlon interval; the two domains areseparated by a small circle drawn at the pc_lat latitude . Note for r-theta (polar) projection wherer = 0 is at the center of the plot the meaning of the cap isreversed, i.e., the default 85/90 will draw a r = 5 radiuscircle at the center of the map with less frequent radiallines there. PS_COLOR Determines whether PostScript output should use RGB, HSV, CMYK, or GRAYwhen specifying color . Note if HSV is selected it doesnot apply to images which in that case uses RGB. Whenselecting GRAY, all colors will be converted to gray scaleusing YIQ (television) conversion. PS_IMAGE_COMPRESS Determines if PostScript images are compressed using the Run-Length Encoding scheme(rle), Lempel-Ziv-Welch compression (lzw), or not at all(none) . PS_IMAGE_FORMAT Determines whether imagescreated in PostScript should use ASCII or binaryformat. The latter takes up less space and executes fasterbut may choke some printers, especially those off serialports. Select ascii or bin . PS_LINE_CAP Determines how the ends of aline segment will be drawn. Choose among a butt cap(default) where there is no projection beyond the end of thepath, a round cap where a semicircular arc withdiameter equal to the linewidth is drawn around the endpoints, and square cap where a half square of sizeequal to the linewidth extends beyond the end of the path . PS_LINE_JOIN Determines what happens atkinks in line segments. Choose among a miter joinwhere the outer edges of the strokes for the two segmentsare extended until they meet at an angle (as in a pictureframe; if the angle is too acute, a bevel join is usedinstead, with threshold set by PS_MITER_LIMIT ), round join where a circular arc is used to fill inthe cracks at the kinks, and bevel join which is amiter join that is cut off so kinks are triangular in shape . PS_MITER_LIMIT Sets the threshold angle indegrees (integer in 0-180 range) used for mitered joinsonly. When the angle between joining line segments issmaller than the threshold the corner will be bevelledinstead of mitered. The default threshold is 35 degrees.Setting the threshold angle to 0 implies the PostScript default of about 11 degrees. Setting thethreshold angle to 180 causes all joins to be beveled. PS_VERBOSE If TRUE we will issue commentsin the PostScript file that explain the logic ofoperations. These are useful if you need to edit the fileand make changes; otherwise you can set it to FALSE whichyields a somewhat slimmer PostScript file . TICK_LENGTH The length of a tickmark.Normally, tickmarks are drawn on the outside of the mapboundaries. To select interior tickmarks, use a negativetick_length . TICK_PEN Pen attributes to be used fortickmarks in dpi units or points (append p) . TIME_EPOCH Specifies the value of thecalendar and clock at the origin (zero point) of relativetime units (see TIME_UNIT ). It is a string of theform yyyy-mm-ddT (Gregorian) oryyyy-Www-ddT (ISO) Default is 2000-01-01T12:00:00,the epoch of the J2000 system. TIME_FORMAT_PRIMARY Controls how primary month-,week-, and weekday-names are formatted. Choose among full,abbreviated, and character. If the leading f, a, or c arereplaced with F, A, and C the entire annotation will be inupper case. TIME_FORMAT_SECONDARY Controls how secondary month-,week-, and weekday-names are formatted. Choose among full,abbreviated, and character. If the leading f, a, or c arereplaced with F, A, and C the entire annotation will be inupper case. TIME_INTERVAL_FRACTION Determines if partial intervalsat the start and end of an axis should be annotated. If therange of the partial interval exceeds the specified fractionof the normal interval stride we will place the annotationcentered on the partial interval . TIME_IS_INTERVAL Used when input calendar datashould be truncated and adjusted to the middle of therelevant interval. In the following discussion, the unit u can be one of these time units: ( y year, o month, u ISO week, d day, h hour, m minute, and c second). TIME_IS_INTERVAL can have any of the following threevalues: (1) OFF . No adjustment, time is decoded asgiven. (2) + n u . Activate interval adjustmentfor input by truncate to previous whole number of n units and then center time on the following interval. (3)- n u . Same, but center time on the previousinterval. For example, with TIME_IS_INTERVAL = +1o,an input data string like 1999-12 will be interpreted tomean 1999-12-15T12:00:00.0 (exactly middle of December),while if TIME_IS_INTERVAL = OFF then that date isinterpreted to mean 1999-12-01T00:00:00.0 (start ofDecember) . TIME_LANGUAGE Language to use when plottingcalendar items such as months and days. Select from: BR Brazilian Portuguese CN1 Simplified Chinese CN2 Traditional Chinese DE German DK Danish EH Basque ES Spanish FI Finnish FR French GR Greek HI Hawaiian HU Hungarian IE Irish IL Hebrew IS Icelandic IT Italian JP Japanese NL Dutch NO Norwegian PL Polish PT Portuguese RU Russian SE Swedish SG Scottish Gaelic TO Tongan TR Turkish UK British English US US English If yourlanguage is not supported, please examine the $GMT_SHAREDIR /time/us.d file and make a similar file.Please submit it to the GMT Developers for officialinclusion. Custom language files can be placed indirectories $GMT_SHAREDIR /time or ~/.gmt. TIME_SYSTEM Shorthand for a combination of TIME_EPOCH and TIME_UNIT , specifying whichtime epoch the relative time refers to and what the unitsare. Choose from one of the preset systems below (epoch andunits are indicated): JD -4713-11-25T12:00:00 d (Julian Date) MJD 1858-11-17T00:00:00 d (Modified Julian Date) J2000 2000-01-01T12:00:00 d (Astronomical time) S1985 1985-01-01T00:00:00 c (Altimetric time) UNIX 1970-01-01T00:00:00 c (UNIX time) RD0001 0001-01-01T00:00:00 c RATA 0000-12-31T00:00:00 d This parameter is not stored inthe .gmtdefaults4 file but is translated to the respectivevalues of TIME_EPOCH and TIME_UNIT . TIME_UNIT Specifies the units of relativetime data since epoch (see TIME_EPOCH ). Choose y(year - assumes all years are 365.2425 days), o (month -assumes all months are of equal length y/12), d (day), h(hour), m (minute), or c (second) . TIME_WEEK_START When weeks are indicated ontime axes, this parameter determines the first day of theweek for Gregorian calendars. (The ISO weekly calendaralways begins weeks with Monday.) . TRANSPARENCY Makes printed materialtransparent. Specify transparency in percent: 0 is opaque(normal overlay plotting), 100 is fully transparent (i.e.,nothing will show). Use either as a pair( stroke / fill ) to set the transparency ofstroked material (lines) or filled material (polygons)separately, or use a single number to set both to the samevalue . Warning: Most printers and PostScript viewers cannot print or will not show transparency. They will simplyignore your attempt to create transparency and will plot anymaterial as opaque. Ghostscript and all itsderivatives like ps2raster , Apple’s Preview and the CUPS printing system are amongthose programs incapable of dealing with transparency. Ifyou want to view transparent material you need to use Acrobat Distiller to create a PDF file. Note that thesettings of Acrobat Distiller need to be changed tomake transparency effective: change /AllowTransparency totrue in the .joboptions file. UNIX_TIME ( * −U ) Specifiesif a UNIX system time stamp should be plotted at the lowerleft corner of the plot . UNIX_TIME_POS ( * −U ) Sets thejustification and the position of the UNIX time stamp boxrelative to the current plots lower left corner of the plot . UNIX_TIME_FORMAT Defines the format of the timeinformation in the UNIX time stamp. This format is parsed bythe C function strftime , so that virtually any textcan be used (even not containing any time information) . VECTOR_SHAPE Determines the shape of thehead of a vector. Normally (i.e., for vector_shape = 0), thehead will be triangular, but can be changed to an arrow (1)or an open V (2). Intermediate settings give something inbetween. Negative values (up to -2) are allowed as well . VERBOSE ( * −V ) Determinesif GMT programs should display run-time informationor run silently . X_AXIS_LENGTH Sets the default length (0) of the x-axis . X_ORIGIN ( * −X ) Sets thex-coordinate of the origin on the paper for a new plot . For an overlay, the defaultoffset is 0. XY_TOGGLE ( * −: ) Set if thefirst two columns of input and output files contain(latitude,longitude) or (y,x) rather than the expected(longitude,latitude) or (x,y). FALSE means we have (x,y)both on input and output. TRUE means both input and outputshould be (y,x). IN means only input has (y,x), while OUTmeans only output should be (y,x). . Y_AXIS_LENGTH Sets the default length (0) of the y-axis . Y_ORIGIN ( * −Y ) Sets they-coordinate of the origin on the paper for a new plot . For an overlay, the defaultoffset is 0. Y_AXIS_TYPE Determines if the annotationsfor a y-axis (for linear projections) should be plottedhorizontally (hor_text) or vertically (ver_text) . Y2K_OFFSET_YEAR When 2-digit years are used torepresent 4-digit years (see various DATE_FORMAT s), Y2K_OFFSET_YEAR gives the first year in a 100-yearsequence. For example, if Y2K_OFFSET_YEAR is 1729,then numbers 29 through 99 correspond to 1729 through 1799,while numbers 00 through 28 correspond to 1800 through 1828. . SPECIFYINGPENS pen The attributes of lines and symbol outlinesas defined by pen is a comma delimetered list of width , color and texture , each of whichis optional. width can be indicated as a measure(points, centimeters, inches) or as faint , thin , thick , fat , or obese . color specifies a gray shade or color (see SPECIFYINGCOLOR below). texture is a combination of dashes‘-’ and dots ‘.’. SPECIFYINGFILL fill The attribute fill specifies thesolid shade or solid color (see SPECIFYING COLORbelow) or the pattern used for filling polygons. Patternsare specified as p dpi/pattern , where pattern gives the number of the built-in pattern(1-90) or the name of a Sun 1-, 8-, or 24-bit rasterfile. The dpi sets the resolution of the image. For1-bit rasters: use P dpi/pattern for inversevideo, or append :F color ] to specifyfore- and background colors (use color = - fortransparency). See GMT Cookbook TechnicalReference Appendix E for information on individualpatterns. SPECIFYINGCOLOR color The color of lines, areas andpatterns can be specified by a valid color name; by a grayshade (in the range 0−255); by a decimal color code(r/g/b, each in range 0−255; h-s-v, ranges0−360, 0−1, 0−1; or c/m/y/k, each in range0−1); or by a hexadecimal color code (#rrggbb, as usedin HTML). See the gmtcolors manpage for moreinformation and a full list of color names. EXAMPLES To get a copyof the GMT parameter defaults in your home directory,run gmtdefaults−D ~/.gmtdefaults4 You may nowchange the settings by editing this file using a text editorof your choice, or use gmtset to change specifiedparameters on the command line. BUGS If you havetypographical errors in your .gmtdefaults4 file(s), awarning message will be issued, and the GMT defaultsfor the affected parameters will be used. SEE ALSO GMT (1), gmtcolors (5), gmtget (1), gmtset (1)
个人分类: Resear note|6108 次阅读|0 个评论
ubuntu安装GMT4.5.13
fangrongxin 2015-4-1 11:07
下载 官网: http://www.soest.hawaii.edu/gmt/ 官方 ftp : ftp://ftp.soest.hawaii.edu/gmt 需要下载的包包括: · gmt-4.5.13-src.tar.bz2 · gshhg-gmt-2.3.4.tar.gz · Netcdf-4.3.0.tar.gz 注: GMT 中的 triangulate 命令有两个不同的源码,其中一个遵循 GPL 协议,另一个不遵循 GPL 协议。 GMT 的 src 包中包含了前者。若有特殊需求,需要使用后者源码的功能,可以下载 gmt-4.5.13-non-gpl-src.tar.bz2 ,并将解压后的 triangulate 源码覆盖 gmt-4.5.13-src.tar.bz2 中的相应源码。 GMT 编译过程需要 C 编译器,以及一些底层的库文件。 LINUX: Note: The installprocess requires bzip2 . 对于 Ubuntu/Debian: sudo apt-getinstall g++ libxt-dev libxaw7-dev libxmu-dev libSM-dev 对于 CentOS/RHEL/Fedora: sudo yum installgcc-c++ libXt-devel libXaw-devel libXmu-devel libSM-devel 软件依赖包 GMT4 主要依赖于 netCDF ,可以直接使用 Linux 发行版官方源中提供的 netCDF 包 。除了 netcdf 之外,建议还安装 gdal 包。虽然 GMT 不依赖于 gdal ,但 gdal 可以轻松地将其他数据格式转换为 GMT 可识别的格式。 ( 对于 Ubuntu/Debian: sudo apt-getinstall libnetcdf-dev libgdal1-dev) 我没试成功 · 自己安装 netcdf tar -zxvf netcdf- 4.3.0 .tar.gz // 解压 netcdf cd netcdf- 4.3.0 // 进入 netcdf 文件夹 ./configure --prefix=/opt/netcdf- 4.3.0 //configure, prefix 指定 netcdf 的安装路径 ( 一般安装在 /opt/ 目录下不容易出错 ) make // 编译 netcdf sudo make install // 安装 netcdf 安装 GMT 编译 GMT 源码 1 2 3 4 5 $ tar -jxvf gmt-4.5.13-src.tar.bz2 $ cd gmt-4.5.13 $ ./configure --prefix = /opt/GMT-4.5.13 --enable-netcdf=/opt/netcdf-3.6.3/ // 配置 GMT 。 prefix 为 GMT 安装路径, --enable-netcdf 为前面 netcdf 的安装路径 $ make $ sudo make install-all 安装海岸线数据 1 2 $ tar -zxvf gshhg-gmt-2.3.4.tar.gz $ sudo cp -r gshhg-gmt-2.3.4 /opt/GMT-4.5.13/share/coast 修改环境变量 向 ~/.bashrc 中加入 GMT4 的环境变量,并使环境变量生效: 1 2 3 4 $ echo 'export GMT4HOME=/opt/GMT-4.5.13' ~/.bashrc $ echo 'export PATH=${GMT4HOME}/bin:$PATH' ~/.bashrc $ echo 'export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GMT4HOME}/lib64' ~/.bashrc $ exec $SHELL -l 说明: · 第一个命令向 ~/.bashrc 中添加环境变量 GMT4HOME ; · 第二个命令修改 ~/.bashrc ,将 GMT4 的 bin 目录加入到 PATH 中; · 第三个命令将 GMT4 的 lib 目录加入到动态链接库路径中,若为 32 位系统,则为 lib ; 64 位系统则为 lib64 ; · 第四个命令是重新载入 bash ,相当于 source ~/.bashrc 。 或者 vi 打开 ./bashrc 在文件尾直接添加: export GMT4HOME=/opt/GMT-4.5.13 export PATH=${GMT4HOME}/bin:$PATH exportLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GMT4HOME}/lib 然后运行 source ./bashrc reference: http://blog.sciencenet.cn/blog-350278-697508.html http://seisman.info/install-gmt4-under-linux.html
个人分类: tools|6381 次阅读|0 个评论
在Matlab中调用GMT画图
blazing216 2014-12-13 22:41
GMT(Generic Mapping Tools)是由Paul Wessel和Walter Smith开发的一款开源的绘图软件。它使用命令行生成ps或者eps文件。GMT的常用命令包括psbasemap,psxy,grdimage,pstext等,可以在linux和Windows下使用。Matlab是MathWorks开发的数学软件,使用以矩阵作为基本数据类型,集算法开发、数值计算和数据可视化为一体的高级语言。使用Matlab可以方便地处理数据,文件等,也可以画图,但是Matlab生成的图不是很美观,通常需要进一步的修饰。而GMT可以绘制高质量的图件,但是需要事先生成所需的文件。 为了解决这一问题,我们在Windows使用Matlab将GMT画图的命令写入一个批处理文件中,然后使用Matlab的system命令运行该批处理文件,生成.ps文件。然后可以用system命令调用ghostview等软件打开.ps文件,查看绘制结果。 这是我使用Matlab生成批处理文件的第一段。 % write .bat file for GMT batfile = 'Fig4_Matlab_GMT.bat'; epsfile = 'Fig4_Matlab_GMT.ps'; fid = fopen(batfile,'w'); fprintf(fid, , epsfile); 这是最后一段 fprintf(fid, ); fprintf(fid,'del gmt.*\r\n'); fclose(fid); system(batfile); % 运行Fig4_Matlab_GMT.bat system( ); % 调用gsview32打开Fig4_Matlab_GMT.ps 注:对于fprintf函数来说,%%-%,\r\n-回车,\\-\ 使用Matlab生成批处理文件的好处是: (1)方便使用%f或%e设置GMT命令需要的参数; (2)随时使用dlmwrite或csvwrite等命令生成GMT需要的临时性文件,弥补Windows下echo命令的不足; (3)实现运行批处理文件和查看ps文件的自动化。 目前存在的问题,GMT命令错误的提示没有显示在Matlab中,不能直接地检验GMT命令执行是否有误。Matlab向文件输出的命令略微有些繁琐。不过瑕不掩瑜,在Matlab中调用GMT画图仍是一个很好的方法。
个人分类: GMT|8712 次阅读|0 个评论
Ubuntu系统安装GMT
chaoshu 2014-4-17 21:32
我使用的linux发兴版本是Ubuntu12.04,如何安装可以看见我的另一篇文。 http://blog.sina.com.cn/s/blog_c260b8350101dw2l.html 下面正式开始安装GMT。 GMT 4.5.9 于 2013 年 1 月 1 日正式发布,这个版本依然主要只是 bug 修订,值得关注的一点在于海岸线数据已经从原来的 GSHHS 变成了现在的 GSHHG 。 下载安装所需要的三个文件,放在任意文件夹下 gmt-4.5.9.tar.bz2 gshhg-gmt-nc3-2.2.3.tar.gz ( http://gmt.soest.hawaii.edu/ ,在 mirror 下选择日本的一个镜像 ) netcdf-3.6.3.tar.gz ( http://www.unidata.ucar.edu/downloads/netcdf/netcdf-3_6_3/index.jsp ) 注:下载时会有 gshhg-gmt-nc3-2.2.2.tar.gz 和 gshhg-gmt-nc4-2.2.2.tar.gz 两个文件,其分别对应 netcdf3 和 netcdf4 ,根据自己要安装的 netcdf 版本确定 gshhg 版本。 ① 安装 netcdf tar -zxvf netcdf-3.6.3.tar.gz // 解压 netcdf cd netcdf-3.6.3 // 进入 netcdf 文件夹 chmod +x configure //给 configure 文件添加执行属性,注意chmod改变文件权限是有限制的,它只能在linux分区下生效 ./configure --prefix=/opt/netcdf-3.6.3 //configure, prefix 指定 netcdf 的安装路径 make // 编译 netcdf sudo make install // 安装 netcdf ② 安装 GMT cd .. // 退回到 netcdf 上级目录 tar -jxvf gmt-4.5.9.tar.bz2 // 解压 GMT cd GMT4.5.9 // 进入 GMT 文件夹 ./configure --prefix=/opt/GMT 4.5.9 --enable-netcdf=/opt/netcdf-3.6.3/ // 配置 GMT 。 prefix 为 GMT 安装路径, --enable-netcdf 为前面 netcdf 的安装路径 make gmt // 编译 GMT 自己的可执行文件及库文件 make suppl // 编译其他人提供的 GMT 扩展包及库文件 sudo make install-gmt // 安装 GMT 自己的可执行文件 sudo make install-suppl // 安装 GMT 扩展包 sudo make install-data // 安装 GMT 数据,其实就是拷贝 share 目录 sudo make install-man // 其实是拷贝 man 到 share sudo make install-doc // 其实是拷贝 doc 到 share ③ 安装 GMT 所需要的海岸线数据 cd .. // 返回 GMT 上级目录 tar -jxvf gshhg-gmt-nc3-2.2.3.tar.bz2 // 解压 GMT 需要的海岸线数据 sudo cp -r gshhg-gmt-nc3-2.2.3 /opt/GMT 4.5.9 /share/coast // 拷贝数据,将所有文件拷贝到 share 下的 coast 目录中 ④ 修改环境变量 export PATH=/opt/GMT4.5.9/bin:$PATH export MANPATH=/opt/GMT4.5.9/man:$MANPATH export LD_LIBRARY_PATH=/opt/GMT4.5.9/lib:$LD_LIBRARY_PATH export NETCDFHOME=/opt/netcdf-3.6.3 注意: 1、安装和使用最好都是在root身份下进行,Ubuntu默认的隐藏root。具体root登入的方法请参见另一篇博文。实在不会root身份登入,也可以直接打开终端(快捷键 Ctrl+Alt+T)输入:su root;然后按照要求输入密码; 以上就完成了GMT的安装, 但是有一个问题我还没有解决,就是每次重新打开终端都需要再次执行第四步的修改环境变量,不然就不能使用GMT。这是需要解决的大问题,还在初学阶段。 修改(2014.2.23):上面问题的解决办法如下,如果是一般用户就在你的根目录(/home/chaoshu下),如果已经在root身份下登入就在root文件夹下(/root)查看--显示隐藏文件,打开一个系统启动文件.bashrc修改环境配置变量(其实就是把第四步写到该文件下,然后重启就可以了。) 2、 安装的 ubuntu 系统中安装 netcdf 时在 make 的过程中可能会出现一些错误并退出,这个并不影响 make install ,其实主要是不影响 GMT 的安装和使用。(我安装时出现了这个问题) 报错为: gcc: error trying to exec 'cc1plus': execvp: 没有那个文件或目录 make : *** 错误 1 原因:未安装 g++ 解决办法: sudo apt-get install g++ 注意:可能需要保证 gcc 和 g++ 的版本一致性 安装之后重新 make 就好
个人分类: GMT|8816 次阅读|0 个评论
GMT绘图:grdmask、grdmath与grdimage
热度 1 xinxiang 2014-1-23 23:08
在实际绘图中,对数据网格化后,会产生位于由原始数据点构成的测网外部的点的数据,这部分数据是不可靠的,往往需要屏蔽掉。本部分的目的是,根据测网外边界构成的闭合多边形产生网格化数据文件(其 Z 值为赋值),由此文件和根据原始数据生成的网格化文件做积,生成新的网格化文件,该文件特点是:在多边形外部可以为 0 或者 NAN (依赖于不同的赋值情况,也可为其它值),在多边形内部为某类值(如原始值,或其倍数),在多边形边上为某值(如原始值,或其倍数)。 grdmask :生成可以形成闭合多边形的网格。可以设置多边形外部、内部和边上点对应的数值,一般与 grdmath 组合使用。 grdmask pte.txt -Gfactor.nc -R100/119/28/45 -I0.05/0.05 -NNAN/1/1 grdmath factor.nc test.grd MUL = test_m.grd grdimage test_m.grd -R100/119/28/45 –Ba5 -Ccolor.cpt –Q gmt.ps 说明: grdmask 语句中, pte.txt 为构成多边形的节点文件, -G 指示输出文件名, -NNAN/1/1 设置多边形外部点处的值为 NAN ,多边形的边上及其内部为 1 。 grdmath 语句,两个网格化文件做乘积,由于 factor.nc 文件的特点,该语句的结果即生成了在多边形外部为 NAN ,在多边形边上和多边形内部为原 test.grd 文件中对应点处的数值,没有变化。
个人分类: GMT|21433 次阅读|8 个评论
Linux/Ubuntu环境下轻松安装配置GMT
POPOPOLAR 2014-1-13 12:45
第一步,安装GMT。 在终端中运行: apt-get install GMT 若提示权限不够则sudo -s获取权限。 第二步,配置环境变量。 进入主文件夹,Ctrl+H显示隐藏文件夹,然后打开.bashrc,在文档末尾添加如下三行,并保存退出。 注:这里三行代码用图片给出,是因为博客页面会误读部分代码导致显示错误,需要读者手动输入。 第三步,加载修改后的.bashrc文件。 在终端中运行: source ~/.bashrc 以上三步完成后,就能在Linux环境下使用GMT了。
9030 次阅读|0 个评论
北斗轨道图GMT源码已开放
zhoufcumt 2013-10-16 21:51
北斗轨道图GMT源码已开放,由于数据较大,附件上传受限,如果有需要,请发送邮件至zhouforme@cgu.org.cn。 效果图:
个人分类: GMT|3884 次阅读|0 个评论
[GMT][DOS][Win7]如何在DOS使用minmax为绘图命令确定范围
blazing216 2013-9-22 13:55
minmax -I1/100 example.dat 返回的是比前两列最大最小值略大的范围,同时也是-Rw/e/s/n的格式,便于其他绘图命令画图。 GMT Manpages给出的同时使用minmax和psxy的例子是 psxy 'minmax -I5 track.xy' track.xy -Jx1 -B5 -P track.ps 我将这个语句写到batch文件里,并把单引号改成了双引号,给出的错误是缺少-R的选项。可能是因为DOS把双引号内的内容直接当作字符串处理了。 通过对DOS命令的学习,找到一种解决方法,有点小饶,不过也能达到想要的效果。写出来,抛砖引玉,供大家参考。解决思路是 1. 将minmax的内容输出到一个文件中 minmax -Idx/dy example.dat temp.dat 2. 新建一个环境变量,将文件中的内容赋给它 set /p region= temp.dat 3. 在绘图命令中用region代替-R选项 psxy example.dat %region% -Jx4 -B10 example.ps 大功告成! 之后可以删掉temp.dat,如果你想的话。 del temp.dat
个人分类: GMT|5245 次阅读|0 个评论
GMT在centos下的安装
clrscr 2013-9-21 23:30
1.下载需要的文件,详见参考。 2.按参考安装文件,注意部分代码需要根据文件名不同修改。 note:在centos下export只会在当前shell下能使用GMT。 解决办法: 使用root账户打开/etc/profile文件,在文件末加入下面两行 export GMTHOME=/usr/local/GMT4.5.9 export PATH=\${GMTHOME}/bin:\$PATH 然后 source /etc/profile 参考: http://seisman.info/install-new-gmt-under-linux.html 2013/9/21 初稿 2013/9/21 增加note中解决办法 2013/9/21 修改由于缺少转义字符造成代码错误 2013/9/22 新建GMT分类并归入此分类 2013/10/3 修改写入/etc/profile文件内容 2013/10/10 修改内容 2013/10/11 更新参考链接
个人分类: GMT|2822 次阅读|0 个评论
GMT在Windows下的安装
clrscr 2013-9-21 18:48
1.GMT主页下载相应exe文件,注意区分32bit和64bit。 2.按照默认路径安装。 3.设置环境变量。 参考: http://blog.163.com/jey_df/blog/static/182550161201211308347301/ 2013/9/21 初稿 2013/9/22 将该文归入GMT分类
个人分类: GMT|3327 次阅读|0 个评论
full and high resolution coast and river data of GMT
shanbin 2013-7-11 12:04
We can download the relevant data from the official ftp of GMT The link is listed below ftp://ftp.soest.hawaii.edu/gmt/
个人分类: GMT学习|2157 次阅读|0 个评论
[转载]Linux 下GMT 4.5.9 安装
zhoufcumt 2013-6-7 21:41
转载自: http://seisman.blog.ustc.edu.cn/index.php/archives/515 ,根据自己情况稍微修改了下。 GMT 4.5.9于2013年1月1日正式发布,这个版本依然主要只是bug修订,值得关注的一点在于海岸线数据已经从原来的GSHHS变成了现在的GSHHG,因而安装GMT4.5.9所需要的文件包括以下三个,具体下载以及其他参见原来的文章。 下载安装所需要的三个文件,放在任意文件夹下,比如GMT gmt-4.5.9.tar.bz2 gshhg-gmt-nc3-2.2.2.tar.gz netcdf-3.6.3.tar.gz 注:你可能会看到gshhg-gmt-nc3-2.2.2.tar.gz和gshhg-gmt-nc4-2.2.2.tar.gz两个文件,其分别对应netcdf3和netcdf4,根据自己要安装的netcdf版本确定gshhg版本。 安装netcdf tar -zxvf netcdf-3.6.3.tar.gz //解压netcdf cd netcdf-3.6.3 //进入netcdf文件夹 ./configure --prefix=/opt/netcdf-3.6.3 //configure, prefix指定netcdf的安装路径 make //编译netcdf sudo make install //安装netcdf 安装GMT cd .. //退回到netcdf上级目录 tar -jxvf gmt-4.5.9.tar.bz2 //解压GMT cd GMT4.5.9 //进入GMT文件夹 ./configure --prefix=/opt/GMT-4.5.9 --enable-netcdf=/opt/netcdf-3.6.3/ //配置GMT。prefix为GMT安装路径,--enable-netcdf为前面netcdf的安装路径 make gmt //编译GMT自己的可执行文件及库文件 make suppl //编译其他人提供的GMT扩展包及库文件 sudo make install-gmt //安装GMT自己的可执行文件 sudo make install-suppl //安装GMT扩展包 sudo make install-data //安装GMT数据,其实就是拷贝share目录 sudo make install-man //其实是拷贝man到share sudo make install-doc //其实是拷贝doc到share 安装GMT所需要的海岸线数据 cd .. //返回GMT上级目录 tar -zxvf gshhg-gmt-nc3-2.2.2.tar.gz //解压GMT需要的海岸线数据 sudo cp gshhg-gmt-nc3-2.2.2/* /opt/GMT-4.5.9/share/coast //拷贝数据,将所有文件拷贝到share下的coast目录中 修改环境变量 # for GMT 4.5.9 PATH=/opt/GMT-4.5.9/bin:$PATH MANPATH=/opt/GMT-4.5.9/share/man:$MANPATH LD_LIBRARY_PATH=/opt/GMT-4.5.9/lib:$LD_LIBRARY_PATH
个人分类: GMT|3688 次阅读|0 个评论
GMT第三弹:时间序列的曲线图
热度 2 zhoufcumt 2013-5-31 20:25
本例的脚本和数据文件会在下方提供下载,可根据类似格式和熟读脚本写出你想要的时间序列图,当然matlab可以搞定的,但是既然选择了GMT就要尽量多熟练掌握她的应用吧,GMT == give u surprises in any time, as u know。 NOTE: 如果有更好的建议或者改进请及时通知原作者 zhouforme@gmail.com。 脚本: #!/bin/bash # # Purpose: Plot residuals # Author : Feng Zhou # Date : 2013-05-31 # outps=ats_resi.eps ORI=-P # plot North # plot a line on zero psxy ! -R2001.5/2007.5/-10/10 -JX16.0/7.0 -X2.0 -Y16.7 -K $ORI -W1/200/200/200 -V \ -Ba1.0f0.5/a2.0f1.0sWne $outps 2001.50 0.00 2007.50 0.00 ! # plot ats residual : red line cat $1 | grep -v \* | awk '{print $1, $3, 0.1}' | \ psxy -R -J -K -O $ORI -W2/255/0/0 -V $outps # put text pstext ! -H0 -JX -R -O -K -V $ORI $outps 2001.75 -8 13 0 1 1 N(mm) ! # plot East # plot a line on zero psxy ! -R2001.5/2007.5/-10/10 -JX16.0/7.0 -X0.0 -Y-7.0 -O -K $ORI -W1/200/200/200 -V \ -Ba1.0f0.5/a2.0f1.0sWne $outps 2001.50 0.00 2007.50 0.00 ! # plot ats residual : red line cat $1 | grep -v \* | awk '{print $1, $2, 0.1}' | \ psxy -R -J -K -O $ORI -W2/0/255/0 -V $outps # put text pstext ! -H0 -JX -R -O -K -V $ORI $outps 2001.75 -8 13 0 1 1 E(mm) ! # plot Up # plot a line on zero psxy ! -R2001.5/2007.5/-30/30 -JX16.0/7.0 -X0.0 -Y-7.0 -K -O $ORI -W1/200/200/200 -V \ -Ba1.0f0.5/a5.0f2.5SWne $outps 2001.50 0.00 2007.50 0.00 ! # plot ats residual : red line cat $1 | grep -v \* | awk '{print $1, $7, 0.1}' | \ psxy -R -J -K -O $ORI -W2/0/0/255 -V $outps # put text pstext ! -H0 -JX -R -O -V $ORI $outps 2001.75 -25 13 0 1 1 U(mm) ! # Convert EPS to PNG ps2raster $outps -A -P -Tg # Clean up after ourselves: rm -f .gmt* 效果图: 脚本和数据文件附件: ats_resi.gmt albh_resi.neu
个人分类: GMT|9979 次阅读|5 个评论
咱们的导航定位系统--北斗的轨道图
热度 2 zhoufcumt 2013-5-30 21:42
终于搞定了北斗轨道图,看着感觉不错,GMT的成图效果真好!
个人分类: GMT|4429 次阅读|5 个评论
GMT第二弹:全球站点分布图
热度 2 zhoufcumt 2013-5-29 22:18
全球站点分布图和区域站点分布图类似: NOTE: 如果有更好的建议或者改进请及时通知原作者 zhouforme@gmail.com。 脚本: #!/bin/bash # # Purpose: Plot IGS sites in China # Author : Feng Zhou # Date : 2012-12-10 # ps=igs_global.eps ORI= gmtset ANNOT_FONT_SIZE_PRIMARY 10 PLOT_DEGREE_FORMAT ddd:mm:ssF pscoast -Rg-180/180/-90/90 -JX10i/6i -Ba30f15/a30f15WenS -Dh -A5000 \ -G219/235/199 -S130/199/240 -W0 -K $ORI $ps cat $1 | awk '{print $2, $3}' | psxy -R -J -O -Sc0.15 -Gred -Wthinnest $ps # Clean up after ourselves: rm -f .gmt* 脚本和数据文件下载: igs_global.gmt igs_global.list 效果图:
个人分类: GMT|4364 次阅读|3 个评论
GMT第一弹:区域站点分布图
热度 2 zhoufcumt 2013-5-29 20:40
GMT博大精深,功能强大,我也算是一个刚入门的初学者,希望能将我的学习GMT的经历与大家分享,希望能帮助到没有头绪的初学者,当然对于GMT的高手,我也希望GMTer们能多多交流,共同提高。 NOTE: 如果有更好的建议或者改进请及时通知原作者 zhouforme@gmail.com。 主要针对中国地区IGS站分布图 GMT脚本(igs_cn.gmt): #!/bin/bash # # Purpose: Plot IGS sites in China # Author : Feng Zhou # Date : 2012-12-10 # ps=igs_cn.eps gmtset HEADER_FONT_SIZE 10 X_ORIGIN 4c Y_ORIGIN 8c \ ANNOT_FONT_SIZE_PRIMARY 6 FRAME_WIDTH 0.05c pscoast -R70/140/15/55 -JM5i -Glightyellow -Slightblue -UMade by Feng Zhou -A1000 \ -Ba10f5/5:.IGS Stations in China: -K -Dh -N1/1p -Wthinnest -P $ps cat $1 | awk '{print $1, $2}' | psxy -R -J -O -Sc0.15 -Gred -Wthinnest $ps # Clean up after ourselves: rm -f .gmt* NOTE:$1是可执行脚本后面带的参数,比如本例子./igs_cn.gmt igs_cn.list这样才可以正确运行。 数据文件(igs_cn.list): 115.89 39.61 BJFS LM 121.20 31.10 SHAO LM 114.36 30.53 WUHN LM 87.60 43.81 URUM LM 125.44 43.79 CHAN LM 109.22 34.37 XIAN RM 102.80 25.03 KUNM LM 91.10 29.66 LHAZ LM 87.18 43.47 GUAO RM NOTE:格式为经度,纬度(北纬为正,南纬为负),站点名,站点名与本例子的圆圈表示的相对位置 LM-left middle 效果图如下: 上面的例子画出来的没有站点名(针对很多个站点的时候比较好),如果站点数不多,想加上站点名,数据文件不变,脚本需要改变一下。 改后脚本: #!/bin/bash # # Purpose: Plot IGS sites in China # Author : Feng Zhou # Date : 2012-12-10 # ps=igsname_cn.eps gmtset HEADER_FONT_SIZE 10 X_ORIGIN 4c Y_ORIGIN 8c \ ANNOT_FONT_SIZE_PRIMARY 6 FRAME_WIDTH 0.05c pscoast -R70/140/15/55 -JM5i -Glightyellow -Slightblue -UMade by Feng Zhou -A1000 \ -Ba10f5/5:.IGS Stations in China: -K -Dh -N1/1p -Wthinnest -P $ps cat $1 | awk '{print $1, $2}' | psxy -R -J -O -K -Sc0.15 -Gred -Wthinnest $ps cat $1 | awk '{print $1, $2, 5, 0, 5, $4, $3}' | pstext -R -J -O -Dj0.15/0 -Gred -N $ps # Clean up after ourselves: rm -f .gmt* 效果图: 注明:由于上述脚本出现了问题,因此上传脚本和数据文件,供大家下载。 igs_cn.list igsname_cn.gmt igsnoname_cn.gmt
个人分类: GMT|6578 次阅读|2 个评论
GMT的中文支持
chchao 2013-5-21 11:18
一直以为GMT中不能使用中文,只能用AI等软件进行后期加工。 受下面两篇博文的启发,成功设置GMT中的中文支持,没想到经过简单的设置后也可以直接使用中文。 博文地址: http://xxqhome.blog.163.com/blog/static/1967330202011112810120598/ http://hi.baidu.com/guyueshuiming/item/0052df53852ee4494fff20c3 以下设置在Ubuntu下试验成功,具体方法如下: 1、将字体文件从Windows下拷到Linux下的目录中(如/usr/share/fonts/winFonts) 2、处用gs命令和mkcidfm.ps形成cidfmap 如 sudo gs -q -dBATCH -sFONTDIR=/usr/share/fonts/winFonts -sCIDFMAP=/usr/share/ghostscript/9.04/Resource/Init/FAPIcidfmap /usr/share/ghostscript/9.04/lib/mkcidfm.ps 注意这里的FAPIcidfmap随不同的ghostscript版本,位置有可能不同,文件名也可能会不同(如可能为cidfmap) 3、根据FAPIcidfmap文件中的信息,修改GMT中的字体配置文件 PS_font_info.d(一般在$GMT_SHARE/pslib下),在后面添加 NSimSun--GB-EUC-H 0.700 1 SimHei--GB-EUC-H 0.700 1 KaiTi--GB-EUC-H 0.700 1 LiSu--GB-EUC-H 0.700 1 FangSong--GB-EUC-H 0.700 1 YouYuan--GB-EUC-H 0.700 1 MicrosoftYaHei--GB-EUC-H 0.700 1 MicrosoftYaHeiBold--GB-EUC-H 0.700 1 注意:一定要在字体名称后面加上 --GB-EUC-H ,否则不能正常显示 4、用pstext -L查看字体对应的数字编码,如 35 STSong-Light--GB-EUC-H 36 STFangsong-Light--GB-EUC-H 37 STHeiti-Regular--GB-EUC-H 38 STKaiti-Regular--GB-EUC-H 5、在GMT脚本中,需插入中文的地方用如下命令 @%font_no% 中文 @%% 如需使用楷体,根据上面的字体编码,楷体对应字体编码为38,则形式为 @%38% 我是中文 @%% 注意:文件的编码方式要保存为 gb18030,utf-8编码显示不正常,不知道其它系统上是否是这样?
8324 次阅读|0 个评论
在RedHat Linux下安装GMT
cambaluc 2013-5-10 12:22
再安装了一次GMT。因linux用的少,有的配置还是模糊,所以还是记录一下吧,万一有再装的可参考。 先装NetCDF 先用root用户登录,mkdir /usr/local/netcdf,tar xvfz netcdf-4.4.1.1.tar.gz,cd netcdf-4.2.1.1, ./configure --prefix=/usr/local/netcdf --disable-netcdf-4,make check install,make,make install 再用自己的用户名登录,改文件./home/kj/.bash_profile,(可用ls -a|grep bash找该文件), 加PATH=$PATH:/usr/local/netcdf/bin export NETCDF=/usr/local/netcdf 装GMT,先用root用户 tar -jxvf gmt-4.5.8.tar.bz2,tar -jxvf gmt-4.5.8-non-gpl.tar.bz2,mkdir /usr/local/GMT ./configure --prefix=/usr/local/GMT --enable-netcdf=/usr/local/netcdf, make,make install,cp -r share/ /usr/local/GMT 再用自己的用户, export GMTHOME=/usr/local/GMT, export PATH=/usr/local/GMT/bin:$PATH,source ~/.bashrc 再解压三个海岸线文件 tar -jxvf GSHHS2.2.0_high.tar.bz2及_full,_high,拷到/usr/local/GMT/share/coast/(可用root权限) 试一下:pscoast -R0/360/-90/90 JG280/30/6i -Bg30/g15 -Dc -A5000 -G255/255/255 -S150/50/150 -Pmap.ps 命令来自《能用地学制图工具GMT入门百度文库》 改改参数可绘出下图:
4288 次阅读|0 个评论
Graphic Mapping Tool(GMT)
Master123 2013-4-24 10:06
http://gmt.soest.hawaii.edu/
个人分类: GMT|2361 次阅读|0 个评论
GMT中的project命令
热度 1 zhanggw 2013-2-21 10:26
project命令还是很好用的,比如可以将一个矩形区域内的地震投影到剖面上 project tt.reloc -C${center} -A${azimuth} -Fxyzpqrs -Q -W${width} -L${length} -V ! tang.tmp 只需要设定好中心点,宽度及长度,方位角,-F选项也要注意,设置参数不同,输出的数据格式也不同 任意角度的剖面图投影,就很容易了。
个人分类: SOFT|5727 次阅读|1 个评论
GRDCONTOUR and GRDMATH (GMT)-Plot event map
热度 1 shenxzh 2013-1-27 13:09
gmtset FRAME_PEN 1.0p gmtset FRAME_WIDTH 0.1c gmtset HEADER_FONT 5 gmtset LABEL_FONT 5 gmtset HEADER_FONT_SIZE 10 gmtset LABEL_FONT_SIZE 12 gmtset ANOT_FONT_SIZE 10 gmtset BASEMAP_TYPE plain gmtset TICK_LENGTH -0.1c gmtset TICK_PEN 1.0p gmtset LABEL_OFFSET 0.1c gmtset MAP_TITLE_OFFSET 5p set ps=yuanzhen.ps set scale=2.4e8 set eq=eq.txt set lon=103.6 set lat=36.0 rem grdmath -R-180/180/2/4 -I6/0.1 X 4 MUL PI MUL 180 DIV COS Y 2 POW MUL = dist.nc grdmath -Rg -I1 %lon% %lat% SDIST = dist.nc grdmath -Rg -I1 %lon% %lat% SBAZ = baz.nc rem grdmath -Rg -I1 %lon% %lat% SDIST = dist.nc rem pscoast -R-180/180/-90/90 -Je103.6/36/1:%scale% -B30g30 -Ggray -K -A2500 -Dh -X3.5i -Y1.25i %ps% pscoast -R0/360/-90/90 -Je103.6/36/1:%scale% -I2/0.25p,blue -N1/0.25p -W0.25p,white -Ggreen -Sblue -K -A2500 -Dh -X3.0i -Y1.1i %ps% rem pscoast -R-180/180/-90/90 -JA103.6/36/6i -I2/0.25p,blue -N1/0.25p -W0.25p,white -Ggreen -Sblue -K -A2500 -Dh -X3.0i -Y1.1i %ps% rem pscoast -R-180/180/2/4 -JP6i -I2/0.25p,blue -N1/0.25p -W0.25p,white -Ggreen -Sblue -K -A2500 -Dh -X3.5i -Y1.25i %ps% grdcontour dist.nc -A60 -C30 -S8 -K -O -R -J -Wathick,black -Wcthin,black %ps% rem grdcontour dist.nc -B30Ns -P -C2 -S4 --PLOT_DEGREE_FORMAT=+ddd %ps% grdcontour baz.nc -C45 -S8 -K -O -R -J -Wcthicker,white,- %ps% rem grdcontour dist.nc -A15+u+fblack -S8 -O -K -J -Wathin,black %ps% gawk "{print $1,$2,$3*$3*$3/1000}" %eq% |psxy -: -R -J -O -K -Sc -Gred -Wthinnest %ps% rem psxy -: %eq% -R -J -O -K -Sc0.08 -Gblack -Wthinnest %ps% echo %lon% %lat% | psxy -R -J -O -K -St0.7 -Gblack -Wthin %ps% pause del dist.nc .gmt*
个人分类: Resear note|6987 次阅读|2 个评论
GAMIT 中 error: GMT Warning: Old GMT 3 .gmtdefaults 解决方案
zhangyong1361 2013-1-4 16:26
GAMIT 中 error: GMT Warning: Old GMT 3 .gmtdefaults 解决方案
error: GMT Warning: Old GMT 3 .gmtdefaults file found. May not be fully compatible with GMT 4. GMT Warning: It is recommended that you migrate your GMT 3 settings to GMT 4 settings. 环境说明: 系统:Ubuntu 10.04 LTS GAMIT/GLOBK版本: 10.4(更新到20120824) GMT版本:4.5.1(通过 apt-get install gmt 安装的) 出现的问题文中开头所述,问题原因是存在旧的配置文件,解决思路指定正确的配置文件。 具体解决方法: 1、在GAMIT解算完后生成的DOY目录下,按 “Ctrl+H”显示隐藏文件,找到“.gmtdefaults4”文件。 2、在任何地方启动终端,输入"gmtdefaults -D ~/.gmtdefaults4" 意思是指定GMT默认配置文件为主文件夹下的.gmtdefaults4文件。 3、将第一步中找到的文件复制到主文件夹下,覆盖原文件。 4、打开主文件夹的.gmtdefaults4文件,设置里面的PAPER_MEDIA= a4,保存即可。 配置完后就不会出现之前的错误了,并且绘图成功且美观。如下图: 坐标重复性图: 基线重复性图: wrnm图: 对流层延迟图(总的 Fiexd): 如有问题可以联系交流,E-mail:zhangyong1361@163.com 张勇 2013-01-04
个人分类: GAMIT/GLOBK|5617 次阅读|0 个评论
[转载]GMT绘制震源球:psmeca
热度 1 cgh 2012-12-19 08:43
GMT绘制震源球:psmeca Plot seismological symbols on maps 用法:psmeca infiles -Jparams -Rwest/east/south/north -Sformatscale ] ] ] ] ] x_shift ] x_shift ] ]] 下面对一些特别的选项做下介绍: -C 在绘制震源球时,GMT会首先在震源处(经纬度由infiles给定)绘制一个小圆,然后用直线连接震源与震源球, pen指定线属性,包括宽度、颜色、线型等,pointsize指定小圆的大小。 -D只绘制某一深度范围之内的震源球 -E、-G 指定了震源球压缩、拉伸部分的颜色,默认压缩部分为黑色,拉伸部分为白色 -L 绘制震源球轮廓 -M所有震级的震源球大小相同,大小由-S给出 -N不要跳过那些震源球落在图形边界外的 -r 在文本周围绘制框 -S指定输入文件格式以及震源球大小 (c) Focal mechanisms in Harvard CMT convention X, Y, depth, strike1, dip1, rake1, strike2, dip2, rake2, moment, newX, newY, event_title (a) Focal mechanism in Aki Richard's convention: X, Y, depth, strike, dip, rake, mag, newX, newY, event_title (p) Focal mechanism defined with X, Y, depth, strike1, dip1, strike2, fault, mag, newX, newY, event_title fault = -1/+1 for a normal/inverse fault (m) Sesmic moment tensor (Harvard CMT, with zero trace) X, Y, depth, mrr, mtt, mff, mrt, mrf, mtf, exp, newX, newY, event_title (z) Anisotropic part of seismic moment tensor (Harvard CMT, with zero trace) X, Y, depth, mrr, mtt, mff, mrt, mrf, mtf, exp, event_title (d) Best double couple defined from seismic moment tensor (Harvard CMT, with zero trace) X, Y, depth, mrr, mtt, mff, mrt, mrf, mtf, exp, newX, newY, event_title (x) Principal axis X, Y, depth, T_value, T_azim, T_plunge, N_value, N_azim, N_plunge P_value, P_azim, P_plunge, exp, newX, newY, event_title (t) Zero trace moment tensor defined from principal axis X, Y, depth, T_value, T_azim, T_plunge, N_value, N_azim, N_plunge P_value, P_azim, P_plunge, exp, newX, newY, event_title (y) Best double couple defined from principal axis X, Y, depth, T_value, T_azim, T_plunge, N_value, N_azim, N_plunge P_value, P_azim, P_plunge, exp, newX, newY, event_title -Tn plane n=1: 画第一个节点平面 n=2:画第二个节点平面 n=3:两个都画 ------------------------------------------------------------------------------------------- 实例: #!/bin/bash #This script is used to plot a focal mechanisms on maps PS=meca.ps LON=80 LAT=35 psbasemap -Rg -JE$LON/$LAT/180/6i -B:".GCMT": -K -P ${PS} pscoast -Rg -J -B -Dc -A10000 -Wthin -G200 -K -P -O ${PS} #plot mechanism psmeca -Rg -JE$LON/$LAT/180/6i -Sm1 -T0 -W1p -K -O -P EOF ${PS} -26.55 -60.71 24 1.06 -0.24 -0.82 0.09 0.64 -0.62 26 -26.55 -60.71 200904161457A EOF 效果图 -------------------------------------------------- 震源机制解文件可以以多种方式输入,不做震源所以很多参数都不知道什么意思,自己写震源机制解文件有困难。GlobalCMT可以将catlog导出为GMTpsmeca所需要的格式,对应-Sz选项,可参考之。 参见 http://www.globalcmt.org/CMTsearch.html http://blog.sina.com.cn/s/blog_872ecf9f0100vysp.html
个人分类: Linux|8112 次阅读|1 个评论
[转载]画震源机制剖面的GMT工具:pscoupe
热度 2 cgh 2012-12-19 08:37
画震源机制剖面的GMT工具:pscoupe画震源机制剖面的GMT工具,也可以画其他类似东西的剖面,比如地震深度剖面。 语法: pscoupe files −J parameters −R west / east / south / north −A parameters parameters ] ] ] ] ] ] ] ] ] ] ]] ] ] GMT的震源机制工具,比如psmeca, pscoupe一般默认是绘下半球投影。还要注意的是在利用pscoupe绘震源机制剖面的时候投影面是不同于平面上的。 -J 控制投影方式 -R 坐标范围 -A 选择剖面 -Aa lon1/lat1/lon2/lat2/dip/p_width/dmin/dmax lon1,lat1,lon2,lat2分别是两个端点的经纬度 dip是投影平面的倾角 p_width是投影剖面两侧的宽度 dmin和dmax是距离水平面最小和最大的距离 加上f可以获得框格 −Ab lon1/lat1/strike/p_length/dip/p_width/dmin/dmax −Ac x1/y1/x2/y2/dip/p_width/dmin/dmax 类似于-Aa,但用于笛卡尔坐标系下 −Ad x1/y1/strike/p_length/dip/p_width/dmin/dmax 类似于-Ab,但用于笛卡尔坐标系下 -S 选择数据文件 −Sa scale ]] 用于AKI的震源机制约定,第1~10列分别为经度、纬度、深度、走向、倾角、滑动角、震级、 0、 0、文字说明 −Sc scale 用于哈佛的震源机制约定,第1~14列分别为经度、纬度、深度、节面1的走向、倾角、滑动角、节面2的走向、倾角、滑动角、地震矩的小数和指数部分、0、0、文字说明 −Sp scale ]] 当只有部分震源机制解参数的时候,可用这个。第1~11列分别为经度、纬度、深度、节面1的走向、倾角、节面2走向、+1(逆断层)/-1(正断层)、震级、0、0、文字说明 −Sm|d|z scale ]] 用于绘地震矩张量解。第1~13列分别为经度、纬度、深度、mrr, mtt, mff, mrt, mrf, mtf in 10*exponent dynes-cm、指数部分、0、0、文字说明 −Sx scale ]] 用于已知力轴参数来绘震源机制解。第1~16列分别为经度、纬度、深度、value (in 10*exponent dynes-cm), azimuth, plunge of the T, N, and P axes、指数部分、0、0、文字说明 −s symbol ]] 用其他图形来替代震源机制球。第1~4列分别为经度、纬度、深度、说明。 -B 设置边框刻度 −E fill 膨胀象限的颜色设定 −G fill 压缩象限的颜色 −L 画笔属性 −M 忽略震级大小 −T 控制所绘节面的数量,0-两个节面都绘,1-节面1,2-节面2,默认是0 −a ]],计算并绘P、T轴的位置,符号类型有:( c ) circle, ( d ) diamond, ( h ) hexagon, ( i ) inverse triangle, ( p )point, ( s ) square, ( t ) triangle, ( x ) cross. −e fill 填充T轴 −g fill 填充P轴 http://hi.baidu.com/purplepool/item/4d2a961493945e4ee75e0617
个人分类: Linux|10026 次阅读|10 个评论
GMT 5.0.0b的安装方法
热度 1 Master123 2012-10-20 21:05
在网上能够搜索到的一些同行的博文: (1)GMT5.0在Linux环境下的安装 http://blog.163.com/jey_df/blog/static/18255016120111111104913536/ (2) win7下安装Cygwin/GMT5.0成功 http://xxqhome.blog.163.com/blog/static/1967330202011101573237365/ (3)GMT(the Generic Mapping tools)下载最简单的安装 http://bbs.sciencenet.cn/forum.php?mod=viewthreadtid=535676page=1 这些方法感觉要么程序繁琐,要么文件太多。现在GMT 5.0.0b已经提供了windows版本的下载,为什么不直接下载安装呢?(也许在Linux或其他版本下另有好处,我还不知道) 点击链接 http://www.soest.hawaii.edu/gmt5/ 点击左侧"DOWNLOAD",在右侧高亮显示的字体中选择“ GMT Windows ”,网页下方找到gmt-5.0.0b_install32.exe下载,然后安装后重启。可以在命令行里输入pscoast试一下。
个人分类: GMT|6180 次阅读|1 个评论
简单的GMT安装方式
热度 1 peluo 2012-7-27 14:25
采用sudo apt-get install gmt安装,系统会自动安装其需要的NetCDF库等,默认将NetCDF库安装在usr/lib中,gmt安装在usr/lib/gmt路径下,因此安装完成后可以在.bashrc中这样设置环境变量: export NETCDFHOME="/usr/lib" export GMTHOME="/usr/lib/gmt" export PATH="$PATH:$GMTHOME/bin"
个人分类: Linux|5040 次阅读|1 个评论
GMT 在地图上绘制线条
热度 1 xinxiang 2011-5-18 17:11
曾经因为画断层图而郁闷了很久,最后发现gmt可以干这事。 使用psxy画点,同时将相邻的两点连接成线即可,关键在于如何把很多不同的线条区分开,具体命令如下: psxy fault.dat -JM -R -O -K -Wred -M'370' test.ps 命令解释:fault.dat 包含要画的数据点的坐标文件。其中隐含着绘图的关键:’370‘。每条线之间使用370隔开,如: -115.4 35.3 第一条线的终点坐标 370 -118.4 40.4 第二条线的起始点坐标 如果中间没有370隔开,那么所有的点都会连接在一起。 当然,370是个人定义的标志,也可以换成其他的。 下面是自己画的加利福尼亚地区的断层线图,断层线条和州的边界线条没有区分,都是黑色的。
个人分类: GMT|25126 次阅读|2 个评论
[转载]Windows XP下安装GMT
热度 1 zheyang 2011-3-23 15:53
GMT − The Generic Mapping Tools data processing and display software package GMT is a collection of public-domain Unix tools that allows you to manipulate x,y and x,y,z data sets (filtering, trend fitting, gridding, projecting, etc.) and produce PostScript illustrations ranging from simple x-y plots, via contour maps, to artificially illuminated surfaces and 3-D perspective views in black/white or full color. Linear, log10, and power scaling is supported in addition to 25 common map projections. The processing and display routines within GMT are completely general and will handle any (x,y) or (x,y,z) data as input.Significantly improved versions (3.1-3.3, 3.3.1-6), 3.4, 3.4.1-5, and 4.0-4.5.3 were released between November 1998 and July 2010, culminating in the Mar 2011 introduction of 4.5.6. GMT now is used by 15,000 users worldwide in a broad range of disciplines. The homepage of GMT is http://www.soest.hawaii.edu/gmt/ The installation for windowsis as follows: Reprint from the website 1.准备文件如下 (文件下载网址:http://gmt.soest.hawaii.edu/) netcdf-4.1.1 GMT_basic_install.exe GMT_pdf_install.exe GSHHS_highfull_install.exe 2.执行安装以下文件 (以安装到D盘为例) GMT_basic_install.exe GMT_pdf_install.exe GSHHS_highfull_install.exe 此时会在D:\GMT目录下产生有以下文件夹:bin include lib share 3.把netcdf-4.1.1文件拷到D:\GMT目录下 (解压netcdf 后的文件) 4.把D:\GMT\share下所有 *.d; *.cdf; *.ps 文件及conf文件夹下的所有文件拷到D:\GMT目录下 5.在D:\GMT目录下创建gmt.bat文件 目的:设置GMTHOME,HOME 和 NETCDF,修改PATH,LIB,INCLUDE下面是gmt.bat文件的内容,拷贝下来再,保存为gmt.bat, 然后根据自己的情况加以修改,这里以上面创建的目录为例。 gmt.bat文件的内容如下: ECHO OFF REM ---------------------------------------------------- REM REM @(#)gmtenv.bat 1.10 03/08/00 REM REM Copyright (c) 1991-2000 by P. Wessel and W. H. F. Smith REM See COPYING file for copying and redistribution conditions. REM REM This program is free software; you can redistribute it and/or modify REM it under the terms of the GNU General Public License as published by REM the Free Software Foundation; version 2 of the License. REM REM This program is distributed in the hope that it will be useful, REM but WITHOUT ANY WARRANTY; without even the implied warranty of REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the REM GNU General Public License for more details. REM REM Contact info: www.soest.hawaii.edu/gmt REM -------------------------------------------------------------------- REM REM Sets the GMT environment needed under WinXP. REM REM Author: Paul Wessel, 07-MAR-2000 REM REM ---------------------------------------------------- REM Set NETCDF, GMTHOME, and HOME: REM ---------------------------------------------------- SET NETCDF=d:\GMT\netcdf-4.1.1 SET GMTHOME=d:\GMT SET HOME=d:\GMT REM ---------------------------------------------------- REM Must set INCLUDE and LIB if GMT source is to be used REM OR compiled. If not, REM these lines out. REM ---------------------------------------------------- SET INCLUDE=%INCLUDE%;%NETCDF%\INCLUDE SET LIB=%LIB%;%NETCDF%\LIB;%GMTHOME%\LIB REM ---------------------------------------------------- REM STOP HERE, Now appending to PATH: REM ---------------------------------------------------- SET PATH=%PATH%;%GMTHOME%\BIN;%NETCDF%\LIB REM ---------------------------------------------------- ECHO GMT 4.5.2 Environment initialized doskey 6.进入DOS,在DOS下进入D:\GMT执行gmt.bat,显示如下: D:\GMTgmt.bat D:\GMTECHO OFF GMT 4.5.2 Environment initialized 此时可输入一个命令psxy等进行测试,如果出现此命令的说明,则表示成功了。 7.此外gawk也是window下常用程序,可以在下面网站下载 http://gnuwin32.sourceforge.net/packages/gawk.htm 下载后,安装在D:\GMT 目录下(可以安装在任何目录下),只要把D:\GMT\GnuWin32\bin下面的所有文件拷贝到 D:\GMT\bin 下就可以了。 8.PS查看器ghostview的安装 在安装Ghostview前先安装Ghostscript,这两个软件都可以网上自由获取 http://pages.cs.wisc.edu/~ghost/ 按先后顺序依次安装,可以安装在任何一个文件夹。安装后把gs\gs8.63\bin 下的gswin32.exe可执行文件和Ghostgum\gsview下的gsview32.exe可执行文件拷贝到D:\GMT\bin 下即可。 近来初学GMT软件,在Win下先尝试安装了该软件,安装过程中借鉴了很多网上分享的资料,对一些作者表示感谢。
个人分类: 转载|2681 次阅读|0 个评论
Lectures on Varifolds
zjzhang 2009-9-28 22:28
Chapter 4 Theory of Rectifiable n-Varifolds 15 Basic Definitions and Properties 16 First Variation 17 Monotonicity Formula And Basic Consequences 18 Pioncare and Sobolev Inequalities 19 Miscellaneous Additional Consequences Of the Mo This is done when I was suffering lecturing Geometric Measure Theory by Leon Simon. Chapter 5 is devoted to Allard regularity theory, but I've no time to input it in a Latex form.
个人分类: 数学|3655 次阅读|0 个评论
GMT 及Win4GMT简介及其安装技巧
热度 1 kiger 2009-9-19 17:17
GMT-The Generic Mapping Tools ,即通用制图工具,是一个开源的工具集,主要用于 XY 和 XYZ 数据的处理和显示,包括栅格化、过滤和各种地图投影等操作。 GMT 最初是由哥伦比亚大学的两位毕业生 Paul Wessel 和 Walter H. F. Smith 于 1988 年创建的,至今已经发展到版本 4.5.0 。 经过这段时间的了解,感觉该软件主要有以下几个优点:( 1 )完全免费;( 2 )源代码是开放的,可以进行二次开发;( 3 )可以在多种系统下安装和使用,如 UNIX , Linux , MkLinux , Mac OS 9 , Windows 和 OS/2 ,但是每个系统下的安装要求是不一样的;(4) GMT 好比一个工具箱,每个工具之间相对独立,操作起来更为灵活,这也是 GMT 研究小组的一个特别考虑;( 5 )有很多免费数据资源都可以被 GMT 调用,尤其是 NOAA , USGS , NGDC , NEIC 等;( 6 )制作出来的图形图像精美,感觉比 ArcGis 和 MapGis 等软件成图的效果要好。正是由于以上诸多优点,该软件已经被较为广泛应用于医学,工程,物理,数学,地球科学,社会科学等领域。 由于该软件的最初是在 UNIX 系统上发展的,所以对于初学者来说早期的版本安装和使用方面还是有点麻烦的,我也是学习第一次安装该软件,经过摸索,终于在 Windows XP 系统下安装成功。习惯了 Windows 操作的人来说,突然要用 DOS 操作,确实需要一段时间的适应,故可以安装一个 GUI (图形交互界面)软件 Win4GMT 。具体安装过程如下: 1. Install GMT 3 (E g : C : \GMT\ ) . As you will see GMT3 programs will be installed in C : \GMT\ bin and rivers, border, shorelines, patterns etc in C:\GMT\share\coast and gmtenv.bat in C : \GMT\ ( Note: I n GMT 4 .5.0 , gmtenv.bat cant be need any more, and the installer has done the work and set the path. ) 2. S et Home: Modify gmtenv.bat with an ASCII editor in order to set your home dir . SET NETCDF= C : \GMT\ SET GMTHOME= C : \GMT\ SET HOME= C : \ USERS \ USERS \ PROJECTS or C :\ GMT \ TEMP SET PATH=%PATH%; %GMTHOME%\BIN; %NETCDF%\LIB 3. R un cmd command to open this window i n a DOS window . I n GMT 4 .5.0 , .gmtdefaults is created by default in C : \ GMT \bin, you should copy it to C : \GMT\. Then c lose the window . 4. if necessary, install Ghostsview or other postscript viewer or editor . 5. Put netcdf.dll in C : \GMT\. 6. Unzip the Win4GMT and r un setup.exe to install it . To avoid problems , Please install Win4GMT in the GMT Home Directory ( C : \GMT ). 7. Reboot the computer . 8. Configure folders in Preferences menu when starts the program or edit win4gmt.ini in C:\WINDOWS or C:\WINNT folder . Notes: Setup will create a subdirectory ( man ) where will be installed the html version of the GMT manuals. If you have problems with OLEAUT32.DLL (in some cases, problems has been reported) . R ename your oleaut32.dll (just in case) and copy the ftp file in your system directory ( C : \WINDOWS\S ystem) . Then r estart the computer. 其它: GMT下载地址: http://gmt.soest.hawaii.edu/ Win4GMT下载地址: http://www.icm.csic.es/gma
个人分类: 学研心得|12043 次阅读|3 个评论
GMT中的 surface
wangchangzai 2009-8-12 15:31
gmt 中的surface---不完整 2008-05-21 23:34 在gmt中由xyz文件转到grid的文件有两个主要命令:xyz2grd, surface,前面已经提到xyz2grd,xyz2grd要求等间隔采样,有时候显得很不方便。而surface可以提供一个较好的方式 Adjustable tension continuous curvature surface gridding 可调整的曲线表面网格?由manual给出的解释是 A continuous curvature gridding algorithm 应该可以理解为曲率连续的网格插值算法,具体的例子在cookbook的6.14,6.16都有用到 主要选项: surface -Goutput_grdfile_name -Ixinc ] -Rwest/east/south/north ] ] ] ] ] ] ] -G 输出文件名 -xinc/yinc: 给出插值后的网格间隔 -R:指定坐标范围 -A: -Z:是插值的收敛标准 -L:?强行指定解的范围? without any modifiers indicate that x is longitude and periodic in 360: -L constrain the range of output values: -Lllimit specifies lower limit; forces solution to be = limit. -Lulimit specifies upper limit; forces solution to be = limit. limit can be any number, or the letter d for min (or max) input data value, or the filename of a grdfile with bounding values. . Example: -Ll0 gives a non-negative solution. -N sets max n_iterations in each cycle; default = 250. 设置每个圆的最大迭代数 -S 除非网格是病态的 sets search_radius to initialize grid; default = 0 will skip this step. This step is slow and not needed unless grid dimensions are pathological; i.e., have few or no common factors. Append m to give search_radius in minutes. -T adds Tension to the gridding equation; use a value between 0 and 1. default = 0 gives minimum curvature (smoothest; bicubic) solution. 1 gives a harmonic spline solution (local max/min occur only at data points). typically 0.25 or more is good for potential field (smooth) data; 0.75 or so for topography. Experiment. Append B or b to set tension in boundary conditions only; Append I or i to set tension in interior equations only; 关系到插值的结果?详情见cookboo 6.16图 -Z sets over_relaxation parameter. Default = 1.4 Use a value between 1 and 2. Larger number accelerates convergence but can be unstable. Use 1 if you want to be sure to have (slow) stable convergence. 控制收敛速度
个人分类: 生活点滴|14557 次阅读|0 个评论

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-13 17:36

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部