Help

Javier Peña javier.p at EREDA.COM
Thu Sep 17 09:22:44 EDT 2009


Thank so much for your reply.
With the script you have sent me:

'reinit'
'sdfopen ereda'
'set lat 41'
'set lon 359'
'set lev 1'
to = 1
* Write the variable to a file
*'set gxout vector'
*'set fwrite z:\dummy.dat'
while (to<5)
'set t 'to
tmp=''
tmp=subwrd(rerult,4)
'd u';tmp=tmp%''subwrd(result,4)
rrc = write('c:\prueba_c\pruebas_archivo_ecmwf\prueba3.txt',tmp)
tmp=subwrd(rerult,4)
'd v';tmp=tmp%''subwrd(result,4)
rrc = write('c:\prueba_c\pruebas_archivo_ecmwf\prueba3.txt',tmp)
to = to + 1
endwhile
set lev 1
I've gotten the following result:

0.261717
-2.01558
2.12168
-4.01917
1.91571
-4.87874
0.710381
-3.54395

In the first row, the fist data of the u velocity appears; in the second
row, the second data of the v velocity appears, in the third row, the second
data of the u velocity appears; in the fourth row, the second data of the v
velocity appears.
This is fine but I'd would like the following: The first data of u velocity
appears in the first row and first column, the second data of u velocity
appears in the second row and first column,... The first data of v velocity
appears in the first row and second column; the second data of velicity
appears in the second row and the second column,...
I mean, somethink similar like this:
 0.261717        -2.01558
2.12168          -4.01917
1.91571          -4.87874
0.710381        -3.54395
It say like a array o matrix.
Is it possible to do that?

Best Regards:

Javier Peña


2009/9/17 Kim WonMoo <kwmski7 at snu.ac.kr>

>  Try this :
>
> in the 'while' loop,
> ------------------------------------------
>  while ( to<5 )
>  'set t 'to
>  tmp=''
>  'd var1' ; tmp=subwrd(result,4)
>  'd var2' ; tmp=tmp%' 'subwrd(result,4)
>  'd var3' ; tmp=tmp%' 'subwrd(result,4)
>  'd var4' ; tmp=tmp%' 'subwrd(result,4)
>  rrc = write('c:\prueba_c\pruebas_archivo_ecmwf\ereda_ecmwf_t.txt',tmp)
>  to = to + 1
> endwhile
> ------------------------------------------
>
> so that before you write to ~.txt file, make a augmented outputs as in the
> script.
>
> here, subwrd(result,4) is used, for the 4th word of the 'result' contains
> the value.
>
> Good luck,
> Kim, WonMoo
>
>
>  *From:* Javier Peña <javier.p at EREDA.COM>
> *Sent:* Thursday, September 17, 2009 6:23 PM
> *To:* GRADSUSR at LIST.CINECA.IT
> *Subject:* Help
>
> We have some data in a netcdf file (u velocity, v velocity,
> geopetential,ect) to some dates and some points of a grid.
> Now, we extract each variable in a file with following script:
> For example to extract the temperature:
>
> 'reinit'
> 'sdfopen ereda'
> 'set lat 41'
> 'set lon 359'
> 'set lev 1'
> to = 1
> * Write the variable to a file
> *'set gxout vector'
> *'set fwrite z:\dummy.dat'
> while (to<5)
> 'set t 'to
> 'd t'
> rrc = write('c:\prueba_c\pruebas_archivo_ecmwf\ereda_ecmwf_t.txt',result)
> to = to + 1
> endwhile
> We'd like to extract all variables in a same file and the variables are in
> differents columns.
> Are there any script to do this?
>
> --
> Javier Peña Álvarez
> Energías Renovables
> javier.p at ereda.com
> EREDA
>
>                            Tel:  +34 91 5014755
>                            Fax: +34 91 5014756
>                  c/ Téllez 26, 28007 MADRID
>                                    www.ereda.com
>



-- 
Javier Peña Álvarez
Energías Renovables
javier.p at ereda.com
EREDA

                           Tel:  +34 91 5014755
                           Fax: +34 91 5014756
                 c/ Téllez 26, 28007 MADRID
                                   www.ereda.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20090917/550cf69d/attachment.html 


More information about the gradsusr mailing list