爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 8417|回复: 6

NCL画站点 ,无法画出来

[复制链接]

新浪微博达人勋

发表于 2016-1-28 22:53:29 | 显示全部楼层 |阅读模式

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

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

x
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 "/space/gpfsl01/users/hanshuai/liujunjian/program/china/cnmap/cnmap.ncl"

begin


x         =asciiread("x.txt",(/90/),"float")  
y         =asciiread("y.txt",(/90/),"float")  
bias      =asciiread("bias.txt",(/90/),"string")
era_bias  =asciiread("era_bias.txt",(/90/),"string")  


;---------------------------------------------------------------------------
        nLAT = 2880 ;纬度
        nLON = 5760 ;经度
        file_time          =(/"2015060100","2015060106","2015060112","2015060118"/)

do i=0,0            ;-------------------循环时次


;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++需要修改的地方
       ;pic_name=file_time(i) +"_gfs_isccp_pw_bias"

        pic_name=file_time(i) +"_era_isccp_pw_bias"

       ;pic_name=file_time(i) +"_gfs_era_pw_bias"
       print(pic_name)
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++需要修改的地方
        file_name_isccp    =file_time(i)+"_isccp_pw.nc"
        file_name_gfs      =file_time(i)+"_gfs_pw.nc"
        file_name_era      =file_time(i)+"_era_pw.nc"
;---------------------------------------读取文件
        f_isccp            =addfile(file_name_isccp,"r")
        f_gfs              =addfile(file_name_gfs,"r")
        f_era              =addfile(file_name_era,"r")
;---------------------------------------读取变量
        var_isccp          =f_isccp->pw(:,:)
        var_gfs            =f_gfs->PW(:,:)
        var_era            =f_era->tcwv(:,:)
;---------------------------------------差运算
        gfs_isccp  =var_gfs/1.0-var_isccp*10
        era_isccp  =var_era/1.0-var_isccp*10
        gfs_era    =gfs_isccp-era_isccp
;---------------------------------------公共范围
        newlon       = fspan(0,359.5,nLON)
        newlat       = fspan(-90 ,90 ,nLAT)
        newlat@units = "degrees_north"
        newlon@units = "degrees_east"
;---------------------------------------GFS-ISCCP
        gfs_isccp!0   ="latitude"
        gfs_isccp!1   = "longitude"
        gfs_isccp&latitude  = newlat
        gfs_isccp&longitude = newlon
;---------------------------------------ERA-ISCCP
        era_isccp!0   ="latitude"
        era_isccp!1   = "longitude"
        era_isccp&latitude  = newlat
        era_isccp&longitude = newlon
;---------------------------------------GFS-ERA
        gfs_era!0   ="latitude"
        gfs_era!1   = "longitude"
        gfs_era&latitude  = newlat
        gfs_era&longitude = newlon
;---------------------------------------输出NC数据
        ;fout_gfs=addfile(file_time(i)+"_gfs_isccp_pw.nc","c")
        ;fout_gfs->pw=gfs_isccp
        ;fout_era=addfile(file_time(i)+"_era_isccp_pw.nc","c")
        ;fout_era->pw=era_isccp




  wks        = gsn_open_wks("png",pic_name)
               gsn_define_colormap(wks,"BlAqGrYeOrReVi200")  
        setvalues NhlGetWorkspaceObjectId()
               "wsMaximumSize" : 300000000
        end setvalues

res                         = True      
res@cnLineLabelsOn          = False
res@cnFillDrawOrder         = "Predraw"             ; fill and lines before map
;res@lbLabelBarOn            = False
;res@cnFillPalette           = "BlueRed"             ; Blue-Red colormap
res@gsnAddCyclic            = False      
res@tiMainString            = pic_name
res@gsnMaximize             = True
res@gsnDraw                 = False
res@gsnFrame                = False
res@gsnLeftString           = "Total column water vapour"
res@gsnRightString          = "kg/m**2"
;>--------------------------------------------<
;            set for the map
;>--------------------------------------------<
res@mpMinLatF               = 17.                        
res@mpMaxLatF               = 55.
res@mpMinLonF               = 72.
res@mpMaxLonF               = 136.

res@cnLevelSelectionMode    = "ExplicitLevels"
;res@cnLevels               = ispan(-40,40,10);      
res@cnLevels                = ispan(-20,20,5);  
res@mpFillOn                = True
res@mpOutlineOn             = False  ; Use outlines from shapefile
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"
;>--------------------------------------------<
; set for the plot

res@cnFillOn                = True               
res@cnLinesOn               = False   
res@cnLevelSpacingF         = 2.            
res@gsnSpreadColors         = True         
res@lbLabelAutoStride       = True   
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++需要修改的地方           
   ;map=gsn_csm_contour_map(wks,gfs_isccp,res)
    map=gsn_csm_contour_map(wks,era_isccp,res)
   ;map=gsn_csm_contour_map(wks,gfs_era,res)
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++需要修改的地方
  res@tmYROn           = False     ; Turn off right and top tick marks
  res@tmXTOn           = False     ; Turn off right and top tick marks

;                      add China map
;>------------------------------------------------------------<
cnres           = True
cnres@china     = True       ;draw china map or not
cnres@river     = True       ;draw changjiang&huanghe or not
cnres@province  = True       ;draw province boundary or not
cnres@nanhai    = True       ;draw nanhai or not
cnres@diqu      = False      ;draw diqujie or not

chinamap = add_china_map(wks,map,cnres)
;----------------------------------------------
    txres                = True
    txres@txFontHeightF  = 0.010
     mkres               = True
     mkres@gsMarkerIndex = 17     ; Filled circle
     mkres@gsMarkerSizeF = 1
     mkres@gsMarkerColor = "red"                  ; polymarker color  


;----------------------------------------------
   do j = 0,89

      txt1   =gsn_add_text(wks,map,era_bias(j),x(j),y(j),txres)
              ;gsn_polymarker(wks,map,x(j),y(j),mkres)
      point  =gsn_add_polygon(wks,map,x(j),y(j),mkres)
   end do

         draw(map)
         frame(wks)
end do
end



主要是是这个 do j = 0,89

      txt1   =gsn_add_text(wks,map,era_bias(j),x(j),y(j),txres)
              ;gsn_polymarker(wks,map,x(j),y(j),mkres)
      point  =gsn_add_polygon(wks,map,x(j),y(j),mkres)
   end do
point 画不出来
warning :
warning:TransformPostDraw: tfPolyDrawList element 3482 is invalid
warning:TransformPostDraw: tfPolyDrawList element 3483 is invalid
warning:TransformPostDraw: tfPolyDrawList element 3484 is invalid
warning:TransformPostDraw: tfPolyDrawList element 3485 is invalid
warning:TransformPostDraw: tfPolyDrawList element 3486 is invalid
warning:TransformPostDraw: tfPolyDrawList element 3487 is invalid
warning:TransformPostDraw: tfPolyDrawList element 3488 is invalid
warning:TransformDataPolygon, not enough points for a polygon
,求大神支招。


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

新浪微博达人勋

发表于 2016-3-1 09:47:27 | 显示全部楼层
我也遇到这样的问题
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-8-22 14:35:15 | 显示全部楼层
jiangbing 发表于 2016-3-1 09:47
我也遇到这样的问题

请问解决了吗
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-8-22 14:36:48 | 显示全部楼层
请问解决了吗 谢谢
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-9-28 18:30:23 | 显示全部楼层

好像不能叠加
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-12-17 18:24:21 | 显示全部楼层
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-3-13 22:41:13 | 显示全部楼层
我也有这个问题,而且看了官网试了上面说的也不行...请问这个问题解决了吗?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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