NCL绘制WRF domain区域并添加气象站点

2024-05-13 20:28

本文主要是介绍NCL绘制WRF domain区域并添加气象站点,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

读取文件

根据官网例子Using gsn_csm_contour_map to plot WRF-ARW data绘制:

; It shows how to use gsn_csm_xxxx scripts to do the plotting.
;
; You can use the map projection settings on the WRF file, or you
; can use your own map projection. See USE_WRF_MAP_PROJECTION below.
;----------------------------------------------------------------------
; Note: as of NCL V6.2.0, you don't need these four load commands
;----------------------------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"begin
;
; This indicates whether to use the native WRF projection on the WRF
; output file, or your own. Cylindricial equidistant is used in this
; example. If you want to change this, you will need to set any
; required map resources, especially those for zooming in on the map.
;USE_WRF_MAP_PROJECTION = True;---Open file. You may need to include ".nc" at the end.filename = "/public/home/zhangzilu/Build_WRF/PWRF-4.3/run/out_2020/wrfout_d01_2020-04-15_00:00:00"a        = addfile(filename,"r")wks = gsn_open_wks("png","wrf_contour_map")   ; "ps", "pdf", "png";---Set some resourcesres                      = True

修改色标与图例

根据需求,自己定义色标颜色与levels,并打上标签:

res@cnLineLabelsOn       = False    ; turn off line labelsres@gsnAddCyclic         = False    ; set to False if plotting regional data; res@tiMainString         = filename;res@cnFillPalette        = "OceanLakeLandSnow"gsn_define_colormap(wks,"OceanLakeLandSnow")
;---THESE VALUES WILL LIKELY NEED TO BE CHANGED OR COMMENTEDres@cnLevelSelectionMode = "ExplicitLevels"   ; set explicit contour levelsres@cnLevels    = (/1,5.,10.,50.,100.,200.,400.,600.,800.,1000.,1500.,2000.,2500.,3000.,3500/)   ; set levelsres@cnFillOn    = True                        ; turn on color fillres@cnLinesOn   = False                       ; turn off the contour linesres@cnFillColors = (/2,5,18,34,50,66,82,98,114,130,146,162,178,194,210,226/)  ; set the colors to be usedres@lbOrientation =   "horizontal"res@tmXBLabelFontHeightF    = 0.02     ;set the size of x-Axis wordsres@tmYLLabelFontHeightF    = 0.02    ;set the size of y-Axis wordsres@cnLevelSpacingF = 1res@lbLabelStride = 1res@lbLabelStride = 1;保证每个刻度色标标签显示res@pmTickMarkDisplayMode = "Always"res@pmLabelBarWidthF = 1.1res@lbLabelFontHeightF      = 0.015

绘图

 if(USE_WRF_MAP_PROJECTION) then
;
; This function looks at the global attributes on the WRF output
; file and sets some map resources based on their values.
;res = wrf_map_resources(a,res)res@tfDoNDCOverlay = True                      ; No lat/lon coordinates requiredelsehgt@lat2d             = a->XLAT(nt,:,:)       ; Lat/lon coordinates requiredhgt@lon2d             = a->XLONG(nt,:,:)res@mpProjection      = "CylindricalEquidistant"   ; default for gsn_csm_contour_mapres@mpMinLatF         = min(hgt@lat2d)res@mpMaxLatF         = max(hgt@lat2d)res@mpMinLonF         = min(hgt@lon2d)res@mpMaxLonF         = max(hgt@lon2d)res@mpCenterLonF      = (res@mpMinLonF + res@mpMaxLonF) / 2.res@mpDataBaseVersion = "MediumRes"                ; better map outlinesend ifplot =gsn_csm_contour_map(wks,hgt,res)

添加站点与文本

添加站点时应当注意,需要先关闭之前绘制的等值线图,打完点后再绘制:

lata      = (/71.3,72.6,76.8,76,68.6/)lona      = (/-156.6,-38.5,-18.7,137.9,-149.3/)tstrs = (/"Barrow","Summit", "Danmarkshavn", "Ostrov","EC_OBS"/)res@gsnMaximize          = True     ; maximize plot in frameres@gsnDraw      = False                ; Don't draw plotres@gsnFrame     = False                ; Don't advance frame (page)
mkres               = Truemkres@gsMarkerColor = "Red"txres = Truemkres@gsMarkerIndex = 16 ; filled dottxres@txFontHeightF = 0.015txres@txJust        = "CenterLeft"mkid = gsn_add_polymarker(wks,plot,lona,lata,mkres)txid = gsn_add_text(wks,plot,"   " + tstrs,lona,lata,txres)
draw(plot)frame(wks);

绘图:
在这里插入图片描述

这篇关于NCL绘制WRF domain区域并添加气象站点的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



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

相关文章

Java内存区域与内存溢出异常的详细探讨

《Java内存区域与内存溢出异常的详细探讨》:本文主要介绍Java内存区域与内存溢出异常的相关资料,分析异常原因并提供解决策略,如参数调整、代码优化等,帮助开发者排查内存问题,需要的朋友可以参考下... 目录一、引言二、Java 运行时数据区域(一)程序计数器(二)Java 虚拟机栈(三)本地方法栈(四)J

QT6中绘制UI的两种方法详解与示例代码

《QT6中绘制UI的两种方法详解与示例代码》Qt6提供了两种主要的UI绘制技术:​​QML(QtMeta-ObjectLanguage)​​和​​C++Widgets​​,这两种技术各有优势,适用于不... 目录一、QML 技术详解1.1 QML 简介1.2 QML 的核心概念1.3 QML 示例:简单按钮

Python使用Matplotlib绘制3D曲面图详解

《Python使用Matplotlib绘制3D曲面图详解》:本文主要介绍Python使用Matplotlib绘制3D曲面图,在Python中,使用Matplotlib库绘制3D曲面图可以通过mpl... 目录准备工作绘制简单的 3D 曲面图绘制 3D 曲面图添加线框和透明度控制图形视角Matplotlib

使用Python绘制蛇年春节祝福艺术图

《使用Python绘制蛇年春节祝福艺术图》:本文主要介绍如何使用Python的Matplotlib库绘制一幅富有创意的“蛇年有福”艺术图,这幅图结合了数字,蛇形,花朵等装饰,需要的可以参考下... 目录1. 绘图的基本概念2. 准备工作3. 实现代码解析3.1 设置绘图画布3.2 绘制数字“2025”3.3

使用Python绘制可爱的招财猫

《使用Python绘制可爱的招财猫》招财猫,也被称为“幸运猫”,是一种象征财富和好运的吉祥物,经常出现在亚洲文化的商店、餐厅和家庭中,今天,我将带你用Python和matplotlib库从零开始绘制一... 目录1. 为什么选择用 python 绘制?2. 绘图的基本概念3. 实现代码解析3.1 设置绘图画

Python绘制土地利用和土地覆盖类型图示例详解

《Python绘制土地利用和土地覆盖类型图示例详解》本文介绍了如何使用Python绘制土地利用和土地覆盖类型图,并提供了详细的代码示例,通过安装所需的库,准备地理数据,使用geopandas和matp... 目录一、所需库的安装二、数据准备三、绘制土地利用和土地覆盖类型图四、代码解释五、其他可视化形式1.

如何用Python绘制简易动态圣诞树

《如何用Python绘制简易动态圣诞树》这篇文章主要给大家介绍了关于如何用Python绘制简易动态圣诞树,文中讲解了如何通过编写代码来实现特定的效果,包括代码的编写技巧和效果的展示,需要的朋友可以参考... 目录代码:效果:总结 代码:import randomimport timefrom math

【WebGPU Unleashed】1.1 绘制三角形

一部2024新的WebGPU教程,作者Shi Yan。内容很好,翻译过来与大家共享,内容上会有改动,加上自己的理解。更多精彩内容尽在 dt.sim3d.cn ,关注公众号【sky的数孪技术】,技术交流、源码下载请添加微信号:digital_twin123 在 3D 渲染领域,三角形是最基本的绘制元素。在这里,我们将学习如何绘制单个三角形。接下来我们将制作一个简单的着色器来定义三角形内的像素

Flutter 进阶:绘制加载动画

绘制加载动画:由小圆组成的大圆 1. 定义 LoadingScreen 类2. 实现 _LoadingScreenState 类3. 定义 LoadingPainter 类4. 总结 实现加载动画 我们需要定义两个类:LoadingScreen 和 LoadingPainter。LoadingScreen 负责控制动画的状态,而 LoadingPainter 则负责绘制动画。

利用matlab bar函数绘制较为复杂的柱状图,并在图中进行适当标注

示例代码和结果如下:小疑问:如何自动选择合适的坐标位置对柱状图的数值大小进行标注?😂 clear; close all;x = 1:3;aa=[28.6321521955954 26.2453660695847 21.69102348512086.93747104431360 6.25442246899816 3.342835958564245.51365061796319 4.87