<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">You keep overwriting the output because your output file always has the same name. Move your 'set sdfwrite' command inside the while loop and add 't' to the filename, something like this:&nbsp;<div>'set sdfwrite rain_'t'.nc'</div><div>--Jennifer</div><div><br></div><div><div><br><div><div>On Jan 15, 2011, at 9:53 AM, Zablone Owiti wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="color:#000; background-color:#fff, font-family:garamond, new york, times, serif;font-size:14pt"><span style="RIGHT: auto"><span style="RIGHT: auto">Hi Rashed,<br>How can I adjust it to stop overwriting the output? See below the&nbsp;.gs file.<br style="RIGHT: auto" class="yui-cursor"></span><br><span style="RIGHT: auto" lang="EN"> <div style="RIGHT: auto">Thanks<br style="RIGHT: auto"><br>'reinit'</div> <div>'sdfopen gcpcr.nc'</div> <div>'set x 0.5 360.5'</div> <div>'set y 1 180'</div> <div>t = 151</div> <div>'set sdfwrite rain.nc'</div></span></span></div></div></blockquote><blockquote type="cite"><div><div style="color:#000; background-color:#fff, font-family:garamond, new york, times, serif;font-size:14pt"><span style="RIGHT: auto"><span style="RIGHT: auto" lang="EN"> <div>*'set gxout fwrite'</div> <div>while (t&lt;670)</div> <div>'set t 't</div> <div>'define jul=r'</div> <div style="RIGHT: auto">'set t 't+1</div> <div>'define aug=r' </div> <div>'set t 't+2</div> <div>'define sep=r'</div> <div>'define jas=(jul+aug+sep)/3'</div> <div>'sdfwrite jas'</div> <div>t = t+12 </div> <div>endwhile</div> <div>'clear sdfwrite'</div> <div>;</div></span><br><br><var id="yui-ie-cursor"></var><br class="yui-cursor"></span> <div></div> <div>&nbsp;</div> <div id="RTEContent"> <div> <div><b><em>===================================================</em></b></div> <div><b><em><font color="#007f40" face="lucida console, sans-serif">ZABLONE OWITI<br></font><font face="garamond, new york, times, serif">GRADUATE STUDENT<br>Nanjing University of Information, Science and Technology<br>College of International Education<br>Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China<br></font></em></b><font color="#333333" face="garamond, new york, times, serif">Tel: +86-25-58731402<br>Fax: +86-25-58731456</font></div> <div><b><em><font face="garamond, new york, times, serif">Mob. 15077895632</font></em></b></div> <div><b><em>Website: <a href="http://www.nuist.edu.cn/" rel="nofollow" target="_blank">www.nuist.edu.cn</a><br></em></b><i><strong>====================================================<br></strong><span style="FONT-STYLE: italic; FONT-FAMILY: inherit" class="ms__id351"> <div class="MsoNormal"><i><span style="COLOR: #e36c0a; FONT-SIZE: 12pt">"The real art of conversation is not only to say the right thing at the right time, but also to leave unsaid the wrong thing at the tempting moment."</span></i><i><span style="COLOR: #e36c0a; FONT-SIZE: 12pt"></span></i></div> <div class="MsoNormal">&nbsp;</div></span></i><br></div></div></div> <div style="FONT-FAMILY: inherit; FONT-SIZE: 14pt"><br> <div style="FONT-FAMILY: inherit; FONT-SIZE: 12pt"><font size="2" face="Arial"> <div style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px" class="hr" contenteditable="false" readonly="true"></div><b><span style="FONT-WEIGHT: bold">From:</span></b> Rashed Mahmood &lt;<a href="mailto:rashidcomsis@gmail.com">rashidcomsis@gmail.com</a>&gt;<br><b><span style="FONT-WEIGHT: bold">To:</span></b> Zablone Owiti &lt;<a href="mailto:zablonowiti@yahoo.com">zablonowiti@yahoo.com</a>&gt;; GrADS Users Forum &lt;<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a>&gt;<br><b><span style="FONT-WEIGHT: bold">Cc:</span></b> <br><b><span style="FONT-WEIGHT: bold">Sent:</span></b> Saturday, 15 January 2011 8:34 PM<br><b><span style="FONT-WEIGHT: bold">Subject:</span></b> Re: [gradsusr] Problem Extracting data in netcdf format<br></font><br> <div id="yiv148457350"> <div><br>I&nbsp;guess your loop is overwriting the output file and the output variable as after every loop as the name is same after each iteration...</div> <div>&nbsp;</div> <div>&nbsp;</div> <div>&nbsp;</div> <div>Rashed </div> <div>&nbsp;</div> <div><font size="1">Institute of Atmospheric Physics</font></div> <div><font size="1">(CAS) Beijing.<br></font></div> <div>&nbsp;</div> <div class="yiv148457350gmail_quote">On Thu, Jan 13, 2011 at 6:13 PM, Zablone Owiti <span dir="ltr">&lt;<a href="mailto:zablonowiti@yahoo.com" rel="nofollow" target="_blank" ymailto="mailto:zablonowiti@yahoo.com">zablonowiti@yahoo.com</a>&gt;</span> wrote:<br> <blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="yiv148457350gmail_quote"> <div> <div style="COLOR: #000; FONT-SIZE: 14pt"> <div></div> <div>&nbsp;Dear users,</div> <div>I am attempting to extract seasonal(JAS) data from a monthly netcdf data file using the attached script.</div> <div>When I run the script, it only write the first timestep data(i.e it fails to loop). </div> <div>What could be error in the script?</div> <div>&nbsp;</div> <div>Thanks<var></var></div> <div>&nbsp;</div> <div> <div> <div><b><i>===================================================</i></b></div> <div><b><i><font color="#007f40" face="lucida console, sans-serif">ZABLONE OWITI<br></font><font face="garamond, new york, times, serif">GRADUATE STUDENT<br>Nanjing University of Information, Science and Technology<br>College of International Education<br>Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China<br></font></i></b><font color="#333333" face="garamond, new york, times, serif">Tel: +86-25-58731402<br>Fax: +86-25-58731456</font></div> <div><b><i><font face="garamond, new york, times, serif">Mob. 15077895632</font></i></b></div> <div><b><i>Website: <a href="http://www.nuist.edu.cn/" rel="nofollow" target="_blank">www.nuist.edu.cn</a><br></i></b><i><b>====================================================<br></b><span style="FONT-STYLE: italic; FONT-FAMILY: inherit"> <div class="yiv148457350MsoNormal"><i><span style="COLOR: #e36c0a; FONT-SIZE: 12pt">"The real art of conversation is not only to say the right thing at the right time, but also to leave unsaid the wrong thing at the tempting moment."</span></i><i><span style="COLOR: #e36c0a; FONT-SIZE: 12pt"></span></i></div> <div class="yiv148457350MsoNormal">&nbsp;</div></span></i><br></div></div></div></div><br></div><br>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org" rel="nofollow" target="_blank" ymailto="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="nofollow" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br><br></blockquote></div><br></div><br><br></div></div></div><br></div>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>http://gradsusr.org/mailman/listinfo/gradsusr<br></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--</div><div>Jennifer M. Adams</div><div>IGES/COLA</div><div>4041 Powder Mill Road, Suite 302</div><div>Calverton, MD 20705</div><div><a href="mailto:jma@cola.iges.org">jma@cola.iges.org</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span></div></span> </div><br></div></div></body></html>