Binary to Ascii conversion

Diane Stokes Diane.Stokes at NOAA.GOV
Fri Feb 23 11:55:19 EST 2007


Since you are doing an area average in the call to amean, you don't need
to set varying lat and lon ranges before your display.  Instead set lon
and lat (or x and y) to a fixed point.  Eg:
'set x 1'
'set y 1'

If you do so, that "Printing grid" header message should show up only at
the top of the output.

    Diane

Yitbarek Kifle wrote:
> I would like to thank Diane Stokes and Kristian Horvath for the Script that
> you sent me.I am still having a minor problem while excuting the script
> file.The problem is,when i run the script it turns out an error on line 9
> of the scipt as follows;
>
> 'reinit'
> 'sdfopen D:\reanalysis\soilw.mon.mean.nc'
> 'set t 613 697'
> 'set lon 95.5 112.5'
> 'set lat 31.5 42.5'
> 'set gxout print'
> 'set prnopts %10.3e 1 1'
> 'd tloop(amean(soilw,lon=95.5,lon=112.5,lat=31.5,lat=42.5))'
> rc=write(D:\reanalysis\ascii.txt,result)
> rc=close(D:\reanalysis\ascii.txt)
> 'quit'
> return
>
> and the other script i have is;
>
> 'reinit'
> 'sdfopen D:\reanalysis\soilw.mon.mean.nc'
> 'set gxout print'
> 'set prnopts %8.5e 1'
> 'set t 613 697'
> 'display tloop(amean(soilw,lon=95.5,lon=112.5,lat=31.5,lat=42.5))'
> say result
> write ('D:\reanalysis\ascii.txt',result,append)
> 'reinit'
>
> and the later gives me an ascii file as follows;(What i didn't like is that
> the the text "Printing Grid -- 1 Values -- Undef = 32766"is repeated after
> every numeric output.)
>
> Printing Grid -- 1 Values -- Undef = 32766
> 1.89156e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 1.73351e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 1.64099e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 1.60951e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 1.70652e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 1.85685e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 2.07550e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 2.19629e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 2.19556e+02
> Printing Grid -- 1 Values -- Undef = 32766
> 2.24317e+02
> .
> .
> .
> Would somebody please make a correction of these scripts or send me another
> one?
>
> Thanks in advance.
>



More information about the gradsusr mailing list