爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 10950|回复: 2

[其他] 【求助】为什么总说mpMinLonF is not a valid resource

[复制链接]
发表于 2021-9-27 22:29:31 | 显示全部楼层 |阅读模式

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

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

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"
begin
  
  
  FILE = systemfunc("ls"+" /cygdrive/L/DJBY/20y_winter/2017_1/*.grib2")

  numFILE = dimsizes(FILE)
      do j = 11,13
        file_list = addfile(FILE(j), "r")
        time=str_get_cols(FILE(j),39,49)
        lon = file_list->lon_0
        lat = file_list->lat_0
        lon@units="degrees_east"
        lat@units="degrees north"
        dlon = (lon(2)-lon(1))*0.0174533
        dlat = (lat(2)-lat(1)) * 0.0174533
        
        ;print(time)
        nlev1=750
        tmpx = file_list->TMP_P0_L100_GLL0({nlev1*100},:,:)
        rhx  = file_list->RH_P0_L100_GLL0({nlev1*100},:,:)
        prsx=nlev1
        esx=(6.112*exp(17.67*(tmpx-273.15)/(tmpx-29.65)))
        qx=rhx*(0.62197*esx/(prsx-esx))/100.
        ex=prsx*qx/(0.62197+qx)+1e-10
        tlclx=55.0+2840.0/(3.5*log(tmpx)-log(ex)-4.805)
        thetax=tmpx*((1000/prsx)^(0.2854*(1.0-0.28*qx)))
        eqtx=thetax*exp(((3376./tlclx)-2.54)*qx*(1.0+0.81*qx))
        vx= file_list->VGRD_P0_L100_GLL0({nlev1*100},:,:)
        ux= file_list->UGRD_P0_L100_GLL0({nlev1*100},:,:)

        nlev2 = 650
        tmpy = file_list->TMP_P0_L100_GLL0({nlev2*100},:,:)
        rhy = file_list->RH_P0_L100_GLL0({nlev2*100},:,:)
        prsy=nlev2
        esy=(6.112*exp(17.67*(tmpy-273.15)/(tmpy-29.65)))
        qy=rhy*(0.62197*esy/(prsy-esy))/100
        ey=prsy*qy/(0.62197+qy)+1e-10
        tlcly=55.0+2840.0/(3.5*log(tmpy)-log(ey)-4.805)
        thetay=tmpy*((1000/prsy)^(0.2854*(1.0-0.28*qy)))
        eqty=thetay*exp(((3376./tlcly)-2.54)*qy*(1.0+0.81*qy))
        vy = file_list->VGRD_P0_L100_GLL0({nlev2*100},:,:)
        uy = file_list->UGRD_P0_L100_GLL0({nlev2*100},:,:)

        nlev3 = 700
        tmpz = file_list->TMP_P0_L100_GLL0({nlev3*100},:,:)
        rhz = file_list->RH_P0_L100_GLL0({nlev3*100},:,:)
        absvprs = file_list->ABSV_P0_L100_GLL0({nlev3*100},:,:)
        prsz = nlev3
        esz = (6.112*exp(17.67*(tmpz-273.15)/(tmpz-29.65)))
        qz = rhz*(0.62197*esz/(prsz-esz))/100.
        ez = prsz*qz/(0.62197+qz)+1e-10
        tlclz = 55.0+2840.0/(3.5*log(tmpz)-log(ez)-4.805)
        thetaz = tmpz*((1000/prsz)^(0.2854*(1.0-0.28*qz)))
        eqtz = thetaz*exp(((3376./tlclz)-2.54)*qz*(1.0+0.81*qz))
        rhz@_FillValue = -999.0
        numlat = dimsizes(lat)
        numlon = dimsizes(lon)
        dtdX=new((/numlat, numlon/), typeof(rhz), rhz@_FillValue)
        
        dtdY=new((/numlat, numlon/), typeof(rhz), rhz@_FillValue)
        do n1=0,numlat-1
          dX = 6378388.*cos(0.0174533*lat(n1))*dlon  ; constant at this latitude
          dtdX(n1:n1,:) = center_finite_diff_n(eqtz(n1:n1,:), dX ,False,0,1)
        end do
        
        do n2=0,numlon-1
           dY = 6378388. * dlat
           dtdY(:,n2:n2) = center_finite_diff_n(eqtz(:,n2:n2), dY, False, 0, 0)
        end do


        eqtxy=eqtx-eqty
        vxy=vx-vy
        uxy=ux-uy

        dp=10000
        mp1=-9.8*absvprs*eqtxy/dp
        mp2=9.8*((vxy/dp)*dtdX-(uxy/dp)*dtdY)
        mpv=mp1+mp2
        mpv2=mp2*1E6
        mpv1=mp1*1E6
        
        
        copy_VarCoords(rhz,mpv1)
        copy_VarCoords(rhz,mpv2)
        wks = gsn_open_wks("png","mpv12_"+time)

        res                              = True
        
        res@mpMaxLatF    = 40                      ; specify the plot domain
        res@mpMinLatF    = 15.                      ;                        
        res@mpMinLonF    = 80.                     ;
        res@mpMaxLonF    = 130.                     ;
        res@pmTickMarkDisplayMode = "Always"
        res@mpOutlineOn  = True                 ; turn the map outline on
        res@mpDataSetName               = "Earth..4"
        res@mpDataBaseVersion           = "MediumRes"
        res@mpOutlineOn                 = True
        res@mpOutlineSpecifiers         = (/"China:states","Taiwan"/)
        res@mpGeophysicalLineThicknessF = 2
        res@mpNationalLineThicknessF    = 2

        res@gsnLeftString                = ""
        res@gsnRightString               = ""
        res@gsnDraw                      = False              ; don't draw
        res@gsnFrame                     = False              ; don't advance frame
        res@gsnLeftStringFontHeightF =0.015

        res@cnSmoothingOn=True
        res@cnSmoothingDistanceF=0.0001
        res@cnSmoothingTensionF=-0.2
        res@cnLinesOn             = False    ; turn of contour lines
        res@cnFillPalette         = "WhiteBlueGreenYellowRed"
        res@cnFillOn                     = True
        res@cnInfoLabelOn                = False              ; disappear lable information
        res@cnLevelSelectionMode     = "ManualLevels"   ; manual contour levels
        res@cnMinLevelValF           = -1.0          ; minimum level
        res@cnMaxLevelValF           = 1.0          ; maximum level
        res@cnLevelSpacingF          =   0.2          ; contour spacing
        
        res@lbBoxMinorExtentF     =0.2
        res@lbTitleFontHeightF        =0.012
        res@lbLabelFontHeightF        =0.013
        res@lbLabelStride  =2
        
        resc=res
        resc@cnFillOn    =    False
        resc@cnLineThicknessesF  =2
        resc@cnLineColor  ="black"
                  
        plot_mpv1 = gsn_csm_contour_map(wks,mpv1,res)
        plot_mpv2 = gsn_csm_contour(wks,mpv2,resc)      ; create the U-wind plot
        overlay(plot_mpv1,plot_mpv2)                       ; overlay the U-wind plot on the temperature plot
        draw(plot_mpv1)                                  ; draw the temperature plot (with the U-wind plot overlaid)
        frame(wks)                                  ; advance the frame
      end do
   
     
     
     
     

  

  


end
密码修改失败请联系微信:mofangbao
发表于 2021-9-29 15:19:01 | 显示全部楼层
不影响出图这个warning可以无视,我也一直有这个 ,但对我的图没什么影响
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2021-12-23 15:25:53 | 显示全部楼层
Not valid说明绘图函数所用到的resource不需要出现not valid的resource,把它删掉就好了,也不会影响画的图。

密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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