<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Sam,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I tried to download your NCL script, but the link said it was "deleted by the owner".</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To make sure I understand you correctly, are you saying that when you select the range of interest, there are some lat/lon points that are identical, and hence NCL errors out because it doesn't know how to contour data that has duplicate lat/lon points?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I wrote a small script to see if I could reproduce your problem, but I couldn't get it to error in the way you said yours did . Here's the script, which doesn't produce a very pleasing plot because it basically ends up with 3 points that it can contour:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace">  in258 = addfile("<a href="http://CalCOFI_temp_sal_on_25.8_isopycnal_by_cruise.nc">CalCOFI_temp_sal_on_25.8_isopycnal_by_cruise.nc</a>","r")</font></div><div class="gmail_default"><font face="monospace, monospace">  s258  = in258->r_salinity                      ; read all salinities</font></div><div class="gmail_default"><font face="monospace, monospace">  lat3  = in258->latitude</font></div><div class="gmail_default"><font face="monospace, monospace">  lon3  = in258->longitude</font></div><div class="gmail_default"><font face="monospace, monospace">  time3 = in258->time</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">  printVarSummary(s258)</font></div><div class="gmail_default"><font face="monospace, monospace">  printMinMax(s258,0)</font></div><div class="gmail_default"><font face="monospace, monospace">  printVarSummary(lat3)</font></div><div class="gmail_default"><font face="monospace, monospace">  printVarSummary(lon3)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">  sal_val = 33.78     ; Salinity value to search on</font></div><div class="gmail_default"><font face="monospace, monospace">  delta   = 0.025     ; based on delta range</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">  sal_val_min = sal_val - delta</font></div><div class="gmail_default"><font face="monospace, monospace">  sal_val_max = sal_val + delta</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">  ind_sal = ind(sal_val_min.le.s258.and.s258.le.sal_val_max)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">  s258_subset = s258(ind_sal)</font></div><div class="gmail_default"><font face="monospace, monospace">  lat3_subset = lat3(ind_sal)</font></div><div class="gmail_default"><font face="monospace, monospace">  lon3_subset = lon3(ind_sal)</font></div><div class="gmail_default"><font face="monospace, monospace">  print(lat3_subset + " " +  lon3_subset + " " + s258_subset)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">  s258_subset@lat1d = lat3_subset</font></div><div class="gmail_default"><font face="monospace, monospace">  s258_subset@lon1d = lon3_subset</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">  wks = gsn_open_wks("x11","salinity_test")</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">  res = True</font></div><div class="gmail_default"><font face="monospace, monospace">  res@gsnMaximize = True</font></div><div class="gmail_default"><font face="monospace, monospace">  res@cnFillOn    = True</font></div><div class="gmail_default"><font face="monospace, monospace">  res@cnLinesOn   = False</font></div><div class="gmail_default"><font face="monospace, monospace">  res@cnFillMode  = "RasterFill"</font></div><div class="gmail_default"><font face="monospace, monospace">  res@mpMinLatF   = min(lat3)</font></div><div class="gmail_default"><font face="monospace, monospace">  res@mpMinLonF   = min(lon3)</font></div><div class="gmail_default"><font face="monospace, monospace">  res@mpMaxLatF   = max(lat3)</font></div><div class="gmail_default"><font face="monospace, monospace">  res@mpMaxLonF   = max(lon3)</font></div><div class="gmail_default"><font face="monospace, monospace">  plot = gsn_csm_contour_map(wks,s258_subset,res)</font></div><div class="gmail_default"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 16, 2018 at 6:09 PM, Sam McClatchie <span dir="ltr"><<a href="mailto:smcclatchie@fishocean.info" target="_blank">smcclatchie@fishocean.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Hello<br>
    <br>
    I have an annoyingly simple problem. I want to plot salinity on an
    isopycnal surface for about 75 oceanographic stations (where there
    are depth profiles) arranged on an irregularly spaced, ragged grid.
    The data are in a flat netcdf file that cannot be read by the
    Climate Data Operators.<br>
    <br>
    ------------------------------<wbr>------<br>
    <br>
smcc@jaguar:/data/dynamic_<wbr>data/projects/projects2018/<wbr>visualization/data$
    ncdump -h <a href="http://CalCOFI_temp_sal_on_26.5_isopycnal_by_cruise.nc" target="_blank">CalCOFI_temp_sal_on_26.5_<wbr>isopycnal_by_cruise.nc</a><br>
    netcdf CalCOFI_temp_sal_on_26.5_<wbr>isopycnal_by_cruise {<br>
    dimensions:<br>
        row = 62 ;<br>
        sta_id_strlen = 11 ;<br>
    variables:<br>
        char sta_id(row, sta_id_strlen) ;<br>
            sta_id:_Encoding = "ISO-8859-1" ;<br>
            sta_id:coordinates = "time latitude longitude" ;<br>
            sta_id:description = "8-digit CalCOFI line and station
    designation" ;<br>
            sta_id:ioos_category = "Identifier" ;<br>
            sta_id:long_name = "Line and Station" ;<br>
        int r_depth(row) ;<br>
            r_depth:actual_range = 125, 271 ;<br>
            r_depth:coordinates = "time latitude longitude" ;<br>
            r_depth:description = "Reported Depth the bottle was
    tripped" ;<br>
            r_depth:ioos_category = "Identifier" ;<br>
            r_depth:long_name = "Reported Bottle Depth" ;<br>
            r_depth:units = "meters" ;<br>
        float r_temp(row) ;<br>
            r_temp:actual_range = 7.83f, 9.04f ;<br>
            r_temp:coordinates = "time latitude longitude" ;<br>
            r_temp:description = "Reported Temperature of water at the
    depth the bottle was tripped" ;<br>
            r_temp:ioos_category = "Temperature" ;<br>
            r_temp:long_name = "Reported Temperature" ;<br>
            r_temp:units = "degree C" ;<br>
        float r_salinity(row) ;<br>
            r_salinity:actual_range = 33.975f, 34.215f ;<br>
            r_salinity:coordinates = "time latitude longitude" ;<br>
            r_salinity:description = "Practical Salinity Scale, 1978
    (UNESCO, 1981a)" ;<br>
            r_salinity:ioos_category = "Salinity" ;<br>
            r_salinity:long_name = "Reported Salinity" ;<br>
            r_salinity:units = "psu" ;<br>
        float r_sigma(row) ;<br>
            r_sigma:actual_range = 26.475f, 26.525f ;<br>
            r_sigma:coordinates = "time latitude longitude" ;<br>
            r_sigma:ioos_category = "Other" ;<br>
            r_sigma:long_name = "Reported Potential Density of water" ;<br>
        float latitude(row) ;<br>
            latitude:_CoordinateAxisType = "Lat" ;<br>
            latitude:actual_range = 30.186f, 36.709f ;<br>
            latitude:axis = "Y" ;<br>
            latitude:ioos_category = "Location" ;<br>
            latitude:long_name = "Latitude" ;<br>
            latitude:standard_name = "latitude" ;<br>
            latitude:units = "degrees_north" ;<br>
        float longitude(row) ;<br>
            longitude:_CoordinateAxisType = "Lon" ;<br>
            longitude:actual_range = -124.637f, -117.533f ;<br>
            longitude:axis = "X" ;<br>
            longitude:ioos_category = "Location" ;<br>
            longitude:long_name = "Longitude" ;<br>
            longitude:standard_name = "longitude" ;<br>
            longitude:units = "degrees_east" ;<br>
        double time(row) ;<br>
            time:_CoordinateAxisType = "Time" ;<br>
            time:actual_range = 1365319440., 1367199780. ;<br>
            time:axis = "T" ;<br>
            time:description = "Time" ;<br>
            time:ioos_category = "Time" ;<br>
            time:long_name = "Time" ;<br>
            time:standard_name = "time" ;<br>
            time:time_origin = "01-JAN-1970 00:00:00" ;<br>
            time:units = "seconds since 1970-01-01T00:00:00Z" ;<br>
    <br>
    // global attributes:<br>
            :acknowledgment = "University of California, San Diego
    Scripps Institution" ;<br>
            :cdm_data_type = "Point" ;<br>
            :Conventions = "COARDS, CF-1.6, Unidata Dataset Discovery
    v1.0" ;<br>
            :date_issued = "2013-07-17" ;<br>
            :date_modified = "2013-07-17" ;<br>
            :Easternmost_Easting = -117.533f ;<br>
            :featureType = "Point" ;<br>
            :geospatial_lat_max = 36.709f ;<br>
            :geospatial_lat_min = 30.186f ;<br>
            :geospatial_lat_units = "degrees_north" ;<br>
            :geospatial_lon_max = -117.533f ;<br>
            :geospatial_lon_min = -124.637f ;<br>
            :geospatial_lon_units = "degrees_east" ;<br>
            :history = "2018-04-22T00:58:55Z (source database)\n",<br>
                "2018-04-22T00:58:55Z <a class="m_-2129363628635464397moz-txt-link-freetext" href="http://oceanview.pfeg.noaa.gov/erddap/tabledap/siocalcofiHydroBottleReport.ncCF?sta_id%2Cr_depth%2Cr_temp%2Cr_salinity%2Cr_sigma%2Clatitude%2Clongitude%2Ctime&r_sigma%3E=26.475&r_sigma%3C=26.525&time%3E=2013-03-01T12%3A52%3A58Z&time%3C=2013-05-01T12%3A52%3A58Z" target="_blank">http://oceanview.pfeg.noaa.<wbr>gov/erddap/tabledap/<wbr>siocalcofiHydroBottleReport.<wbr>ncCF?sta_id%2Cr_depth%2Cr_<wbr>temp%2Cr_salinity%2Cr_sigma%<wbr>2Clatitude%2Clongitude%2Ctime&<wbr>r_sigma%3E=26.475&r_sigma%3C=<wbr>26.525&time%3E=2013-03-01T12%<wbr>3A52%3A58Z&time%3C=2013-05-<wbr>01T12%3A52%3A58Z</a>"
    ;<br>
            :id = "siocalcofiHydroBottleReport_<wbr>3bf6_a84f_a01b" ;<br>
            :infoUrl = <a class="m_-2129363628635464397moz-txt-link-rfc2396E" href="http://www.calcofi.org/new.data/index.php/reporteddata/2013-09-30-23-23-27/database-tables-description" target="_blank">"http://www.calcofi.org/new.<wbr>data/index.php/reporteddata/<wbr>2013-09-30-23-23-27/database-<wbr>tables-description"</a>
    ;<br>
            :institution = "UCSD SIO" ;<br>
            :license = "The data may be used and redistributed for free
    but is not intended\n",<br>
                "for legal use, since it may contain inaccuracies.
    Neither the data\n",<br>
                "Contributor, ERD, NOAA, nor the United States
    Government, nor any\n",<br>
                "of their employees or contractors, makes any warranty,
    express or\n",<br>
                "implied, including warranties of merchantability and
    fitness for a\n",<br>
                "particular purpose, or assumes any legal liability for
    the accuracy,\n",<br>
                "completeness, or usefulness, of this information." ;<br>
            :Northernmost_Northing = 36.709f ;<br>
            :project = "CalCOFI" ;<br>
            :publisher_email = <a class="m_-2129363628635464397moz-txt-link-rfc2396E" href="mailto:jwilkinson@ucsd.edu" target="_blank">"jwilkinson@ucsd.edu"</a> ;<br>
            :publisher_name = "James Wilkinson" ;<br>
            :sourceUrl = "(source database)" ;<br>
            :Southernmost_Northing = 30.186f ;<br>
            :standard_name_vocabulary = "CF-11" ;<br>
            :subsetVariables = "sta_id" ;<br>
            :summary = "SIO Hydrographic data" ;<br>
            :time_coverage_end = "2013-04-29T01:43:00Z" ;<br>
            :time_coverage_start = "2013-04-07T07:24:00Z" ;<br>
            :title = "CalCOFI SIO Hydrographic Bottle Report data" ;<br>
            :Westernmost_Easting = -124.637f ;<br>
    <br>
    ------------------------------<wbr>----------------------<br>
    To obtain enough salinity points on the density surface (26.5 for
    example), I selected the data based on a small range of densities
    (+/- 0.025). This means that at a few (time,lat,long) stations there
    is more than one density point in the range. Consequently, I obtain
    some (time,lat,long) stations where there is more than one salinity
    selected for the isopycnal, and this causes the contour plot to
    fail.<br>
    <br>
    Here is my question:<br>
    Since I cannot use CDO with this netcdf file (it is not the right
    format of netcdf), can I select and eliminate the duplicates
    efficiently in NCL? <br>
    ------------------------------<wbr>------------------<br>
    I was thinking something like this?<br>
    <br>
    in258 =
    addfile("../data/<a href="http://CalCOFI_temp_sal_on_25.8_isopycnal_by_cruise.nc" target="_blank">CalCOFI_temp_<wbr>sal_on_25.8_isopycnal_by_<wbr>cruise.nc</a>","r")<br>
      s258  = in258->r_salinity             <wbr>         ; read all
    salinities<br>
      lat3  = in258->latitude<br>
      lon3  = in258->longitude<br>
      time3 = in258->time<br>
      ; printVarSummary(s258)<br>
      ; printVarSummary(lat3)<br>
      ; printVarSummary(lon3)<br>
      ; print(time3)<br>
      ; print(get_unique_values(time3)<wbr>)<br>
    <br>
      x     = (/ (/time3/),(/lat3/),(/lon3/),(/<wbr>s258/) /)<br>
       print(x)<br>
      x1D   = ndtooned(x)<br>
       print(x1D)<br>
      i1D   = ind(get_unique_values(x1D(0,??<wbr>))); need to index the
    original position of unique times<br>
      exit()<br>
      i     = ind_resolve(i1D, dimsizes(x) )<br>
    ------------------------------<wbr>--------------------<br>
    <br>
    The plot I am working on is here: <br>
    <a class="m_-2129363628635464397moz-txt-link-rfc2396E" href="https://my.pcloud.com/publink/show?code=XZLSJf7ZOh5xn41l5yVWQTzpE2Y5zyTG0LeX" target="_blank">"https://my.pcloud.com/<wbr>publink/show?code=<wbr>XZLSJf7ZOh5xn41l5yVWQTzpE2Y5zy<wbr>TG0LeX"</a><br>
    <br>
    The NCL code is here:<br>
    <a class="m_-2129363628635464397moz-txt-link-rfc2396E" href="https://my.pcloud.com/publink/show?code=XZMSJf7Za13geSDAd0hh0ppltNa2PHkfYBUk" target="_blank">"https://my.pcloud.com/<wbr>publink/show?code=<wbr>XZMSJf7Za13geSDAd0hh0ppltNa2PH<wbr>kfYBUk"</a><br>
    <br>
    The data are here:<br>
    <a class="m_-2129363628635464397moz-txt-link-rfc2396E" href="https://my.pcloud.com/publink/show?code=XZASJf7Z5CO19wADqnbAHt5NQa10RhaXr91X" target="_blank">"https://my.pcloud.com/<wbr>publink/show?code=<wbr>XZASJf7Z5CO19wADqnbAHt5NQa10Rh<wbr>aXr91X"</a><br>
    <br>
    Thanks in advance,<br>
    Sam<br>
    <div class="m_-2129363628635464397moz-signature">-- <br>
      
      
      Sam McClatchie (fisheries oceanographer)<br>
      & Elena Turin (accounting & auditing)<br>
      FishOcean Enterprises<br>
      38 Upland Rd, Huia, Auckland 0604, New Zealand<br>
      cell: 027 752 8495<br>
      <span style="text-decoration:underline"><a href="http://www.fishocean.info" target="_blank">Internet</a></span><br>
      <img style="width:150px;height:149px" alt="" src="cid:part8.A7615CE3.C43F8140@fishocean.info"><br>
      <br>
      "The time has come", the tui said,<br>
      "to talk of many things:<br>
      Of songs - and ferns - and flowering flax,<br>
      of Pukekos and dreams ..."<br>
      <br>
      (not Lewis Carroll) </div>
  </div>

<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>