Example 2 - contour plots
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的更多相关文章
- 机器学习笔记(一)- from Andrew Ng的教学视频
最近算是一段空闲期,不想荒废,记得之前有收藏一个机器学习的链接Andrew Ng的网易公开课,其中的overfiting部分做组会报告时涉及到了,这几天有时间决定把这部课程学完,好歹算是有个粗浅的认识 ...
- Matlab绘图基础——绘制等高线图
% 等高线矩阵的获取 C = contourc(peaks(20),3); % 获取3个等级的等高线矩阵 % 等高线图形的绘制 contour(peaks(20),10);c ...
- 学习笔记之Introduction to Data Visualization with Python | DataCamp
Introduction to Data Visualization with Python | DataCamp https://www.datacamp.com/courses/introduct ...
- python绘制三维图
作者:桂. 时间:2017-04-27 23:24:55 链接:http://www.cnblogs.com/xingshansi/p/6777945.html 本文仅仅梳理最基本的绘图方法. 一. ...
- 44-python-三维画图
https://www.cnblogs.com/xingshansi/p/6777945.html python绘制三维图 作者:桂. 时间:2017-04-27 23:24:55 链接:htt ...
- R2—《R in Nutshell》 读书笔记(连载)
R in Nutshell 前言 例子(nutshell包) 本书中的例子包括在nutshell的R包中,使用数据,需加载nutshell包 install.packages("nutshe ...
- Matplotlib Tutorial(译)
Matplotlib Tutorial(译) 翻译自:Matplotlib tutorialNicolas P. Rougier - Euroscipy 2012 toc{: toc} 这个教程基于可 ...
- LaTeX绘图宏包 Pgfplots package
Pgfplots package The pgfplots package is a powerful tool, based on tikz, dedicated to create scienti ...
- ML 线性回归Linear Regression
线性回归 Linear Regression MOOC机器学习课程学习笔记 1 单变量线性回归Linear Regression with One Variable 1.1 模型表达Model Rep ...
随机推荐
- 把数据库里面的stu表中的数据,导出到excel中
# 2.写代码实现,把我的数据库里面的stu表中的数据,导出到excel中 #编号 名字 性别 # 需求分析:# 1.连接好数据库,写好SQL,查到数据 [[1,'name1','男'],[1,'na ...
- C#自动切换Windows窗口程序,如何才能调出主窗口?
namespace AutoChangeWindow { partial class Form1 { /// <summary> /// 必需的设计器变量. /// </summ ...
- c#关闭excel进程失败的解决方法
解决方法如下: 1.运行命令dcomcnfg -32,打开组件服务 2.找到execl服务,属性中设置交互式用户 2.设置用户权限 3.设置IIS权限
- Proftp设置虚拟用户(转)
首先在proftpd.conf中添加: AuthOrder mod_auth_file.c mod_auth_unix.c AuthUserFile /usr/local/etc/ftp ...
- SpringBoot使用Thymeleaf模板
© 版权声明:本文为博主原创文章,转载请注明出处 Thymeleaf模板简介 Thymeleaf模板是一个现代化的服务端java模板引擎对于所有的web和独立环境 Thymeleaf的主要目标是为你的 ...
- Hadoop 配置及hadoop HA 的配置
注:本文中提到的ochadoop 不要感到奇怪,是亚信公司内部自己合成的一个包.把全部的组件都放在一个包内了.免去了组件的下载过程和解决兼容问题.事实上也能够自己下载的.不要受到影响. 另,转载请注明 ...
- Ubuntu 16.04 安装opencv的各种方法(含opencv contrib扩展包安装方法)
Ubuntu 16.04 安装opencv的各种方法(含opencv contrib扩展包安装方法) https://blog.csdn.net/ksws0292756/article/details ...
- NGINX不允许向静态文件提交POST方式的请求,否则报405错误(apache中没有出现)
telnet *.*.*.* 80POST /map/navigation/2011winter/jsn/jsn_20120723_pack/pvf.jsnHTTP/1.1Host:*.*.*.* ( ...
- Struts 2 框架特性
POJO形式和POJO动作 - 已经摆脱了Struts2的动作表单的Struts框架的一个组成部分.Struts2可以使用任何的POJO接收的形式输入.同样的,你现在可以看到任何POJO的Action ...
- lamda表达式在EF中的应用
1.条件查询 _dbContext.TBEntity.Where(p=>p.ID=ID) 2.排序 升序 _dbContext.TBEntity.Where(p=>p.ID=ID).Or ...