# problem: grib to ascii

martynas kazlauskas mkzv at YAHOO.COM
Wed Jul 4 05:48:13 EDT 2007

```Sveikas,

Nezinau ar tokiu budu suformulaves klausima sitam
forume gausi pagalbos.

Siaip jei nustatineji po viena tasko koordinate, daryk
paprasciau

Pavyzdys (mano sh skriptas, gradsui teks perrasyti):

cat >> \${takas3}./t2.gs<<EOF
'open \${file1}.ctl'
'run \${takas4}setregrot.gs \${LONGTITUDE} \${LATTITUDE}
0 -30 regrot'
'q time'
initial=subwrd(result,3)
H=substr(initial,1,2)
D=substr(initial,4,2)
say initial
times=18
count=1
while (count < times)
'set t 'count''
'q time'
date=subwrd(result,3)
hour=substr(date,1,2)
day=substr(date,4,2)
month=substr(date,6,3)
year=substr(date,9,4)

'd t2-273.16'
res=result
temp=subwrd(res,4)
*temp=int(temp)

fmt = '%-6.1f'
rc = math_format(fmt,temp)
say fmt' of 'temp' = 'rc

rc =
write('\${takas2}t2_'D'-'H'_\${IDENTITY}.txt',hour'/'day'/'month'/'year'
'rc,append)
rc = close('\${takas2}t2_'D'-'H'_\${IDENTITY}.txt')

count=count+1
endwhile
EOF

Cia tau shelinis skriptukas israsinejimui;
Is jo gali pasiimti sitas dalis:

#
'open \${file1}.ctl' * Cia parasysi savo ctl
'run \${takas4}setregrot.gs \${LONGTITUDE} \${LATTITUDE}
0 -30 regrot' * sita jau zinai

Vietoje:
'd t2-273.16' * irasai vejo u ir v komponentes
panasiai kaip 'd mag(u,v)'
res=result
temp=subwrd(res,4) * sitas nustato tavo reiksme nuo

*sita eilute isveda i tekstini faila
rc = write('\${takas2}t2.txt,rc,append')
rc = close('\${takas2}t2.txt')

#
turi faile reiksmiu, tiek ju tau kas karta kiekvienam
laiko momentui ir israsys.

Siaip paieskok forume daugiau  apie ASCII arba rc
funkcija. Ir nedaryk Lietuvai gedos.

Regards,
Martynas Kazlauskas
LHMS

--- Mantas Marciukaitis <mantas at ISAG.LEI.LT> wrote:

> Hi everyone,
>
> my name is Mantas, I'm doing my PhD in wind power
> prediction and I am trying to use Grads to decode
> HIRLAM grib to ASCII. I need wind components from a
> limited number of grid points from one level, say
> level 60. I have found that "wgrib" is capable to do
> that, but it extracts data from all the grid points,
> which then I have to cut out with Matlab.
> Also I have tried "gribmap": I have set the lat and
> lon and lev, then I used "set gxout print", but the
> resulting data was on the GRADS window, not in the
> file.
> I tried "set gxout fwrite", but the output format is
> binary. Could anyone tell me, how can I get wind
> components from certain lat and lon in an output
> ASCII file? I would appreciate your help.
>
> Sincerely,
> Mantas Marciukaitis

____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.