load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

begin

  cdf_file = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/contour.cdf","r")

  temp = cdf_file->T(0,0,:,:)               ; 变量temperature
Z = cdf_file->Z(0,0,:,:) ; 变量geopotential height
pres = cdf_file->Psl(0,:,:) ; 变量pressure at mean sea level
lat = cdf_file->lat ; 变量latitude
lon = cdf_file->lon ; 变量longitude temp = temp - 273.15 ; 温度转换 Kelvin -> Celsius
pres = pres * 0.01 ; 气压转换 Pa -> mb
temp@units = "(C)" ; 改变单位
pres@units = "(mb)" ; 改变单位 xwks = gsn_open_wks("x11","gsun02n") ; 打开x11的工作空间. plot = gsn_contour(xwks,temp,False) ; 绘制一个等值线图 ;----------- Begin second plot ----------------------------------------- resources = True ; 资源设置 resources@cnMonoLineColor = False ; 关闭绘制一种颜色的方案 resources@tiMainString = "Temperature (C)" ; 标题 plot = gsn_contour(xwks,temp,resources) ; 绘制等值线图 ;----------- Begin third plot ----------------------------------------- resources@cnFillOn = True ; 打开等值线图填充
resources@cnMonoFillPattern = False ; 关闭等值线图单线填充
resources@cnMonoFillColor = True
resources@cnMonoLineColor = True resources@tiXAxisString = lon@long_name
resources@tiYAxisString = lat@long_name
resources@sfXArray = lon
resources@sfYArray = lat plot = gsn_contour(xwks,temp,resources) ; 绘制等值线图 ;---------- Begin fourth plot ------------------------------------------ resources@cnMonoFillPattern = True ; 使用solid填充
resources@cnMonoFillColor = False ; 使用复杂颜色
resources@cnLineLabelsOn = False ; 线条标签
resources@cnInfoLabelOn = False ; 信息标签
resources@cnLinesOn = False ; 等值线 resources@pmLabelBarDisplayMode = "Always" ; 工具栏
resources@lbPerimOn = False ; 关闭周长 resources@tiMainString = Z@long_name
resources@tiMainFont = 26
resources@tiXAxisFont = 26
resources@tiYAxisFont = 26 plot = gsn_contour(xwks,Z,resources) ; 绘制等值线图 ;---------- Begin fifth plot ------------------------------------------ cmap = (/(/0.,0.,0./),(/1.,1.,1./),(/.1,.1,.1/),(/.15,.15,.15/),\
(/.2,.2,.2/),(/.25,.25,.25/),(/.3,.3,.3/),(/.35,.35,.35/),\
(/.4,.4,.4/),(/.45,.45,.45/),(/.5,.5,.5/),(/.55,.55,.55/),\
(/.6,.6,.6/),(/.65,.65,.65/),(/.7,.7,.7/),(/.75,.75,.75/),\
(/.8,.8,.8/),(/.85,.85,.85/)/) gsn_define_colormap(xwks,cmap) ; 定义一个新的颜色map resources@tiMainString = pres@long_name plot = gsn_contour(xwks,pres,resources) ; 绘制一个等值线图 print(temp(2:5,7:9)) ;输出temp变量 print(temp!0) ; 输出temp的一维名称
print(temp!1) ; 输出temp的二维名称
print(temp@long_name) ; 输出属性long_name和units
print(temp@units)
print(temp&lat) ; 输出变量lat
print(temp&lon) ; 输出变量lon ascii_file = "data.asc" ;创建ASC11文件名
system("/bin/rm -f " + ascii_file) ; 移除asc11文件
asciiwrite(ascii_file,temp(7:3:2,0:4)) ; 写入ASC11
delete(plot) ;清除
delete(temp)
delete(resources)
end

Example 2 - contour plots的更多相关文章

  1. 机器学习笔记(一)- from Andrew Ng的教学视频

    最近算是一段空闲期,不想荒废,记得之前有收藏一个机器学习的链接Andrew Ng的网易公开课,其中的overfiting部分做组会报告时涉及到了,这几天有时间决定把这部课程学完,好歹算是有个粗浅的认识 ...

  2. Matlab绘图基础——绘制等高线图

    % 等高线矩阵的获取 C = contourc(peaks(20),3);              % 获取3个等级的等高线矩阵 % 等高线图形的绘制 contour(peaks(20),10);c ...

  3. 学习笔记之Introduction to Data Visualization with Python | DataCamp

    Introduction to Data Visualization with Python | DataCamp https://www.datacamp.com/courses/introduct ...

  4. python绘制三维图

    作者:桂. 时间:2017-04-27  23:24:55 链接:http://www.cnblogs.com/xingshansi/p/6777945.html 本文仅仅梳理最基本的绘图方法. 一. ...

  5. 44-python-三维画图

    https://www.cnblogs.com/xingshansi/p/6777945.html python绘制三维图   作者:桂. 时间:2017-04-27  23:24:55 链接:htt ...

  6. R2—《R in Nutshell》 读书笔记(连载)

    R in Nutshell 前言 例子(nutshell包) 本书中的例子包括在nutshell的R包中,使用数据,需加载nutshell包 install.packages("nutshe ...

  7. Matplotlib Tutorial(译)

    Matplotlib Tutorial(译) 翻译自:Matplotlib tutorialNicolas P. Rougier - Euroscipy 2012 toc{: toc} 这个教程基于可 ...

  8. LaTeX绘图宏包 Pgfplots package

    Pgfplots package The pgfplots package is a powerful tool, based on tikz, dedicated to create scienti ...

  9. ML 线性回归Linear Regression

    线性回归 Linear Regression MOOC机器学习课程学习笔记 1 单变量线性回归Linear Regression with One Variable 1.1 模型表达Model Rep ...

随机推荐

  1. js 元素Dom新建并插入页面createElement

    纯js var o = document.createElement('script'); o.type = 'text/template'; o.id = 'demo'; document.docu ...

  2. ANDROID L——Material Design具体解释(主题和布局)

    转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990).谢谢支持! Android L: Google已经确认Android L就是Android Lolli ...

  3. sudo保持环境变量

    编译Linux内核的最后是make modules_install install,这两个一般都需要root权限,即sudo,而一般我交叉编译内核时都是在.bashrc中export ARCH=arm ...

  4. jquery validate 详解

    jQuery校验官网地址:http://bassistance.de/jquery-plugins/jquery-plugin-validation 一导入js库 <script src=&qu ...

  5. Swing实现系统托盘

    /* 实现系统托盘化 */ protected void setToolSystemTray() { // 系统是否支持系统托盘 if (SystemTray.isSupported()) { // ...

  6. 【SoapUI、Postman、WebServiceStudio、Jmeter】接口测试工具结合测试webservice接口(发送XML格式参数)

    目录: SoapUI测试webservice接口,发送XML格式参数 Postman测试webservice接口,发送XML格式参数 WebServiceStudio.exe测试webservice接 ...

  7. erlang 爬虫——爬取网页图片

    说起爬虫,大家第一印象就是想到了python来做爬虫.其实,服务端语言好些都可以来实现这个东东. 在我们日常上网浏览网页的时候,经常会看到一些好看的图片,我们就希望把这些图片保存下载,或者用户用来做桌 ...

  8. View Controller容器

    在 iOS 5 之前,view controller 容器是 Apple 的特权.实际上,在 view controller 编程指南中还有一段申明,指出你不应该使用它们.Apple 对 view c ...

  9. python学习 03 函数 (只会执行一次return就不会往下执行)

    1.调用函数只会执行一次return,而且执行return后不会往下执行

  10. parse arguments in bash

    There are lots of ways to parse arguments in sh. Getopt is good. Here's a simple script that parses ...