爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 7154|回复: 3

[作图] 求大神指点wrfout数据画图

[复制链接]

新浪微博达人勋

发表于 2018-8-15 15:02:52 | 显示全部楼层 |阅读模式

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

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

x
各位大神,麻烦指点下,感激不尽。
本人新手一枚,是想用wrfout输出的土壤湿度数据与cpc的土壤湿度数据做个相关性检验。但是一直出不了图,或者出图显示无数据前面是先做了一个土壤湿度的月平均,然后进行插值,然后进行相关性计算。基本都是ncl官网的例子截取的部分。
这是报的错
warning:esccr: Non-fatal conditions encountered: all missing or constant values
(0)     check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
(0)     A valid latitude coordinate array should have a 'units' attribute equal to one of the following values:
(0)         'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0)     check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.
(0)     A valid longitude coordinate array should have a 'units' attribute equal to one of the following values:
(0)         'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
warning:ContourPlotInitialize: no valid values in scalar field; ContourPlot not possible:[errno=1101]

这个是ncl程序
begin
    InterpMethod= "patch"                      ; define interpolation method
    srcDirName  = "/vol6/home/fgz/weiyongheng/"
    srcFileName = "wrfout_d02_2017-03-01_00:00:00.nc"
    srcFilePath =  srcDirName + srcFileName
    sfile = addfile(srcFilePath,"r")              
    sm1 = sfile->SMOIS(0:743,1,:,:)
    sm = dim_avg_n_Wrap(sm1,0)

    lat2d = sfile->XLAT(0,:,:)               ; (south_north,west_east)
    lon2d = sfile->XLONG(0,:,:)
    dims  = dimsizes(lat2d)
    nlat  = dims(0)
    nlon  = dims(1)
    lat = fspan(min(lat2d), max(lat2d) ,nlat)
    lon = fspan(min(lon2d), max(lon2d) ,nlon)
    Opt                = True
    Opt@SrcTitle       = "WRF grid"   ; optional
    Opt@WgtFileName    = "WRF_to_Rect.WgtFile_"+InterpMethod+".nc"
    Opt@SrcFileName    = "WRF.SCRIP_grid_description.nc"         ; Name of source and
    Opt@SrcRegional    = True
    Opt@SrcGridLat     = lat2d
    Opt@SrcGridLon     = lon2d
    Opt@DstFileName    = "Rectilinear.SCRIP_grid_description.nc" ; destination files
    Opt@DstGridType    = "rectilinear"
    Opt@DstGridLat     = lat
    Opt@DstGridLon     = lon
    Opt@DstRegional    = True
    Opt@ForceOverwrite = True
    Opt@InterpMethod   = InterpMethod
    sm_regrid = ESMF_regrid(sm,Opt)
    sm_regrid&lat@units = "degree_north"
    sm_regrid&lon@units = "degree_east"     ; Do the regridding for sm   

    a2  = addfile("/vol6/home/fgz/weiyongheng/soilw.mon.mean.v2.nc","r")
    sm2 = a2->soilw(830,:,:)
    sm22 = sm2/1000.
  maxlag = 2                                    ; set lag
  ccr = esccr(sm_regrid(34:40,82:98),sm22(34:40,82:98),maxlag)                   ; calc cross correlations
  copy_VarAtts(sm_regrid,ccr)                    
  copy_VarCoords_1(sm22,ccr)
  wks  = gsn_open_wks("png","corel")             ; send graphics to PNG file
res                      = True                ; make plot mods
res@cnFillOn             = True                ; turn on color
  res@cnFillPalette        = "BlWhRe"            ; set color map
res@cnLinesOn            = False               ; turn off contour lines
  res@cnLevelSelectionMode = "ManualLevels"      ; manually set cn levels
  res@cnMinLevelValF       = 0                ; min level
  res@cnMaxLevelValF       = 1                 ; max level
  res@cnLevelSpacingF      = 0.1   
  res@mpMinLonF = 82
  res@mpMaxLonF = 98
  res@mpMinLatF = 34
  res@mpMaxLatF = 40               ; contour level spacing
  res@cnLabelBarEndStyle   = "ExcludeOuterBoxes" ; remove the two end boxes from the labelbar
  res@pmLabelBarWidthF     = 0.8
  lag                      = 0
  res@tiMainString         = "Correlations at lag "+lag
  plot = gsn_csm_contour_map(wks,ccr(:,:),res)
  end




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

新浪微博达人勋

发表于 2018-8-15 18:06:55 | 显示全部楼层
应该是经纬度信息没有正确读进去,我以前也遇到过,http://bbs.06climate.com/forum.php?mod=viewthread&tid=52976,你看看这个帖子,不知道能不能帮到你
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-8-15 20:47:10 | 显示全部楼层
Soaring 发表于 2018-8-15 18:06
应该是经纬度信息没有正确读进去,我以前也遇到过,http://bbs.06climate.com/forum.php?mod=viewthread&ti ...

感谢感谢,还是有帮助,能直接出到矩形的图了,但是在想要做相关性检验的时候还是会出现读不到经纬度的情况。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-8-25 10:51:33 | 显示全部楼层
建议是找一个有标准经纬的地图,把现有的数据插值到标准经纬的地图上,这样以后在哪儿用都是直接读取的老方法。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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