NCL入门

2023-11-02 06:20
文章标签 入门 ncl

本文主要是介绍NCL入门,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

为什么80%的码农都做不了架构师?>>>   hot3.png

;***这两行指令必须加载,类似于c语言中的库函数
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"begin              ;开始标志
a = addfile("/home/yuanm/surface.nc","r")        ;文件读取
; 绘图类型(依次为,窗口显示,pdf,ps,ncgm格式)type = "x11"
;  type = "pdf"
; type = "ps"
; type = "ncgm"wks = gsn_open_wks(type,"ECMWF_surface")      ;创建工作空间
; 时间维数(如该例子中,只有00,08,16,24四个时间段)times = a->time   ; 箭头表示数据a中的时间向量ntimes = dimsizes(times)         ; 时间维数
;循环结构do it = 0,(ntimes-1),1msl1 = a->msl(it,:,:)      ; mean sea level pressuret2m1 = a->t2m(it,:,:)      ; temperature at 2mu101 = a->u10(it,:,:)      ; 10 metre U wind componentv101 = a->v10(it,:,:)      ; 10 metre V wind componentmsl = short2flt(msl1)    ;数据类型转换msl = smth9(msl,0.50,0.25,False)   ;平滑t2m = short2flt(t2m1)t2m = smth9(t2m,0.50,0.25,False)t2m = t2m-273.15u10 = short2flt(u101)v10 = short2flt(v101)msl = msl/100.msl@units="hPa";绘图参数控制res                 = Trueres@gsnDraw         = False        ;为调整绘制顺序,让该图暂时不画出来res@gsnFrame        = False
;  res@gsnMaximize     = True    ; Maximize plot in frame
; Add map resources
;  res@mpGridAndLimbOn       =  True                ; Turn off lat/lon lines
; res@mpGridLineColor       = "gray"res@mpGeophysicalLineColor = "gray"res@pmTickMarkDisplayMode = "Conditional"             ; Turn on map tickmarksres@mpMaxLonF     = 180.        ;经度最大值res@mpMinLonF     = 100.          res@mpMaxLatF     = 50.       res@mpMinLatF     = -10.       res@mpFillOn           = False
; 温度场绘图res2 = Trueres2 = resres2@cnFillOn            = Trueres2@cnLinesOn           = Falseres2@cnInfoLabelOn = Falseres2@cnLevelSelectionMode = "ManualLevels"res2@cnMinLevelValF       = 0.0res2@cnMaxLevelValF       = 40.0res2@cnLevelSpacingF      = 2.0res2@gsnLeftString ="  "res2@gsnRightString = "  "map1 = gsn_csm_contour_map(wks,t2m,res2)draw(map1)delete(res2)
; Set some contouring resources.res1    =  Trueres1 = resres1@cnFillOn        = Falseres1@cnLineLabelsOn  = True
;  res1@cnLineLabelFontAspectF  = 0.6res1@cnLineLabelFontColor = "blue"res1@cnLineLabelPerimOn = Falseres1@cnLineLabelPlacementMode = "Constant"
;  res1@cnLineLabelConstantSpacingF = 1.0res1@cnLineLabelInterval = 1.0
;  res1@cnLineDashSegLenF = 0.20res1@cnInfoLabelOn   = False
;  res1@cnLevelSelectionMode = "ExplicitLevels"
;  res1@cnLevels = (/5800.,5840.,5850.,5860.,5870.,5880.,5890.,5900./)res1@cnLevelSpacingF  = 2.0
;  res1@cnHighLabelsOn   = True
;  res1@cnHighLabelString          = "H"res1@cnHighLabelBackgroundColor = -1res1@cnHighLabelFontColor       = "blue"
;  res1@cnHighLabelFontAspectF     = 5.0
;  res1@cnLowLabelsOn   = True
;  res1@cnLowLabelString          = "L"res1@cnLowLabelBackgroundColor = -1res1@cnLowLabelFontColor       = "red"res1@cnLowLabelFontAspectF     = 2.0res1@cnLineColor = "Blue"res1@gsnContourLineThicknessesScale = 3.0res1@gsnLeftString = ""res1@gsnRightString = ""map = gsn_csm_contour_map(wks,msl, res1)draw(map)delete(res1);create vector plotres3 = Trueres3 = resres3@vcRefMagnitudeF= 20.0res3@vcRefLengthF= 0.05res3@vcMinDistanceF= 0.03res3@vcGlyphStyle= "CurlyVector"res3@vcRefAnnoOn = True   ;do not draw reference vector annotationres3@vcRefAnnoOrthogonalPosF = -0.15  ; vertical positionres3@vcRefAnnoParallelPosF = 0.98res3@vcLineArrowThicknessF = 2.0res3@gsnDraw = Falseres3@gsnFrame = Falseres3@gsnLeftString = " "res3@gsnRightString = " "map2= gsn_csm_vector_map(wks,u10,v10,res3)draw(map2)delete(res3)frame(wks)
end do
end

注:

grib资料与ncl资料大同小异,都是先提取变量,然后做数据处理。

变量查看指令:ncl_filedump  "资料名“(如"surface.nal")

然后根据所查看到的变量信息提取变量。

转载于:https://my.oschina.net/voole/blog/2988740

这篇关于NCL入门的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/328701

相关文章

Spring Security 从入门到进阶系列教程

Spring Security 入门系列 《保护 Web 应用的安全》 《Spring-Security-入门(一):登录与退出》 《Spring-Security-入门(二):基于数据库验证》 《Spring-Security-入门(三):密码加密》 《Spring-Security-入门(四):自定义-Filter》 《Spring-Security-入门(五):在 Sprin

数论入门整理(updating)

一、gcd lcm 基础中的基础,一般用来处理计算第一步什么的,分数化简之类。 LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; } <pre name="code" class="cpp">LL lcm(LL a, LL b){LL c = gcd(a, b);return a / c * b;} 例题:

Java 创建图形用户界面(GUI)入门指南(Swing库 JFrame 类)概述

概述 基本概念 Java Swing 的架构 Java Swing 是一个为 Java 设计的 GUI 工具包,是 JAVA 基础类的一部分,基于 Java AWT 构建,提供了一系列轻量级、可定制的图形用户界面(GUI)组件。 与 AWT 相比,Swing 提供了许多比 AWT 更好的屏幕显示元素,更加灵活和可定制,具有更好的跨平台性能。 组件和容器 Java Swing 提供了许多

【IPV6从入门到起飞】5-1 IPV6+Home Assistant(搭建基本环境)

【IPV6从入门到起飞】5-1 IPV6+Home Assistant #搭建基本环境 1 背景2 docker下载 hass3 创建容器4 浏览器访问 hass5 手机APP远程访问hass6 更多玩法 1 背景 既然电脑可以IPV6入站,手机流量可以访问IPV6网络的服务,为什么不在电脑搭建Home Assistant(hass),来控制你的设备呢?@智能家居 @万物互联

poj 2104 and hdu 2665 划分树模板入门题

题意: 给一个数组n(1e5)个数,给一个范围(fr, to, k),求这个范围中第k大的数。 解析: 划分树入门。 bing神的模板。 坑爹的地方是把-l 看成了-1........ 一直re。 代码: poj 2104: #include <iostream>#include <cstdio>#include <cstdlib>#include <al

MySQL-CRUD入门1

文章目录 认识配置文件client节点mysql节点mysqld节点 数据的添加(Create)添加一行数据添加多行数据两种添加数据的效率对比 数据的查询(Retrieve)全列查询指定列查询查询中带有表达式关于字面量关于as重命名 临时表引入distinct去重order by 排序关于NULL 认识配置文件 在我们的MySQL服务安装好了之后, 会有一个配置文件, 也就

音视频入门基础:WAV专题(10)——FFmpeg源码中计算WAV音频文件每个packet的pts、dts的实现

一、引言 从文章《音视频入门基础:WAV专题(6)——通过FFprobe显示WAV音频文件每个数据包的信息》中我们可以知道,通过FFprobe命令可以打印WAV音频文件每个packet(也称为数据包或多媒体包)的信息,这些信息包含该packet的pts、dts: 打印出来的“pts”实际是AVPacket结构体中的成员变量pts,是以AVStream->time_base为单位的显

C语言指针入门 《C语言非常道》

C语言指针入门 《C语言非常道》 作为一个程序员,我接触 C 语言有十年了。有的朋友让我推荐 C 语言的参考书,我不敢乱推荐,尤其是国内作者写的书,往往七拼八凑,漏洞百出。 但是,李忠老师的《C语言非常道》值得一读。对了,李老师有个官网,网址是: 李忠老师官网 最棒的是,有配套的教学视频,可以试看。 试看点这里 接下来言归正传,讲解指针。以下内容很多都参考了李忠老师的《C语言非

MySQL入门到精通

一、创建数据库 CREATE DATABASE 数据库名称; 如果数据库存在,则会提示报错。 二、选择数据库 USE 数据库名称; 三、创建数据表 CREATE TABLE 数据表名称; 四、MySQL数据类型 MySQL支持多种类型,大致可以分为三类:数值、日期/时间和字符串类型 4.1 数值类型 数值类型 类型大小用途INT4Bytes整数值FLOAT4By

【QT】基础入门学习

文章目录 浅析Qt应用程序的主函数使用qDebug()函数常用快捷键Qt 编码风格信号槽连接模型实现方案 信号和槽的工作机制Qt对象树机制 浅析Qt应用程序的主函数 #include "mywindow.h"#include <QApplication>// 程序的入口int main(int argc, char *argv[]){// argc是命令行参数个数,argv是