[gradsusr] extract to ascii nesting while
claudiomet
claudiomet at gmail.com
Wed Jan 5 12:07:58 EST 2011
Thanks Muhammad !
Your script seems adaptable to what I need
Thank you very much
Greetings !
2011/1/5 Muhammad Rahiz <muhammad.rahiz at ouce.ox.ac.uk>
>
> 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)
>>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
--
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 Centre, Chile (CENMA)
More information about the gradsusr
mailing list