[ncl-talk] Using wkSpaceTime2

Rick Brownrigg brownrig at ucar.edu
Thu Aug 22 10:21:35 MDT 2019


Hi Elliot,

It would look like the script is failing on extracting the data for U at
this line (line #25)

  U        = f->u(0:1460,1,{latBound:-latBound},:)   ; [time | 1461] x [lat
| 15] x [lon | 256]

so that likely the fundamental problem has nothing to do with wkSpaceTime.
Its a subscripting error, and I wonder if the coordinate subscripts for the
latitude dimension are correct? (is it really 15 to -15? Perhaps
vice-versa?)  A printVarSummary(f-->u) might be useful

Hope that helps...
Rick


On Thu, Aug 22, 2019 at 10:11 AM Mckinnon-Gray, Elliot via ncl-talk <
ncl-talk at ucar.edu> wrote:

> 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
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190822/9caf830f/attachment.html>


More information about the ncl-talk mailing list