爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3179|回复: 0

NCL官网mjoclivar_7对uwnd作图时报错

[复制链接]

新浪微博达人勋

发表于 2022-2-20 20:18:47 | 显示全部楼层 |阅读模式
GrADS
系统平台:
问题截图:
问题概况: NCL官网上mjoclivar_7对uwnd作图时出现错误,想请教大佬如何解决
我看过提问的智慧: 看过
自己思考时长(天): 4

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

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

x
mjoclivar例子7对1979-2020年uwnd作图时出现错误:Number of dimensions in parameter (0) of (mjo_spectra) is (4), (3) dimensions were expected
请教各位大佬这是什么原因呢
程序脚本如下:
; 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"   
;
; These files still have to be loaded manually
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"   

begin
                           ; time window
  twStrt = 19790101        
  twLast = 20201231

; diri   = "/Users/shea/Data/AMWG/"

  diri   = "/home/u/"            ; new input directory

;vName  = "U_anom"        ; name of variable on the file
;fili   = "uwnd.day.850.anomalies.1980-2005.nc"

  vName  = "uwnd"      ; name of variable on the file
  fili   = "uwnd.850.1979-2020.nc"
  f      = addfile(diri+fili, "r")  

  nameRegion = (/ "IO" , "WP" /)
  latS       = (/ -10. , -20.  /)      
  latN       = (/   5. ,  -5.  /)
  lonL       = (/  75. , 160.  /)
  lonR       = (/ 100. , 185.  /)

  nRegion = dimsizes(nameRegion)
  nBounds = dimsizes(latS)

  if (nRegion.ne.nBounds) then
      print("mjo_spectra: nRegion and nBounds do not match")
      print("             nRegion="+nRegion )
      print("             nBounds="+nBounds )
      exit
  end if

  pltDir  = "./"                     ; plot directory
  pltType = "png"                    ; send graphics to PNG file     
  pltName = "mjoclivar"

;************************************************************
; time indices corresponding to the desired time window
;************************************************************

  date  = cd_calendar(f->time, -2)   ; entire file
  iStrt = ind(date.eq.twStrt)        ; desired dates
  iLast = ind(date.eq.twLast)
  delete(date)

;************************************************************
; Read user specified period
;************************************************************

  if (getfilevartypes(f,vName) .eq. "short") then
      X = short2flt( f->uwnd(iStrt:iLast,:,:) ) ; all data in window
  else
      X = f->uwnd(iStrt:iLast,:,:,:)
  end if
  printVarSummary( X )
  printMinMax(X, True)

  time  = X&time                     ; clarity
  date  = cd_calendar( time , -2 )   ; yyyymmdd

  lat   = f->lat
  wgty  = cos(0.01745329*lat)       ; MJO CLivar specify cos(lat)
  copy_VarCoords(lat, wgty)

;************************************************************
; driver to calculate and plot the spectra
;************************************************************

  optMJO= True
;;optMJO@spcConLim = (/ 0.10, 0.90/)
  mjo_spectra (X, date, wgty, latS, latN, lonL, lonR, nameRegion \
              ,pltDir, pltType, pltName, optMJO)

end



4.jpg
3.jpg
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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