<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body 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>
</body>
</html>