[gradsusr] extract to ascii nesting while
Muhammad Rahiz
muhammad.rahiz at ouce.ox.ac.uk
Wed Jan 5 10:28:25 EST 2011
To generate ascii output, use the fprintf.gs script available at
http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file
I think you might want to do something like the following (not tested);
'sdfopen file.nc'
'set lon 60 100'
'set lat 10 20'
m=500
mtot=1000
while (m < mtot +1)
'set lev 'm'' ! do loop for lev
n=1
ntot=10
while (n < ntot +1)
'set t 'n'' ! do loop for time
'd var1'
'fprintf.gs var1 var1.'n'.'m'.txt' ! prints var1 ascii for t=n,lev=m
'd var2'
'fprintf.gs var2 var2.'n'.'m'.txt ! prings var2 ascii for t=n,lev=m
n=n+1
endwhile
m=m+500 ! this sets increament for lev i.e. lev = 500, lev = 1000. change
accordingly
endwhile
'fprintf.gs lon lon.txt' ! longitude info - no need for loop
'fprintf.gs lat lat.txt' ! as longitude
--
Muhammad Rahiz
Researcher & DPhil Candidate (Climate Systems & Policy)
School of Geography & the Environment
University of Oxford
On Wed, 5 Jan 2011, claudiomet wrote:
>
> Greetings GrADS users !!!
>
> I need to extract values from reanalysis grib file into ascii file
> the format of the ascii file must be
>
> date,lat,lon,lev,var1,var2,var3
>
> varying date and lev (nesting while) for each lat and lon
>
> ¿How to do this?
> --
> Claudio Cortes
> +56 (2) 2994121
>
> Meteorologo
> Laboratorio de Investigación, Innovación e Informática Aplicada (L3IA)
> Unidad de Modelacion y Gestion de la Calidad del Aire (UMGCA)
> Centro Nacional del Medio Ambiente (CENMA)
>
> --
> Claudio Cortes
> +56 (2) 2994121
>
> Meteorologist
> Laboratory Research, Innovation and Applied Informatics
> Modeling and Air Quality Management Unit
> National Enviroment Center, Chile (CENMA)
>
>
More information about the gradsusr
mailing list