[ncl-talk] Using wkSpaceTime2

Mckinnon-Gray, Elliot elliot.mckinnon-gray at mpimet.mpg.de
Thu Aug 22 10:10:28 MDT 2019


So I’m trying to plot idealised Kelvin waves (only) on a WK spectrum, using wkSpaceTime2. This method has worked for me using the ECMWF OA product, but the model output from this analytical KW keeps kicking up this error:

fatal:["NclFile.c":2100]:Subscript out of range, error in subscript #1
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 25 in file WKST2.ncl

fatal:Variable (U) is undefined
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 35 in file WKST2.ncl

and here is the code:

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/csm/diagnostics_cam.ncl"

;==================================================================
;                     USER INTERFACE
;                   MAIN DRIVER SCRIPT
;==================================================================
  case     = "KW_k1-15_3Heqs"
  diro     = "./"     ; output dir: location of plots


  VAR      = "U200"
  diri     = "./"
  fili     = "KW_k1-15_3Heqs.nc"

  nDayWin  = 96       ; Wheeler-Kiladis [WK] temporal window length (days)
  nDaySkip = -65      ; time (days) between temporal windows [segments]
                      ; negative means there will be overlapping temporal segments
  latBound = 15       ; 15N lat

                      ; get data
  f        = addfile (diri+fili, "r")
  U        = f->u(0:1460,1,{latBound:-latBound},:)   ; [time | 1461] x [lat | 15] x [lon | 256]
  spd      = 4        ;


  opt      = True
  opt at debug       = True
  opt at pltType     = "eps"        ; create encapsulated postscript

  opt at pltColorMap = "GMT_haxby"       ; change the default color map

  wkSpaceTime (U,  diro, case, VAR             \
              ,latBound, spd , nDayWin, nDaySkip, opt  )


and here is the metadata from the model output:

netcdf KW_k1-15_3Heqs {
dimensions:
lon = 256 ;
lat = 128 ;
lev = 1 ;
time = 1461 ;
variables:
float lat(lat) ;
lat:units = "degrees_north" ;
float lon(lon) ;
lon:units = "degrees_east" ;
float lev(lev) ;
lev:units = "model level" ;
float time(time) ;
time:units = "hours since 2007-01-01 00:00:00" ;
float gp(time, lev, lat, lon) ;
gp:units = "m**2 s**-2" ;
float u(time, lev, lat, lon) ;
u:units = "m s**-1" ;
}


I have tried so many different attacks to try and get this to work, with varying degrees of success, but I’ve not been able to get any plots using this wkSpaceTime2 skeleton code. My suspicion is that it may be to do with the units of time in the .nc file, but I don’t think I understand the script well enough to know why, but I imagine there is some NCO or CDO command to change the units of time? Anyway, if this looks like something familiar to anyone I would be most grateful if you would be able to help me solve this problem.

Cheers,

Elliot McKinnon-Gray
—
Doktorand, International Max Planck Research School for Earth System Modelling IMPRS-ESM
Meteorological Institute, Universität Hamburg, Room 4012 GB7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190822/f55a0cfb/attachment.html>


More information about the ncl-talk mailing list