<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>[1] Mary is correct. The sample file is using a <b>rectilinear</b> grid. Hence, NCL's <b>coordinate subscripting</b> (<b> {...} </b>) can be used.</div><div><br></div><div>[2] The grid for 'tos_Omon_IPSL-CM5A-LR_historical_r1i1p1_185001-200512.nc is <b>curvilinear. </b>Mary offered one appraoch. Here is another approach.<br><br> f = <b>addfile</b>("tos_Omon_IPSL-CM5A-LR_historical_r1i1p1_185001-200512.nc" ,"r")<br> x = f->tos ; (ntim,nlat,mlon)<br> lat2d = f->lat ; (nlat,mlon)<br> lon2d = f->lon<br><br>;---Set all values outside of NINO-3.4 region to _FillValue<br><br> LAT2D = <b>conform</b>(x, lat2d, (/1,2/)) ; (ntim,nlat,mlon)<br> LON2D = <b>conform</b>(x, lon2d, (/1,2/)) ; (ntim,nlat,mlon)<br><br> x = where(LAT2D.ge.latS .and. LAT2D.le.latN .and. \<br> LON2D.ge.lonL .and. LON2D.le.lonR \<br> ,x, x@_FillValue)<br> delete( [/ LAT2D, LON2D /] ) ; no longer needed<br></div><div><br></div><div>is a curvilinear grid.</div><div><br></div><div><span style="color:rgb(0,0,255)"><b>The rest is almost identical to the example.</b></span></div><div><br></div><div>;---Create a monthly climatology<br><br> xClm = clmMonTLL(x)<br> printVarSummary(xClm) ; (nmos,nlat,mlon)<br> printMinMax(xClm,0)<br> print("---")<br><br>;---Calculate anomalies at each grid point<br><br> xAnom = calcMonAnomTLL(x, xClm)<br> printVarSummary(xAnom) ; (ntim,nlat,mlon)<br> printMinMax(xAnom,0)<br> print("---")<br><br>;---Weighted areal averages & anomalies (time series)<br>;---Really: No need to weight ... small latitudinal extent<br><br> wgt2 = cos(0.01745329*lat2d) ; (nlat,mlon)<br><br> xAvg = wgt_areaave2(x, wgt2, 0)<br> copy_VarCoords(x(:,0,0), xAvg)<br> xAvg@long_name = "NONO34 areal avg"<br> printVarSummary(xAvg) ; (ntim)<br> printMinMax(xAvg,0)<br> print("---")<br><br> xAnomAvg = wgt_areaave2(xAnom, wgt2, 0) ; (ntim)<br> copy_VarCoords(x(:,0,0), xAnomAvg)<br> xAnomAvg@long_name = <b>"NINO34</b> areal avg anomalies: ENSO34 Index"<br> printVarSummary(xAnomAvg)<br> printMinMax(xAnomAvg,0)<br> print("---")<br><br>;---Compute standardized anomalies<br><br> xAnomStd = xAnomAvg/stddev(xAnomAvg) ; (ntim)<br> copy_VarCoords(xAnomAvg, xAnomStd)<br> xAnomStd@long_name = "<b>Standardized NINO34</b>"<br> printVarSummary(xAnomStd)<br> printMinMax(xAnomStd,0)<br> print("---")<br><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Nov 17, 2018 at 3:59 PM Mary Haley <<a href="mailto:haley@ucar.edu">haley@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Dear Kwesi,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You didn't provide a script, but my guess is that you are trying to subscript your data array using latitude / longitude coordinates, similar to this line which was in the original script:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"> X = mon_fullyear( in->SST(:,{latS:latN},{lonL:lonR}), 0) </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The original example was written for data on a rectilinear lat/lon grid that has latitude/longitude coordinate arrays.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Your data is curvilinear, which means it is represented by 2D lat/lon arrays. It does have coordinate arrays attached to it, but they are simply integer indexes and NOT lat/lon coordinate arrays:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"> int j(j) ;</div><div class="gmail_default" style="font-size:small"> j:units = "1" ;</div><div class="gmail_default" style="font-size:small"> j:long_name = "cell index along second dimension" ;</div><div class="gmail_default" style="font-size:small"> int i(i) ;</div><div class="gmail_default" style="font-size:small"> i:units = "1" ;</div><div class="gmail_default" style="font-size:small"> i:long_name = "cell index along first dimension" ;</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you need to subset your data using lat/lon coordinates, you will need to either use the <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" target="_blank">getind_latlon2d</a> function or the <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtml" target="_blank">region_ind</a> function. You can see some examples at:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/latlon_subset.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/latlon_subset.shtml</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">Look at either latlon_subset_2.ncl or latlon_subset_3.ncl.</div><div class="gmail_default"><br></div><div class="gmail_default">Good luck,</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Nov 17, 2018 at 7:57 AM Kwesi A. Quagraine <<a href="mailto:starskykwesi@gmail.com" target="_blank">starskykwesi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Hello Nclers,</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">I am experiencing an error when calculating Nino34 index (<a href="https://www.ncl.ucar.edu/Applications/Scripts/indices_nino_1.ncl" style="margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif;font-size:13.3333px;font-variant-ligatures:normal" target="_blank">indices_nino_1.ncl</a>) using CMIP5 models; The error message is; fatal:Coordinate subscript type mismatch. Subscript (2) can not be coerced to type of coordinate variable, subscript (0).</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Ncdump of file gives;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px">netcdf tos_Omon_IPSL-CM5A-LR_historical_r1i1p1_185001-200512 {</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px">dimensions:</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> time = UNLIMITED ; // (1872 currently)</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> j = 149 ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> i = 182 ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> bnds = 2 ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> vertices = 4 ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px">variables:</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> double time(time) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> time:bounds = "time_bnds" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> time:units = "days since 1850-01-01 00:00:00" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> time:calendar = "noleap" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> time:axis = "T" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> time:long_name = "time" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> time:standard_name = "time" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> double time_bnds(time, bnds) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> int j(j) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> j:units = "1" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> j:long_name = "cell index along second dimension" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> int i(i) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> i:units = "1" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> i:long_name = "cell index along first dimension" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> float lat(j, i) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lat:standard_name = "latitude" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lat:long_name = "latitude coordinate" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lat:units = "degrees_north" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lat:bounds = "lat_vertices" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> float lon(j, i) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lon:standard_name = "longitude" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lon:long_name = "longitude coordinate" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lon:units = "degrees_east" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lon:bounds = "lon_vertices" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> float lat_vertices(j, i, vertices) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lat_vertices:units = "degrees_north" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> float lon_vertices(j, i, vertices) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> lon_vertices:units = "degrees_east" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> float tos(time, j, i) ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:standard_name = "sea_surface_temperature" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:long_name = "Sea Surface Temperature" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:comment = "\"this may differ from \"\"surface temperature\"\" in regions of sea ice.\"" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:units = "K" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:original_name = "sosstsst" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:original_units = "degC" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:history = "2011-07-04T20:18:27Z altered by CMOR: Converted units from \'degC\' to \'K\'. 2011-07-04T20:18:27Z altered by CMOR: replaced missing value flag (9.96921e+36) with standard missing value (1e+20)." ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:cell_methods = "time: mean (interval: 30 minutes)" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:cell_measures = "area: areacello" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:missing_value = 1.e+20f ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:_FillValue = 1.e+20f ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:associated_files = "baseURL: <a href="http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation" target="_blank">http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation</a> gridspecFile: gridspec_ocean_fx_IPSL-CM5A-LR_historical_r0i0p0.nc areacello: areacello_fx_IPSL-CM5A-LR_historical_r0i0p0.nc" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> tos:coordinates = "lat lon" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"><br></div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px">// global attributes:</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> :institution = "IPSL (Institut Pierre Simon Laplace, Paris, France)" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> :institute_id = "IPSL" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="margin:0px"> :experiment_id = "historical" ;</div><div id="m_-6921124206613245622m_-7990664746149633535bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"> :source = "IPSL-CM5A-LR (2010) : atmos : LMDZ4 (LMDZ4_v5, 96x95x39); ocean : ORCA2 (NEMOV2_3, 2x2L31); seaIce : LIM2 (NEMOV2_3); ocnBgchem : PISCES (NEMO: </div><div><br></div>Any help on this will be much appreciated. Thanks in advance.<div><br></div><div>Best regards</div><div>Kwesi<br><div id="m_-6921124206613245622m_-7990664746149633535bloop_sign_1542465931437791744" class="m_-6921124206613245622m_-7990664746149633535bloop_sign"><font face="helvetica, arial">------------ </font><br><div style="font-family:helvetica,arial;font-size:13px">Try not to become a man of success but rather a man of value- Albert Einstein</div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px"><br></span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Kwesi A. Quagraine</span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Department of Physics</span></font></div><div><font face="Helvetica"><span style="font-size:12px">School of Physical Sciences</span></font></div><div><font face="Helvetica"><span style="font-size:12px">College of Agriculture and Natural Sciences</span></font></div><div><font face="Helvetica"><span style="font-size:12px">University of Cape Coast</span></font></div><div><font face="Helvetica"><span style="font-size:12px">Cape Coast, Ghana</span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px"><br></span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Alt. Email: <a href="mailto:kwesi@csag.uct.ac.za" target="_blank">kwesi@csag.uct.ac.za</a> </span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Web: <a href="http://www.recycleupghana.org/" target="_blank">http://www.recycleupghana.org/</a> <br></span></font></div><div style="font-family:helvetica,Arial;font-size:13px"><font face="Helvetica"><span style="font-size:12px">Office: +27 21 650 3164</span></font></div><div><font face="Helvetica"><span style="font-size:12px">Skype: quagraine_cwasi</span></font></div></div></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><br>
</blockquote></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><br>
</blockquote></div>