python台风动图绘制_NCL绘制台风路径
如果用WRF输出数据绘制台风路径,得到下图
********************************************************
; Plot storm stracks from wrfout files.
;********************************************************
; ===========================================
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/WRF_contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
; DATES
date = (/1512,1600,1612,1700,1712,1800,1812,1900/)
ndate = dimsizes(date)
sdate = sprinti("%4.0i",date)
; Experiment name (for legend)
EXP = (/"EXP_I"/) ; (/"EXP_I","EXP_II","EXP_III"/)
nexp = dimsizes(EXP)
; To get lat/lon info.
a = addfile("wrfout_d01_2003-07-15_00:00:00.nc","r")
lat2d = a->XLAT(0,:,:)
lon2d = a->XLONG(0,:,:)
dimll = dimsizes(lat2d)
nlat = dimll(0)
mlon = dimll(1)
; Sea Level Pressure
slp = wrf_user_getvar(a,"slp",0)
dims = dimsizes(slp)
; Array for track
time = new(ndate,string)
imin = new(ndate,integer)
jmin = new(ndate,integer)
smin = new(ndate,integer)
; =======
; ndate
; =======
fs = systemfunc("ls wrfout*00")
nfs= dimsizes(fs)
if(nfs .ne. ndate) then
print("Check input data:"+nfs+" .ne. "+ndate)
end if
do ifs=0,nfs-1
f = addfile(fs(ifs)+".nc","r")
time(ifs) = wrf_user_list_times(f)
; print(time(ifs))
slp2d = wrf_user_getvar(f,"slp",0)
; We need to convert 2-D array to 1-D array to find the minima.
slp1d = ndtooned(slp2d)
smin(ifs) = minind(slp1d)
; Convert the index for 1-D array back to the indeces for 2-D array.
minij = ind_resolve(ind(slp1d.eq.min(slp2d)),dims)
imin(ifs) = minij(0,0)
jmin(ifs) = minij(0,1)
; print(time(ifs)+" : "+min(slp2d)+" ("+imin(ifs)+","+jmin(ifs)+")")
end do
;
; Graphics section
wks=gsn_open_wks("ps","track") ; Open PS file.
gsn_define_colormap(wks,"BlGrYeOrReVi200") ; Change color map.
res = True
res@gsnDraw = False ; Turn off draw.
res@gsnFrame = False ; Turn off frame advance.
res@gsnMaximize = True ; Maximize plot in frame.
res@tiMainString = "Hurricane Isabel" ; Main title
WRF_map_c(a,res,0) ; Set up map resources
; (plot options)
plot = gsn_csm_map(wks,res) ; Create a map.
; Set up resources for polymarkers.
gsres = True
gsres@gsMarkerIndex = 16 ; filled dot
;gsres@gsMarkerSizeF = 0.005 ; default - 0.007
cols = (/5,160,40/)
; Set up resources for polylines.
res_lines = True
res_lines@gsLineThicknessF = 3. ; 3x as thick
dot = new(ndate,graphic) ; Make sure each gsn_add_polyxxx call
line = new(ndate,graphic) ; is assigned to a unique variable.
; Loop through each date and add polylines to the plot.
do i = 0,ndate-2
res_lines@gsLineColor = cols(0)
xx=(/lon2d(imin(i),jmin(i)),lon2d(imin(i+1),jmin(i+1))/)
yy=(/lat2d(imin(i),jmin(i)),lat2d(imin(i+1),jmin(i+1))/)
line(i) = gsn_add_polyline(wks,plot,xx,yy,res_lines)
end do
lon1d = ndtooned(lon2d)
lat1d = ndtooned(lat2d)
; Loop through each date and add polymarkers to the plot.
do i = 0,ndate-1
print("dot:"+lon1d(smin(i))+","+lat1d(smin(i)))
gsres@gsMarkerColor = cols(0)
dot(i)=gsn_add_polymarker(wks,plot,lon1d(smin(i)),lat1d(smin(i)),gsres)
end do
; Date (Legend)
txres = True
txres@txFontHeightF = 0.015
txres@txFontColor = cols(0)
txid1 = new(ndate,graphic)
; Loop through each date and draw a text string on the plot.
do i = 0, ndate-1
txres@txJust = "CenterRight"
ix = smin(i) - 4
print("Eye:"+ix)
if(i.eq.1) then
txres@txJust = "CenterLeft"
ix = ix + 8
end if
txid1(i) = gsn_add_text(wks,plot,sdate(i),lon1d(ix),lat1d(ix),txres)
end do
; Add marker and text for legend. (Or you can just use "pmLegend" instead.)
txres@txJust = "CenterLeft"
txid2 = new(nexp,graphic)
pmid2 = new(nexp,graphic)
do i = 0,nexp-1
gsres@gsMarkerColor = cols(i)
txres@txFontColor = cols(i)
ii = ((/129,119,109/)) ; ilat
jj = ((/110,110,110/)) ; jlon
ji = ii*mlon+jj ; col x row
pmid2(i) = gsn_add_polymarker(wks,plot,lon1d(ji(i)),lat1d(ji(i)),gsres)
txid2(i) = gsn_add_text(wks,plot,EXP(i),lon1d(ji(i)+5),lat1d(ji(i)),txres)
end do
draw(plot)
frame(wks)
end
python台风动图绘制_NCL绘制台风路径相关推荐
- 利用Python制作动图演示坐标变换理论
利用Python制作动图演示坐标变换理论 永磁同步电机是一个非线性.强耦合的物理系统,因而不便直接进行控制.后有研究人员创造性的提出了坐标变换理论(后逐渐成为矢量控制的一个部分),让永磁同步电机得以转 ...
- python台风动图绘制_使用Python绘制台风轨迹图的示例代码
参考: 使用CMA热带气旋最佳路径数据集,对我国周边的台风进行绘制 import re import os import numpy as np import matplotlib.pyplot as ...
- python台风动图绘制_python可视化绘图:台风路径可视化
本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理 以下文章来源于好奇心Log ,作者洋流 台风是重大灾害性天气,台风引起的直接灾害通 ...
- python台风动图绘制_让数据动起来——三维动图剖析“海神”
原标题:让数据动起来--三维动图剖析"海神" "海神"一路北来,影响我国东北地区 我们也让数据动起来,剖析它的内在. 近半个月来,三个台风接连影响我国东北地区, ...
- python画动图-利用Python如何制作好玩的GIF动图详解
前言 之前我们分享过用Python进行可视化的9种常见方式.其实我们还能让可视化图形逼格更高一些,今天就分享一下如何让可视化秀起来:用Python和matplotlib制作GIF图表. 假如电脑上没有 ...
- gdp python 变迁动图_19602018年世界各国GDP排名变化Python动图实现
上一期用MATLAB实现了世界各国GDP排名变化的动态图:1960-2018年世界各国GDP排名变化--Matlab动图实现.今天在这里用Python实现一下. 数据来源: https://data. ...
- 如何使用python做图_如何使用python做动图
python可以做动图吗 ImageMagick 是一套功能强大.稳定而且开源的工具集和开发包,可以用来读.写和处理超过200种基本格式的图片文件,包括PNG,JPEG,GIF,HEIC,TIFF,D ...
- 使用python将动图转换为视频
使用到的库 import os import shutil from PIL import Image from moviepy.editor import * import requests imp ...
- python画动图并保存
代码 import matplotlib.pyplot as plt import numpy as np from matplotlib import animation fig,ax=plt.su ...
- 利用Python制作动图
目前还没找到做带透明图层的图的gif,只能做一个带背景的矩形图片的组合gif. 获取图片 图片像素大小不一致,动图会很难看,可以用通过[画图]软件将像素调整为一致: python读入转为动图,代码如下 ...
最新文章
- Ajax---使用json数据格式输出数据
- 回车键兼容多个浏览器
- 基于Springboot实现企业人事管理系统
- [SIGMOD 10] Pregel 基于BSP的大规模图处理系统 学习总结
- nth-child和蝉原则实现的奇妙随机效果(译)
- 表情可字怎么打_小辫子表情怎么打?两根毛表情符号复制
- 跨域 No 'Access-Control-Allow-Origin' header is present on the requested resource
- 管理思维的逻辑之案例作业
- Metaverse:一念天堂,还是一念地狱?
- 常用键盘对应keyascii码
- 【戴明环】PDCA-问题闭环思维模型
- JAVA超简单输名字骂人_骂人不带脏字的网名非常有趣
- Golang Beego框架之WebIM例子分析
- 判断输入数是奇数还是偶数
- 微信小程序setData不起作用
- 支付宝小程序控制硬件②】 全网首篇,个人支付宝小程序控制智能硬件esp8266,从设计电路到设计协议控制两盏LED灯调节亮度。
- face id与人脸解锁_为什么Face ID比Android的人脸解锁更安全
- 职场思维:你的屁股决定你的未来?一张图,点醒了大部分人!建议收藏
- 四川率先发布新基建新消费新产业创新发展行动计划
- 建模示范视频EA-027/智慧公寓系统试看片段-视频+图片版