<div dir="ltr"><div>Thanks Marsh, <br>  <br></div>  <br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 11, 2014 at 1:07 PM, Marsh, Kieren [FGUAE] <span dir="ltr">&lt;<a href="mailto:k.marsh@fugro-uae.com" target="_blank">k.marsh@fugro-uae.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
<p>* Open your netCDF file<br>
* ---------------------------<br>
&#39;sdfopen <a href="http://xxxxxxx.nc" target="_blank">xxxxxxx.nc</a>&#39;</p>
<p> </p>
<p>* Get the start time<br>
* ---------------------<br>
&#39;set t 1&#39;<br>
&#39;q time&#39;<br>
startTime = subwrd(result, 3)</p>
<p> </p>
<p>* Get end time requires you to find the number<br>
* of time steps in the data set first<br>
* ---------------------------------------------------------<br>
&#39;q ctlinfo&#39;<br>
ctlRes = result</p>
<p> </p>
<p>* Loop through the result of &#39;q ctlinfo&#39;<br>
* to find the line that starts with &#39;tdef&#39;<br>
* ---------------------------------------------<br>
line = 1<br>
found = 0<br>
while (!found)<br>
  info = sublin(ctlRes, line)<br>
  if (subwrd(info, 1) = &#39;tdef&#39;)<br>
    handle = info<br>
    found = 1<br>
  endif<br>
  line = line + 1<br>
endwhile</p>
<p> </p>
<p>* Variable &#39;handle&#39; now contains the line that starts<br>
* with &#39;tdef&#39;<br>
*<br>
* Second word on the line is the number of time steps<br>
* -----------------------------------------------------------------<br>
numOfSteps = subwrd(handle, 2)</p>
<p> </p>
<p>* Set time environment to last step of data set<br>
* ---------------------------------------------------------<br>
&#39;set t &#39;numOfSteps<br>
&#39;q time&#39;</p>
<p> </p>
<p>* Grab time of last time step<br>
* ----------------------------<br>
endTime = subwrd(result, 3)</p>
<p> </p>
<p>* Write out to text file<br>
* [Here you enter the path and name of the text file<br>
* you want to output]<br>
* -----------------------------------------------------<br>
rc=write(NAME_AND_PATH_OF_TEXTFILE, &#39;Start time = &#39;startTime&#39;, End time = &#39;endTime)<br>
rc=close(NAME_AND_PATH_OF_TEXTFILE)</p>
<div>
<p> </p>
<div>
<p class="MsoNormal"></p>
<hr>
<p></p>
</div>
</div>
<div style="FONT-SIZE:16px;FONT-FAMILY:Times New Roman;COLOR:#000000">
<div style="DIRECTION:ltr"><font color="#000000" face="Tahoma"><b>From:</b> <a href="mailto:gradsusr-bounces@gradsusr.org" target="_blank">gradsusr-bounces@gradsusr.org</a> [<a href="mailto:gradsusr-bounces@gradsusr.org" target="_blank">gradsusr-bounces@gradsusr.org</a>] on behalf of Malleswararao Maguluri [<a href="mailto:mallesh4science@gmail.com" target="_blank">mallesh4science@gmail.com</a>]<br>

<b>Sent:</b> Wednesday, June 11, 2014 10:58 AM<br>
<b>To:</b> GrADS Users Forum<br>
<b>Subject:</b> [gradsusr] how to extract start date and end date using GrADS script from netcdf file?<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div dir="ltr">
<div>Hi,<br>
<br>
  how to extract start date and end date using GrADS script from netcdf file?. I need start date and end date output in text file.<br>
<br>
</div>
<div>Waiting for your reply,<br>
</div>
<div><br>
</div>
Thanks &amp; regards, <br clear="all">
<div>
<div><br>
-- <br>
<div dir="ltr">M. MALLESWARA RAO<br>
M.Tech (Atmospheric Science) &amp; M.Sc (Physics)<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>

<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">M. MALLESWARA RAO<br>M.Tech (Atmospheric Science) &amp; M.Sc (Physics)<br><br></div>
</div>