湖南鼎岳装饰有限公司

contour_tf) overlay(map

发布日期:2024-06-25 10:40    点击次数:76

contour_tf)  overlay(map

NCL(NCAR Command Language)是一个用于科学数据分析和可视化的强大工具,通常用于处理大气和地球科学领域的数据。目前已经迁移到python中,ncl不再更新,但依然有不少朋友在使用ncl进行WRF后处理,这里分享一个用ncl绘制WRF风场的脚本。

图片成功案例

; These files are loaded by default in NCL V6.2.0 and newer; 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/wrf/WRFUserARW.ncl"begin;---Open WRF output file  filename = "wrfout_d01_2023-07-01_00_00_00"  a        = addfile(filename,"r");---Read several WRF variables at first time step  it  = 0  tc  = wrf_user_getvar(a,"tc",it)    ; 3D temperature  u   = wrf_user_getvar(a,"ua",it)    ; 3D U at mass points  v   = wrf_user_getvar(a,
企业-裕洁木咖啡有限公司"va",
肇东市东欧食用油有限公司it)    ; 3D V at mass points;---Now get the lowest (bottommost) level  nl  = 0  tc2 = tc(nl,桥西区众津良网络推广服务中心:,:)  u10 = u(nl,:,:)  v10 = v(nl,成功案例:,:)  tf2 = 1.8*tc2+32.                    ; Convert temperature to Fahrenheit  u10 = u10                    ; Convert wind into knots  v10 = v10;---Change the metadata  tf2@description = "Surface Temperature"  tf2@units       = "degF"  u10@units       = "m/s"  v10@units       = "m/s"  wks = gsn_open_wks("png","wrf_gsn");---Set common resources for all plots  res                = True  res@gsnFrame       = False  res@gsnDraw        = False  res@gsnLeftString  = ""  res@gsnRightString = "";---Necessary for contours to be overlaid correctly on WRF projection  res@tfDoNDCOverlay        = True; res@tfDoNDCOverlay        = "NDCViewport" ; can use this in NCL V6.5.0 or later   ;---Temperature filled contour plot  tf_res                      = res  tf_res@cnFillOn             = True    tf_res@cnLevelSelectionMode = "ExplicitLevels"  tf_res@cnLevels             = ispan(-20,90,5)  tf_res@cnInfoLabelOn        = False  tf_res@cnLineLabelsOn       = False  tf_res@cnLinesOn            = False  tf_res@cnFillDrawOrder      = "PreDraw"  tf_res@lbOrientation        = "Vertical"  tf_res@lbLabelFontHeightF   = 0.01  contour_tf = gsn_csm_contour(wks,tf2,tf_res);---Wind vector plot  vec_res                       = res  vec_res@vcMinDistanceF        = 0.025  vec_res@vcRefLengthF          = 0.038  vec_res@vcMinFracLengthF      = 0.2  vec_res@vcLineArrowThicknessF = 3.0  vec_res@vcGlyphStyle          = "CurlyVector"  vec_res@vcRefAnnoOn           = False  vector = gsn_csm_vector(wks,u10,v10,vec_res)  ;---Map plot  map_res                      = True  map_res@gsnFrame             = False  map_res@gsnDraw              = False  ;map_res@tiMainString         = filename  map_res@gsnLeftString        = tf2@description + " (" + tf2@units + ")"  map_res@gsnRightString       = "Wind (" + u10@units + ")"  map_res@gsnStringFontHeightF = 0.015;---Set map resources based on projection on WRF output file  map_res = wrf_map_resources(a,map_res)  map_res@mpFillOn                    = False  map_res@mpOutlineOn                 = True  map_res@mpDataBaseVersion           = "LowRes"  map_res@mpOutlineDrawOrder          = "PostDraw"  map_res@mpUSStateLineColor          = "Black"  map_res@mpPerimLineColor            = "Black"  map_res@mpNationalLineColor         = "Black"  map_res@mpLimbLineColor             = "Black"  map_res@mpGridLineColor             = "Black"  map_res@mpGeophysicalLineColor      = "Black"  map_res@mpUSStateLineThicknessF     = 3.0  map_res@mpNationalLineThicknessF    = 3.0  map_res@mpGeophysicalLineThicknessF = 3.0  map = gsn_csm_map(wks,map_res);---Overlay plots on map and draw.  overlay(map,contour_tf)  overlay(map,vector)  draw(map)   ; This will draw all overlaid plots and the map  frame(wks)end
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报。

栏目分类



Powered by 湖南鼎岳装饰有限公司 @2013-2022 RSS地图 HTML地图

Copyright 站群系统 © 2013-2024 SSWL 版权所有