[gradsusr] fwrite data conversion

Jennifer Adams jma at cola.iges.org
Sat Aug 23 20:15:35 EDT 2014


Also, use the -ap option with 'set fwrite'. --Jennifer

On Aug 23, 2014, at 4:40 PM, Haibin Li wrote:

> 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
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
111 Research Hall, Mail Stop 2B3
George Mason University
4400 University Drive
Fairfax, VA 22030 





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


More information about the gradsusr mailing list