[gradsusr] fwrite data conversion

Haibin Li hli at envsci.rutgers.edu
Sat Aug 23 16:40:46 EDT 2014


You were essentially replacing the file every day so you ended up with 
the daily values for the last day.
move set fwrite and set gxout fwrite before the while loop, move disable 
fwrite after endwhile.


Haibin

On 2014/8/23 6:30, mehwish ramzan wrote:
> Dear GrADS users,
>
> I need your kind help in solving this issue.
> I converted my model outputs from hourly data to daily data using 
> fwrite command as follows;
>
> 'open r_p.ctl'
> 'set x 1 257'
> 'set y 1 170'
> 'set lev 1'
> t1=1
> while(t1<=360)
> 'set t ' t1
> 'set fwrite pre.dat'
> 'set gxout fwrite'
> 'd ave(pratesfc,t='t1',t='t1+23')'
> 'disable fwrite'
> t1= t1+24
> endwhile
>
> Now in order to display the binary data i prepared following control file;
>
> dset ^pre.dat
> options little_endian
> title sample daily data
> undef 9.999e+20
> xdef 257 linear 7.756   0.47019140625
> ydef 170 linear -20.826 0.47019140625
> zdef   1  levels  1
> tdef 360 linear 00z01jan1999 1dy
> *
> vars 1
> pratesfc 0 99 surface precipitation
> endvars
>
> 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;
>
> ga-> open prect.ctl
> Scanning description file:  prect.ctl
> Data file pre.dat is open as file 1
> LON set to 7.756 128.125
> LAT set to -20.826 58.6363
> LEV set to 1 1
> Time values set: 1999:1:1:0 1999:1:1:0
> ga-> set t 2
> Time values set: 1999:1:2:0 1999:1:2:0
> ga-> d pratesfc
> Low Level I/O Error:  Read error on data file
>   Data file name = pre.dat
>   Error reading 257 bytes at location 43690
> Data Request Error:  Error for variable 'pratesfc'
>   Error ocurred at column 1
> DISPLAY error:  Invalid expression
>   Expression = pratesfc
>
>
> 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.
>
> This is first time i am using fwrite function.Please guide me where i 
> am doing wrong.
>
> Thank You
>
> With Best Regards,
>
> Mehwish
>
>
>
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140823/aaaeace1/attachment.html 


More information about the gradsusr mailing list