<div dir="rtl"><div dir="ltr" style="text-align:left"><span id="result_box" class="" lang="en"><span class="">I got</span> <span class="">here</span> <span class="">a good</span> <span class="">two</span> <span class="">Scripts</span><span class="">, one</span> <span class="">for writing</span> <span class="">data on</span> <span class="">the</span> <span class="">Grads</span> <span class="">command</span> <span class="">window</span><span class="">, and the second</span> <span class="">save</span> <span class="">as</span> <span class="">an image file.</span> <span class="">This</span> <span class="">first</span> <span class="">script</span> <span class="">is very good and</span> <span class="">I use it</span>, </span><span id="result_box" class="" lang="en"><span class="">the second</span> <span class="">script</span> <span class="">has a problem</span> <span class="">and i wanted</span> <span class="">to know if</span> <span class=""></span></span><span id="result_box" class="" lang="en"><span class=""> it possible to</span> <span class="">set up</span> <span class="">a</span> <span class="">loop</span> <span class="">to</span> <span class="">automatically</span> <span class="">make</span> <span class="">the result</span> <span class="">a separate line </span></span><span id="result_box" class="" lang="en"><span class="">When</span> <span class="">I want to</span> <span class="">save the</span> <span class="">result</span> <span class="">in a file</span> </span><span lang="en"><span>pictures?.</span></span><br>
<span id="result_box" class="" lang="en"><span class="">I'm pretty new in</span> <span class="">Grads</span><span class="">, and the question</span> <span class="">came</span> <span class="">to for me to learn.<br><br>
</span></span></div><div dir="ltr" style="text-align:left"><span id="result_box" class="" lang="en"><span class="">avi.<br></span></span></div><div dir="ltr" style="text-align:left"><br><br><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote"><div dir="ltr">2013/4/2 Muhammad Yunus Ahmad Mazuki <span dir="ltr"><<a href="mailto:ukm.yunus@gmail.com" target="_blank">ukm.yunus@gmail.com</a>></span></div><blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex">
<div dir="ltr">Well, I have been wondering, whether you want to save in text form or picture form? If you use <span lang="en"><span>'draw string' it will save as pictures, and just overlapping on each other unless you set different coordinate for the string drawing.<br>
</span></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 1, 2013 at 6:25 PM, avi kojokro <span dir="ltr"><<a href="mailto:kojokroavi@gmail.com" target="_blank">kojokroavi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr" style="text-align:left"><span lang="en"><span>The problem was in</span> <span>two lines,</span>in <span>this</span> <span>command</span><br>
<span>while (time <= end_time)</span><br><span>and </span></span><span lang="en"><span>this</span> <span>command<br>time=start_time<br><br></span></span><span lang="en"><span>Now there is</span> <span>another problem,</span> <span>the result</span> <span>comes out</span> <span>from grads is</span> signed in one line</span>, <span lang="en"><span>Is there a way</span> <span>to</span> <span>loop</span> <span>the result</span> <span>that it</span> <span>will record</span> <span>each year</span> <span>separately?</span><span>.</span></span><span lang="en"><span>I add</span> <span>the image file</span></span></div>
</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote"><div dir="ltr">2013/4/1 Rupak Rajbhandari <span dir="ltr"><<a href="mailto:rupak.rajbhandari@gmail.com" target="_blank">rupak.rajbhandari@gmail.com</a>></span></div>
<blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex"><div dir="ltr">It says error occured at line 22.<div>your code should be </div>
<div>'set t 'sart_time</div><span><font color="#888888"><div><br></div><div>-rupak</div><div><br></div></font></span></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Apr 1, 2013 at 3:05 PM, avi kojokro <span dir="ltr"><<a href="mailto:kojokroavi@gmail.com" target="_blank">kojokroavi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="rtl"><div dir="ltr" style="text-align:left">To Thomas Robinson <span lang="en"><span>Thanks for</span> <span>the example,</span> <span>I tried</span> <span>the script</span> <span>in this </span></span><span lang="en"><span><span lang="en"><span>way</span></span></span> <span>as</span> you<span> showing me :<br>
<br><br><br>'reinit'<br>'set display color white'<br>f = '<a href="http://goldsmr2.sci.gsfc.nasa.gov:80/dods/MATMNXSLV" target="_blank">http://goldsmr2.sci.gsfc.nasa.gov:80/dods/MATMNXSLV</a>'<br>
'sdfopen 'f<br>
<br><br>start_time=3<br>end_time=12*34<br><br>'set parea 0.7 10.5 0.6 8'<br>'set lat 32.5'<br>'set lon 35'<br><br>set t 'start_time'<br>while (time <=end_time<br>'set t 'time<br>
<br> <br>'d t850-273.16'<br>cc=subwrd(result,4)<br>'q time'<br>ctime = subwrd(result,3)<br>chour = substr(ctime,9,15)<br>'draw string 0.5 8 'chour'='cc<br><br><br>time=time+12<br>endwhile<br>
<br><br>'printim avrg.png x1000 y700'<br>'end'<br><br></span></span><br><span lang="en"><span>But</span> <span>I get</span> <span>an error , </span></span><span lang="en"><span>And</span> <span>I attach</span> <span>a screenshot</span> <span>of the error , </span></span><span lang="en"><span>What</span> <span>did I do wrong?.</span></span></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div dir="ltr">2013/4/1 Thomas Robinson <span dir="ltr"><<a href="mailto:ter@hawaii.edu" target="_blank">ter@hawaii.edu</a>></span></div><blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex">
Aloha Avi, <div><br></div><div>It looks like your code for each time step is the same. You can loop using while/endwhile. Try this and change the variable end_time to whatever you want it to be:</div><div><br></div><div>
<div>
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'reinit'</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'set display color white'</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">f = '</span><a href="http://goldsmr2.sci.gsfc.nasa.gov/dods/MATMNXSLV" style="color:rgb(17,85,204);font-size:13px;font-family:arial,sans-serif" target="_blank">http://goldsmr2.sci.gsfc.nasa.gov:80/dods/MATMNXSLV</a><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'sdfopen 'f</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<br></div>** Set the start and end times (month number)<br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">start_time=3</div><div>end_time=12*34<div><br>
<br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'set parea 0.7 10.5 0.6 8'</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'set lat 32.5'</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'set lon 35'</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<br></div>** Set the time to the start time<br>time=start_time</div><div>** Loop through the times<br>while (time <=end_time<br>**Set time<br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'set t ' time</span><div><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'d t850-273.16'</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">cc=subwrd(result,4)</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'q time'</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">ctime = subwrd(result,3)</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">chour = substr(ctime,9,15)</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">'draw string 0.5 8 'chour'='cc</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<br></div>** Set the time to the next year</div><div>time=time+12</div><div><br></div><div>endwhile<div><div><br><br><br><div class="gmail_quote">On Sun, Mar 31, 2013 at 8:26 PM, avi kojokro <span dir="ltr"><<a href="mailto:kojokroavi@gmail.com" target="_blank">kojokroavi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div style="text-align:left"><br></div><div dir="ltr" style="text-align:left"><span lang="en"><span>Thank you.</span><br>
<span>I did not phrase</span> <span>the</span> <span>question correctly</span><span>, I think that</span> <span>the example</span> <span>I gave</span> <span>is not good.</span> <span>I</span> <span>will try</span> <span>to explain myself</span> <span>again.</span><br>
<span>First I</span> <span>must say</span> <span>that I am</span> <span>working</span> <span>with windows</span> <span>not Linux</span><span>.<br></span></span><span lang="en"><span>I want to get</span> <span>data</span> <span>from a server</span> <span>that already</span> <span>gives me a</span> <span>monthly averages,</span> <span>here's</span> <span>a better</span> <span>example of</span> <span>what i means</span><span>:<br>
<br><br>'reinit'<br>'set display color white'<br>f = '<a href="http://goldsmr2.sci.gsfc.nasa.gov:80/dods/MATMNXSLV" target="_blank">http://goldsmr2.sci.gsfc.nasa.gov:80/dods/MATMNXSLV</a>'<br>'sdfopen 'f<br>
<br><br><br>'set parea 0.7 10.5 0.6 8'<br>'set lat 32.5'<br>'set lon 35'<br><br>'set t 3 '<br>'d t850-273.16'<br>cc=subwrd(result,4)<br>'q time'<br>ctime = subwrd(result,3)<br>
chour = substr(ctime,9,15)<br>'draw string 0.5 8 'chour'='cc<br><br><br>'set t 15 '<br>'d t850-273.16'<br>cc=subwrd(result,4)<br>'q time'<br>ctime = subwrd(result,3)<br>chour = substr(ctime,9,15)<br>
'draw string 0.5 7.7 'chour'='cc<br><br><br>'set t 27 '<br>'d t850-273.16'<br>cc=subwrd(result,4)<br>'q time'<br>ctime = subwrd(result,3)<br>chour = substr(ctime,9,15)<br>'draw string 0.5 7.7 'chour'='cc<br>
<br></span></span><span lang="en"><span>How do I create</span> <span>a loop</span> <span>to do it</span> <span>automatically</span><span>, the server</span> <span>provides</span> <span>data</span> <span>from 1979 to</span> 2013<span>,</span> <span>and</span> <span>I want</span> <span>to get</span> <span>only the data</span> <span>of March.</span><br>
<br><span>I hope</span> <span>I have explained</span> <span>myself</span> <span>better.</span><br><span>Regards</span></span><br></div><div dir="ltr" style="text-align:left">avi.<br>
</div><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div dir="ltr">2013/4/1 Muhammad Yunus Ahmad Mazuki <span dir="ltr"><<a href="mailto:ukm.yunus@gmail.com" target="_blank">ukm.yunus@gmail.com</a>></span></div>
<blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"><div dir="ltr"><div><div>The average function itself has what you needed. ave(var1,t=1,t=360,<b>12</b>), this means it will average values from t=1,t=13,t=25 ... until t=360.Example of point value extraction.<br>
<br>'sdfopen <a href="http://foo.nc" target="_blank">foo.nc</a>'<br>lonvalue=90<br>latvalue=0<br>levvalue=850<br>tvalue=1<br>'set lon 'lonvalue<br>'set lat 'latvalue<br>'set t 'tvalue<br>'set lev 'levvalue<br>
'd variable1'<br>catch=sublin(result,4)<br>'set gxout fwrite'
<br>'set fwrite point.dat'<br>'d 'catch<br>'disable fwrite'<br><br></div>This is a basic one, modify it as your need requires. I'm not sure about excel, but this will create a binary file, which can be opened by GrADS (using a controller file) and Scilab (which I use for further analysis).<br>
<br></div>Yunus.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Sun, Mar 31, 2013 at 2:25 PM, avi kojokro <span dir="ltr"><<a href="mailto:kojokroavi@gmail.com" target="_blank">kojokroavi@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="rtl"><div dir="ltr" style="text-align:left"><span lang="en"><span>I'm trying</span> <span>to do</span> <span>a script of </span></span><span lang="en"><span><span lang="en"><span>averages</span></span></span> <span>like this</span> <span>example</span> <span>:<br>
<br><br>'set t 1 '<br>'define varav=ave(t850-273.16,t=1,t=1,1)'<br>'d varav'<br>cc=subwrd(result,4)<br>'draw string 0.5 8 jan='cc<br><br></span></span><span lang="en"><span>I want</span> <span>my</span> <span>script</span> <span>calculates</span> <span>every 12</span> <span>months,</span> <span>how do I create</span> <span>a loop</span> <span>script</span> <span>that</span> <span>calculates</span> <span>every 12</span> <span>month</span> <span>average</span> <span>of the same</span> <span>month.<br>
</span></span><span lang="en"><span>I</span> <span>will give</span> <span>an example of what</span> <span>I mean</span><span>:</span> <span>I want to begin</span> <span>to calculate</span> <span>average of</span> <span>January 1979</span> <span>and then</span> <span>later</span> <span>to calculate</span> <span>directly</span> <span>the</span> <span>January 1980</span> <span>and so on.<br>
</span></span><span lang="en"><span>Is it possible</span> <span>that the</span> <span>result</span> <span>will write</span> <span>directly to the</span> <span>Excel</span> <span>file</span><span>, then</span> <span>how to</span> <span>write</span> <span>the command</span> <span>to it.</span><br>
<br><span>Please note</span> <span>that I</span> <span>first started</span> <span>Grads.<br><br></span></span>Thank you so much. <br><span><font color="#888888"><br></font></span></div><span><font color="#888888"><div dir="ltr" style="text-align:left">
avi<br>
</div><div dir="ltr" style="text-align:left"><br></div><div style="text-align:right"><br></div></font></span></div>
<br></div></div>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">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></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">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></div></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">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"><span><font color="#888888"><div><br></div></font></span></div></div><span><font color="#888888"><span><font color="#888888">-- <br>Tom Robinson<br>
President - Graduate Student Organization <br>Graduate Student - Department of Meteorology<br>
<a href="tel:732-718-2323" value="+17327182323" target="_blank">732-718-2323</a><br>
</font></span></font></span></div><span><font color="#888888">
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></font></span></blockquote></div><br></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">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></div>
</div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">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></div>
</div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">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></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></div>