<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Lyndon,<br>
    <br>
    first you have to select the sub-region of your data and then get
    the time indices where your data is greater equal than the
    threshold.<br>
    <br>
    Your script should be looking like:<br>
    <br>
    <font color="#3333ff"><tt>begin</tt></font><br>
    <br>
    <font color="#3333ff"><tt>  f =
        addfile("vort_700hPa.nc","r")              ;-- open file</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  vr = f-&gt;vr                                     ;--
        read variable</tt><tt><br>
      </tt><tt>  </tt><tt><br>
      </tt><tt>  time = f-&gt;time                                 ;--
        read time</tt><tt><br>
      </tt><tt>  ntimes = dimsizes(time)                        ;-- get
        size of time</tt><tt><br>
      </tt><tt><br>
      </tt><tt>;-- define sub-region</tt><tt><br>
      </tt><tt>  lat0 =   7.5</tt><tt><br>
      </tt><tt>  lat1 =  27.5</tt><tt><br>
      </tt><tt>  lon0 =  11.0</tt><tt><br>
      </tt><tt>  lon1 = 135.0</tt><tt><br>
      </tt><tt>  </tt><tt><br>
      </tt><tt>  vr_region = vr(:,{lat0:lat1},{lon0:lon1})      ;--
        select the data of the sub-region</tt><tt><br>
      </tt><tt>  printVarSummary(vr_region)</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  threshold = 3e-5                               ;--
        define threshold</tt><tt><br>
      </tt><tt><br>
      </tt><tt>;-- loop over time to retrieve times where data is
        greater equal threshold</tt><tt><br>
      </tt><tt>  j = 0</tt><tt><br>
      </tt><tt>  do i=0,ntimes-1</tt><tt><br>
      </tt><tt>     tmp := ndtooned(vr_region(i,:,:))          ;--
        convert to 1d array</tt><tt><br>
      </tt><tt>     if(any(tmp .ge. threshold)) then</tt><tt><br>
      </tt><tt>        if(j .eq. 0) then</tt><tt><br>
      </tt><tt>           tt = time(i)                         ;-- first
        time step where threshold is exceeded</tt><tt><br>
      </tt><tt>        else</tt><tt><br>
      </tt><tt>           tt := array_append_record (tt, time(i), 0) 
        ;-- append next time step </tt></font><font color="#3333ff"><tt><font
          color="#3333ff"><tt>where threshold is exceeded</tt></font></tt><tt><br>
      </tt><tt>        end if</tt><tt><br>
      </tt><tt>        j = j+1</tt><tt><br>
      </tt><tt>     end if </tt><tt><br>
      </tt><tt>  end do</tt><tt><br>
      </tt><tt><br>
      </tt><tt>;-- convert time to readable date string</tt><tt><br>
      </tt><tt>  utc_date   = cd_calendar(tt,
        0)                          ;-- convert date to UT-referenced
        date</tt><tt><br>
      </tt><tt>  year       =
        sprinti("%0.4i",tointeger(utc_date(:,0)))   ;-- get year as
        integer value</tt><tt><br>
      </tt><tt>  mon        =
        sprinti("%0.2i",tointeger(utc_date(:,1)))   ;-- get month as
        integer value</tt><tt><br>
      </tt><tt>  day        =
        sprinti("%0.2i",tointeger(utc_date(:,2)))   ;-- get day as
        integer value</tt><tt><br>
      </tt><tt>  str_date   =
        year+"/"+mon+"/"+day                        ;-- yyyy/mm/dd</tt><tt><br>
      </tt><tt>  print(str_date)</tt></font><br>
    <br>
    <font color="#3333ff"><tt>end</tt></font><br>
    <br>
    Hope this helps,<br>
    Karin<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 26.04.17 um 07:09 schrieb Lyndon
      Mark Olaguera:<br>
    </div>
    <blockquote
cite="mid:CA+V+8dUd+Kp8M5X8bBAP1itUET+zaMWNqPCSc8CXQkyaZ331EQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Dear fellow NCL users,
        <div><br>
        </div>
        <div><br>
        </div>
        <div>I would like to extract the "date" when any grid point in a
          domain exceeds a threshold value using NCL (daily time steps).
          I tried to create a netcdf file of daily vorticity using the
          script below.</div>
        <div><br>
        </div>
        <div>I would like to add a line in this script that will extract
          the date (day month year) whenever a grid point from this
          domain is exceeded:</div>
        <div>              LAT : 7.5N to 27.5N</div>
        <div>              LON : 110E to 135E</div>
        <div><br>
        </div>
        <div>the threshold value that I am using is 3e-5 per second.</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>I am attaching the netcdf file and the image in this
          email.​
          <div class="gmail_chip gmail_drive_chip"
style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px
            solid rgb(221,221,221);line-height:1"><a
              moz-do-not-send="true"
href="https://drive.google.com/file/d/0B9faET7Bc2o8RWRXcTdKZEx0YlE/view?usp=drive_web"
              target="_blank"
style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px
              0;border:none"><img moz-do-not-send="true"
                style="vertical-align: bottom; border: none;"
src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span
                dir="ltr"
                style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom">test_2003_30.png</span></a><img
              moz-do-not-send="true"
              src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png"
              style="opacity: 0.55; cursor: pointer; float: right;
              position: relative; top: -1px; display: none;"></div>
          ​​​</div>
        <div><br>
        </div>
        <div>Is this possible in NCL?</div>
        <div>Is there any function in NCL that can extract values from
          every gridpoint in a specified domain?</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>I'll appreciate if anyone can point me to the right
          direction/functions to implement this in NCL.</div>
        <div><br>
        </div>
        <div>Many thanks in advance!</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>begin</div>
          <div>;************************************************</div>
          <div>; variable and file handling</div>
          <div>;************************************************</div>
          <div>  ufile  = addfile("uwind_may_2003_700hPa.nc","r")      
            ; open netcdf file</div>
          <div>  u   = ufile-&gt;uwnd(:,0,:,:)                          
              ; pull u off file</div>
          <div>  lat = ufile-&gt;lat</div>
          <div>  lon = ufile-&gt;lon</div>
          <div>  vfile  = addfile("vwind_may_2003_700hPa.nc","r")</div>
          <div>  v   = vfile-&gt;vwnd(:,0,:,:)                          
              ; pull v off file</div>
          <div>;************************************************</div>
          <div>; calculate vorticity on a Gaussian Grid</div>
          <div>;************************************************      
              </div>
          <div>  ;vrt   = u                                      ;
            retain coordinates</div>
          <div>  ;vrt   = uv2vrG_Wrap(u,v)</div>
          <div>  vr = uv2vr_cfd (u,v,lat,lon, 3)</div>
          <div>  copy_VarMeta(u,vr)</div>
          <div>  vr@long_name = "vorticity"</div>
          <div>  vr@units     = "per second"</div>
          <div>;***********************************************</div>
          <div>; save to a netcdf file</div>
          <div>;***********************************************</div>
          <div>  ncdf = addfile("vort_700hPa.nc","c")</div>
          <div>  fAtt = True</div>
          <div>  fAtt@title         = "Vorticity at 700hPa"</div>
          <div>  fAtt@source_file   = "daily winds from NCEP-NCAR
            Reanaysis"</div>
          <div>  fAtt@Conventions   = "None"</div>
          <div>  fAtt@creation_date = systemfunc("date")</div>
          <div>  fileattdef(ncdf,fAtt)            ; copy file attributes</div>
          <div>  filedimdef(ncdf,"time",-1,True)</div>
          <div>  ncdf-&gt;vr = vr</div>
          <div>end</div>
        </div>
        <div><br>
        </div>
        <div>
          <div>
            <div class="gmail_signature">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div><font face="comic sans ms, sans-serif"><b><u>Lyndz</u></b></font></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
ncl-talk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a class="moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
    </blockquote>
  </body>
</html>