爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 6410|回复: 7

[作图] NCL站点插值有问题

[复制链接]

新浪微博达人勋

发表于 2017-7-25 21:28:13 | 显示全部楼层 |阅读模式

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

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

x
想请教一下大家,ncl画站点图的时候为什么只画出了部分站点?
1、排除了站点经纬度的问题;
2、程序之前用来画过738个站点的温度,是可以全部显示出来站点的;
3、改了数据的列数,出来的站点数不一致(本来是本来是420行,18列数据,只画出来23个站点;后来改成420行,7列,出来了50几个站点)
所以自己搞不太清楚是怎么回事。。。

程序:
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/cnmap/cnmap.ncl"
begin
  FILES = systemfunc (" ls -1 "+"*.txt ")        ;从这里开始到下面都是读取文件的命令
  numFILES = dimsizes(FILES)

  do i = 0,numFILES-1           
  data  = asciiread(FILES(i),(/420,7/),"float")
  Q = data(:,3)
  lon   = data(:,2)
  lat   = data(:,1)
  olon = fspan(114,122,130)
  olat = fspan(26,42,100)

  olon!0          = "lon"
  olon@long_name  = "lon"
  olon@units      = "degrees-east"
  olon&lon        = olon
  olat!0          = "lat"
  olat@long_name  = "lat"
  olat@units      = "degrees_north"
  olat&lat        = olat

  Q@_FillValue = -999.000000
  rscan = (/2.5,1.5,0.5/)   
  final = obj_anal_ic_deprecated(lon,lat,Q,olon,olat,rscan,False)

  wks = gsn_open_wks ("png",FILES(i))  

  res                         = True            
  res@gsnMaximize             = True
  res@gsnDraw                 = False
  res@gsnFrame                = False

;>--------------------------------------------<
;            set for the map
;>--------------------------------------------<
  res@mpMinLatF               = 26.                        
  res@mpMaxLatF               = 42.
  res@mpMinLonF               = 114.
  res@mpMaxLonF               = 122.
  res@tmXBMode                = "Explicit"   
  res@tmXBValues              = (/114,116,118,120,122/)
  res@tmXBLabels              = (/"114~S~o~N~E","116~S~o~N~E","118~S~o~N~E","120~S~o~N~E","122~S~o~N~E"/)   
  res@tmXBMinorValues         = fspan(114,122,31)
  res@tmXBMinorOn             = True  

  res@tmYLMode                = "Explicit"   
  res@tmYLValues              = (/26,28,30,32,34,36,38,40,42/)
  res@tmYLLabels              = (/"26~S~o~N~N","28~S~o~N~N","30~S~o~N~N","32~S~o~N~N","34~S~o~N~N","36~S~o~N~N","38~S~o~N~N","40~S~o~N~N","42~S~o~N~N"/)   
  res@tmYLMinorValues         = fspan(22,42,26)
  res@tmYLMinorOn             = True  

  res@mpFillOn                = False
  res@mpOutlineOn             = True   
  res@cnFillDrawOrder         = "PreDraw"
  res@mpDataBaseVersion       = "MediumRes"
  res@mpDataSetName           = "Earth..4"
  res@mpAreaMaskingOn         = True
  res@mpMaskAreaSpecifiers    = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
  res@mpLandFillColor         = "white"
  res@mpInlandWaterFillColor  = "white"
  res@mpOceanFillColor        = "white"
  res@mpOutlineBoundarySets   = "NoBoundaries"
  res@mpOutlineSpecifiers   = "China:states"
  res@mpFillAreaSpecifiers   = "China:states"
  res@mpFillBoundarySets   = "National"
;>--------------------------------------------<

;>--------------------------------------------<

  res@cnFillOn                = True               
  res@cnLinesOn               = False            
  res@cnLevelSpacingF         = 0.5            
  res@gsnSpreadColors         = True         
  res@lbLabelAutoStride       = True
  res@gsnAddCyclic            = False
  res@cnLevelSelectionMode  = "ManualLevels"
  res@cnMinLevelValF        = 4
  res@cnMaxLevelValF        = 10
  res@cnLevelSpacingF       = 0.5      

  map = gsn_csm_contour_map(wks,final,res)

;>------------------------------------------------------------<

  station             = asciiread("spr_1979.txt",(/420,7/),"float")  

  res2                 = True                       
  res2@gsMarkerIndex   = 16                       
  res2@gsMarkerSizeF   = 6.               
  res2@gsMarkerColor   = "black"                  
  res2@tfPolyDrawOrder = "PostDraw"  
  res2@cnFillDrawOrder = "PostDraw"  

  plots=gsn_add_polymarker(wks,map,station(:,2),station(:,1),res2)
  ;delete(res2)
  draw(map)
  frame(wks)
  end do
end



数据(截取部分):
   40.38    116.87      5.31      5.42      5.02      5.54      5.48
   38.23    115.73      5.60      5.53      4.72      5.97      5.66
   37.50    117.53      5.69      5.79      5.00      5.96      5.79
   37.63    120.33      5.25      5.96      6.03      5.82      5.78
   36.23    115.63      6.19      6.44      5.79      6.63      6.44
   35.57    118.83      5.77      6.27      5.92      5.97      6.14
   32.33    116.28      8.34      7.85      7.42      8.53      8.14
   33.47    119.77      7.47      7.28      7.02      7.58      7.48
   32.07    121.60      7.71      7.91      7.72      8.11      7.90
   30.03    122.10      8.32      8.58      8.32      8.40      8.40
   38.85    115.13      5.74      5.75      5.53      6.29      5.95
   38.30    114.38      5.87      5.84      5.58      6.33      6.04
   38.63    114.68      5.69      5.69      5.33      5.77      5.80
   38.45    114.55      5.99      6.11      5.89      6.44      6.29
   38.02    115.07      5.88      5.94      5.52      6.32      6.07
   38.15    114.57      5.97      6.04      5.78      6.27      6.16
   38.73    114.98      5.85      6.01      5.68      6.59      6.20
   38.03    114.13      5.55      5.59      5.10      5.19      5.50
   38.27    114.22      6.16      5.95      5.68      6.44      6.20
   38.35    114.68      6.04      5.88      5.67      6.29      6.15
   38.52    115.00      5.90      5.60      5.09      6.00      5.82
   38.03    114.83      6.10      6.08      6.17      6.62      6.38
   38.03    114.42      5.85      5.74      5.51      6.42      6.02
   38.18    114.95      5.90      6.08      5.70      6.44      6.20
   36.33    114.62      6.46      6.26      5.77      6.69      6.49
   36.87    114.47      5.99      6.11      5.62      6.70      6.31
   37.75    114.78      6.12      6.21      6.05      6.78      6.47
   37.52    114.67      6.45      6.25      5.98      6.65      6.53
   37.88    114.63      6.29      6.44      6.21      6.83      6.62
   37.60    114.62      6.04      6.04      5.45      6.45      6.20
   37.77    114.52      5.94      6.03      5.54      6.41      6.17
   37.45    114.48      5.90      5.60      5.09      5.85      5.80
   37.35    114.75      6.35      6.18      5.81      6.66      6.46
   37.65    114.37      5.44      5.71      5.33      5.77      5.69



file:///C:\Users\zxt\AppData\Roaming\Tencent\Users\502067133\QQ\WinTemp\RichOle\O]JC_6ISKAFQIS{3ZN2~)_7.png

密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-25 21:29:35 | 显示全部楼层
附上奇怪的图
spr_1979.txt.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-26 12:38:00 | 显示全部楼层
自己顶一下
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-7-26 20:34:22 | 显示全部楼层
你print一下data,也许是数据从txt读取的时候就没有读完
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-26 21:11:18 | 显示全部楼层
songwei 发表于 2017-7-26 20:34
你print一下data,也许是数据从txt读取的时候就没有读完

恩恩,我减少了列数,发现就能全部画出站点了,也是很奇怪诶~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-10-30 17:47:15 | 显示全部楼层
谢谢楼主分享
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-2-2 11:30:47 | 显示全部楼层
也学习下,最近也在弄这个问题!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-3-8 14:04:30 | 显示全部楼层
abc258886@ 发表于 2018-2-2 11:30
也学习下,最近也在弄这个问题!

请问你成功了嘛?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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