<div dir="ltr"><div>Hi Elliot,</div><div><br></div><div>It would look like the script is failing on extracting the data for U at this line (line #25)<br></div><div><br></div><div><div><font face="Monaco">  U        = f->u(0:1460,1,{latBound:-latBound},:)   ; [time | 1461] x [lat | 15] x [lon | 256]</font></div></div><div><br></div><div><font face="Monaco">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</font></div><div><br></div><div>Hope that helps...</div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 22, 2019 at 10:11 AM Mckinnon-Gray, Elliot via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div style="overflow-wrap: break-word;">
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:
<div><br>
</div>
<div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures">fatal:["NclFile.c":2100]:Subscript out of range, error in subscript #1</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 25 in file WKST2.ncl</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252);min-height:19px">
<span style="font-variant-ligatures:no-common-ligatures"></span><br>
</div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures">fatal:Variable (U) is undefined</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 35 in file WKST2.ncl</span></div>
</div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div>and here is the code:</div>
<div><br>
</div>
<div>
<div><font face="Monaco">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</font></div>
<div><font face="Monaco">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</font></div>
<div><font face="Monaco">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</font></div>
<div><font face="Monaco">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"</font></div>
<div><font face="Monaco"><br>
</font></div>
<div><font face="Monaco">;==================================================================</font></div>
<div><font face="Monaco">;                     USER INTERFACE </font></div>
<div><font face="Monaco">;                   MAIN DRIVER SCRIPT</font></div>
<div><font face="Monaco">;==================================================================</font></div>
<div><font face="Monaco">  case     = "KW_k1-15_3Heqs"</font></div>
<div><font face="Monaco">  diro     = "./"     ; output dir: location of plots </font></div>
<div><font face="Monaco"><br>
</font></div>
<div><font face="Monaco"><br>
</font></div>
<div><font face="Monaco">  VAR      = "U200"</font></div>
<div><font face="Monaco">  diri     = "./"</font></div>
<div><font face="Monaco">  fili     = "KW_k1-15_3Heqs.nc"</font></div>
<div><font face="Monaco"><br>
</font></div>
<div><font face="Monaco">  nDayWin  = 96       ; Wheeler-Kiladis [WK] temporal window length (days)</font></div>
<div><font face="Monaco">  nDaySkip = -65      ; time (days) between temporal windows [segments]</font></div>
<div><font face="Monaco">                      ; negative means there will be overlapping temporal segments</font></div>
<div><font face="Monaco">  latBound = 15       ; 15N lat </font></div>
<div><font face="Monaco"><br>
</font></div>
<div><font face="Monaco">                      ; get data </font></div>
<div><font face="Monaco">  f        = addfile (diri+fili, "r")</font></div>
<div><font face="Monaco">  U        = f->u(0:1460,1,{latBound:-latBound},:)   ; [time | 1461] x [lat | 15] x [lon | 256]</font></div>
<div><font face="Monaco">  spd      = 4        ;</font></div>
<div><font face="Monaco">                   </font></div>
<div><font face="Monaco"><br>
</font></div>
<div><font face="Monaco">  opt      = True</font></div>
<div><font face="Monaco">  opt@debug       = True   </font></div>
<div><font face="Monaco">  opt@pltType     = "eps"        ; create encapsulated postscript</font></div>
<div><font face="Monaco"><br>
</font></div>
<div><font face="Monaco">  opt@pltColorMap = "GMT_haxby"       ; change the default color map</font></div>
<div><font face="Monaco"><br>
</font></div>
<div><font face="Monaco">  wkSpaceTime (U,  diro, case, VAR             \</font></div>
<div><font face="Monaco">              ,latBound, spd , nDayWin, nDaySkip, opt  )</font></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>and here is the metadata from the model output:</div>
<div><br>
</div>
<div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures">netcdf KW_k1-15_3Heqs {</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures">dimensions:</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>lon = 256 ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>lat = 128 ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>lev = 1 ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>time = 1461 ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures">variables:</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>float lat(lat) ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>lat:units = "degrees_north" ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>float lon(lon) ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>lon:units = "degrees_east" ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>float lev(lev) ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>lev:units = "model level" ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>float time(time) ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>time:units = "hours since 2007-01-01 00:00:00" ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>float gp(time, lev, lat, lon) ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>gp:units = "m**2 s**-2" ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>float u(time, lev, lat, lon) ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_-1673971437922358127Apple-tab-span" style="white-space:pre-wrap"></span>u:units = "m s**-1" ;</span></div>
<div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco;background-color:rgb(254,255,252)">
<span style="font-variant-ligatures:no-common-ligatures">}</span></div>
</div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">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.</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">Cheers,</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">Elliot McKinnon-Gray  </span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">—</span></div>
<div>Doktorand, International Max Planck Research School for Earth System Modelling IMPRS-ESM</div>
<div>Meteorological Institute, Universität Hamburg, Room 4012 GB7</div>
</div>

_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>