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. delphi的字节对齐

    如果不改编译选项Delphi的Record默认也是4字节对齐的. 可以用编译开关指定 {$A4+}就是4字节对齐.同理{$A2+}.{$A1+}等.{$A1+}等同于Packed Record 主要容 ...

  2. windows上IIS实现https,配置ssl证书

    windows2012实现IIS7的https 1.申请证书,这里申请腾讯云的证书 1)登录腾讯云控制台,依次单击“云产品”>“SSL证书管理”>“申请证书” 2)在免费证书申请页面填写相 ...

  3. Excel中判断一个表中的某一列的数据在另一列中是否存在

      A B C D 1 10   3 有 2 6   e 无 3 3   6 有 判断c列的值在A列中是否存在(假定C列为需要判断列,A列为目标列) 在D1中输入以下公式,然后下拉公式即可 =IF(C ...

  4. laravel处理ajax的post提交

    Html页面(laravel表单提交必须token)所以 头部要加入: <meta name="csrf-token" content="{{ csrf_token ...

  5. java之静态代理

    © 版权声明:本文为博主原创文章,转载请注明出处 定义: - 为其他对象提供一种代理以控制对这个对象的访问 组成: 抽象角色:通过接口或抽象类声明真正角色实现的业务方法 真实角色:实现抽象角色,定义真 ...

  6. Swagger跨域访问

    我们用springboot开发完后,需要前端vue用swagger跨域,默认是不能跨域的,所以需要我们后台设置跨域访问,将下面代码完整复制即可. 在springboot项目中新建class : Cor ...

  7. PriorityBlockingQueue优先队列的二叉堆实现

    转载请注明原创地址http://www.cnblogs.com/dongxiao-yang/p/6293807.html java.util.concurrent.PriorityBlockingQu ...

  8. iOS tableView Section圆角方案

    给tableView的section设置圆角 首先给让cell左右偏移一点的距离,通过重写cell的setframe方法来实现 -(void)setFrame:(CGRect)frame{ CGFlo ...

  9. php 在linux 用file_exists() 函数判断 另外一台服务器映射过来的文件是否存在 总是返回false

    php 在linux 用file_exists() 函数判断 另外一台服务器映射过来的文件是否存在 总是返回false .如下案例 $type="android"; $url=&q ...

  10. git入门五(分支合并冲突和衍合)

    分支合并冲突的处理   合并分支的冲突时在不同的分支中修改了同一个文件的同一部分,程序无法把两份有差异的文件合并,这时候需要人为的干预解决冲突.当前处于master 分支,当dev 分支和master ...