<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Use the -ap flag with 'set fwrite' to append to an existing file. Also, it is not necessary to define N3 and N4 before displaying them -- why waste the memory? Simply change your 'define' to a 'd' and then you can remove the two 'd N3' and 'd N4' lines. <div>--Jennifer</div><div><br><div><div><br><div><div>On Sep 25, 2012, at 5:20 AM, Mubashar Dogar wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Dear GrADS users,<br><br>I have 2 spatial variables in one file. I wanted to do some operation<br>on each one and wanted to save 2 new variables in a new GrADS file. I<br>am doing some thing as given below:<br><br>'open File.ctl'<br>'set gxout fwrite'<br>'set fwrite NEW_FILE.dat'<br>t=1 ********************T=1 is Jan1900 and it is<br>monthly data<br>tmax=60<br>while (t<=tmax)<br>'set t 't<br>'define N3=aave(temp,lon=-150,lon=-90,lat=-5,lat=5)'<br>'define N4=aave(temp,lon=160,lon=210,lat=-5,lat=5)'<br>'d N3'<br>'d N4'<br>t=t+1<br>endwhile<br>'disable fwrite'<br>********************************<br>As the new variables are a 1-D time series, so my ctl file to open<br>newly written data file is as:<br><br>dset NEW_FILE.dat<br>title N3 and N4 indices<br>undef -9.99e+08<br>xdef 1 linear 1 1<br>ydef 1 linear 1 1<br>zdef 1 linear 1 1<br>tdef 103 linear jan1900 1yr<br>vars 2<br>N3 0 99 N3 variable<br>N4 0 99 N4 variable<br>endvars<br><br>It works fine but it looks that the values of both variables are not<br>representing to original values. How can I work with two or more<br>variables in one file?<br><br>Thanks,<br><br>Mubashar<br>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>http://gradsusr.org/mailman/listinfo/gradsusr<br></div></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; "><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></span>
</div>
<br></div></div></div></body></html>