爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3524|回复: 2

ncl在底图上画闪电

[复制链接]
发表于 2015-8-6 15:45:19 | 显示全部楼层 |阅读模式
GrADS
系统平台:
问题截图: -
问题概况: 想在设定的经纬度区域内画闪电图,闪电资料有三列,纬度,经度,强度,强度大于0就在相应经纬度位置上画+,小于零就画-,总是实现不了,把脚本贴出来求大家指导。
我看过提问的智慧: 看过
自己思考时长(天): 5

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 黄小仙儿 于 2015-8-7 11:07 编辑


想在设定的经纬度区域内画闪电图,闪电资料有三列,纬度,经度,强度,强度大于0就在相应经纬度位置上画+,小于零就画-,总是实现不了,把脚本贴出来求大家指导。


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
  type = "pdf"
  wks = gsn_open_wks(type,"lightning16")
; gsn_define_colormap(wks,"precip_11lev")

; a = addfile("/home/Huanglei/data/d032"+".nc","r")      
  res = True
  res@MainTitle = "REAL-TIME WRF"

  mpres  = True  ; Map resources
  mpres@mpOutlineOn = False  ; Turn off map outlines
  mpres@mpFillOn    = False  ; Turn off map fill
  mpres@mpGridAndLimbOn = True
  pltres = True ; Plot resources
  pltres@PanelPlot  = True   ; Tells wrf_map_overlays not to remove overlays
  mpres@pmTickMarkDisplayMode = "Always"
  lon1=117.80
  lat1=24.20
  lon2=118.35
  lat2=24.4
;---Zoom in on area of interest
mpres@mpLimitMode           = "Corners"
  mpres@mpLeftCornerLatF    = lat1
  mpres@mpLeftCornerLonF    = lon1
mpres@mpRightCornerLatF   = lat2
mpres@mpRightCornerLonF   = lon2
;---Create map.
  map = gsn_csm_map(wks,res2)
  return(map)


;>============================================================<
;                      add China map
;>------------------------------------------------------------<
     
  shp_name1    = "/home/Huanglei/map/China/diquJie_polyline.shp"
  lnres                  = True
  lnres@gsLineColor      = "gray25"
  lnres@gsLineThicknessF = 0.5   
id = gsn_add_shapefile_polylines(wks,map,shp_name1,lnres)
  shp_name2    = "/home/Huanglei/map/China/cnmap/cnhimap.shp"
  prres=True
  prres@gsLineThicknessF = 2.0      
  prres@gsLineColor = "black"
  plotcn3 = gsn_add_shapefile_polylines(wks,map,shp_name2,prres)
; draw(plot)       ; This will draw the map and the shapefile outlines.
      
  ascii_filename = "/home/Huanglei/data/new16jia.txt"
  seismic = asciiread(ascii_filename,(/521,3/),"float")   
  
    y = seismic(:,0)  ; Column 1 of file contains X values.
    x = seismic(:,1)  ; Column 2 of file contains Y values.
    z = seismic(:,2)  ; Column 3 of file contains Z values.
  txres2  = True
  txres2@txFont  = 0.01
  txres2@txFontHeightF =0.01
  txres2@txFontColor = "Red"
idx = ind(z .gt. 0)
print(idx)
if .not. all(ismissing(idx))
    str = new(dimsizes(idx), "string")
    str = "+"
    txdum1 = gsn_add_text(wks, map, str, x(idx),y(idx), txres2)
end if
txres2@txFontColor = "Blue"
idx := ind(z .lt. 0)
if .not. all(ismissing(idx))
    str := new(dimsizes(idx), "string")
    str = "-"   
    txdum2 = gsn_add_text(wks, map, str, x(idx),y(idx), txres2)
end if



  draw(plot)
   frame(wks)
   ;delete(opts)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
         
end


密码修改失败请联系微信:mofangbao
发表于 2015-8-7 11:07:06 | 显示全部楼层
感谢楼主分享
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2015-8-7 11:08:27 | 显示全部楼层

我这个是错的,放上来让大家指错的
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表