<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Also, use the -ap option with 'set fwrite'. --Jennifer<div><br><div><div>On Aug 23, 2014, at 4:40 PM, Haibin Li wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
You were essentially replacing the file every day so you ended up
with the daily values for the last day.<br>
move set fwrite and set gxout fwrite before the while loop, move
disable fwrite after endwhile.<br>
<br>
<br>
Haibin<br>
<br>
<div class="moz-cite-prefix">On 2014/8/23 6:30, mehwish ramzan
wrote:<br>
</div>
<blockquote cite="mid:CA+rMR9zFMcL0A7S2hwv+-OeaoRQD69=0L3SAiHF8qDtP7jcPWw@mail.gmail.com" type="cite">
<div dir="ltr">Dear GrADS users,
<div><br>
</div>
<div>I need your kind help in solving this issue. </div>
<div>I converted my model outputs from hourly data to daily data
using fwrite command as follows;</div>
<div><br>
</div>
<div>
<div>
<div>'open r_p.ctl'</div>
<div>'set x 1 257'</div>
<div>'set y 1 170'</div>
<div>'set lev 1'</div>
<div>t1=1</div>
<div>while(t1<=360)</div>
<div>'set t ' t1</div>
<div>'set fwrite pre.dat'</div>
<div>'set gxout fwrite'</div>
<div>'d ave(pratesfc,t='t1',t='t1+23')'</div>
<div>'disable fwrite'</div>
<div>t1= t1+24</div>
<div>endwhile</div>
</div>
<div><br>
</div>
<div>Now in order to display the binary data i prepared
following control file;</div>
<div><br>
</div>
<div>
<div>dset ^pre.dat</div>
<div>options little_endian</div>
<div>title sample daily data</div>
<div>undef 9.999e+20</div>
<div>xdef 257 linear 7.756 0.47019140625</div>
<div>ydef 170 linear -20.826 0.47019140625</div>
<div>zdef 1 levels 1</div>
<div>tdef 360 linear 00z01jan1999 1dy</div>
<div>*</div>
<div>vars 1</div>
<div>pratesfc 0 99 surface precipitation</div>
<div>endvars</div>
</div>
<div><br>
</div>
<div>When i opened this control file in grads (v1.9.0-rc1
32-bit little-endian readline sdf/xdf netcdf lats athena
printim), it successfully displays first time step, but from
second time step on-wards, it give following error message;</div>
<div><br>
</div>
<div>
<div>ga-> open prect.ctl</div>
<div>Scanning description file: prect.ctl</div>
<div>Data file pre.dat is open as file 1</div>
<div>LON set to 7.756 128.125</div>
<div>LAT set to -20.826 58.6363</div>
<div>
LEV set to 1 1</div>
<div>Time values set: 1999:1:1:0 1999:1:1:0</div>
<div>ga-> set t 2</div>
<div>Time values set: 1999:1:2:0 1999:1:2:0</div>
<div>ga-> d pratesfc</div>
<div>Low Level I/O Error: Read error on data file</div>
<div> Data file name = pre.dat</div>
<div> Error reading 257 bytes at location 43690</div>
<div>Data Request Error: Error for variable 'pratesfc'</div>
<div> Error ocurred at column 1</div>
<div>DISPLAY error: Invalid expression</div>
<div> Expression = pratesfc</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>The original hourly data file was of size= 6903 (with 87
variables) , while the file i prepared for reading (one
variable) as daily data is of size= 258, while my working
platform is Linux.</div>
<div><br>
</div>
<div>This is first time i am using fwrite function.Please
guide me where i am doing wrong.<br>
</div>
<div><br>
</div>
<div>Thank You</div>
<div><br>
</div>
<div>With Best Regards,</div>
<div><br>
</div>
<div>Mehwish</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div dir="ltr">
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
gradsusr mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a>
<a class="moz-txt-link-freetext" href="http://gradsusr.org/mailman/listinfo/gradsusr">http://gradsusr.org/mailman/listinfo/gradsusr</a>
</pre>
</blockquote>
<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>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 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; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 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; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-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; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 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; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--</div><div>Jennifer M. Adams<br>Center for Ocean-Land-Atmosphere Studies (COLA)<br>111 Research Hall, Mail Stop 2B3<br>George Mason University<br>4400 University Drive<br>Fairfax, VA 22030 <br><br></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span></div></span></span><br class="Apple-interchange-newline">
</div>
<br></div></body></html>