[gradsusr] combine multiple variables in a single text file
Anil acharya
acharya_anil at yahoo.com
Wed Nov 9 17:43:39 EST 2011
Hi
I am using write instead of print and want two parameters in the same file (formatted: 1st column as pcp, 2nd column as tmp). But I am getting some format error. Can you tell me what is wrong in the last line of the script?
(This format is similar to matlab).
'set gxout print'
'set lat 38 42'
'set lon -105 -96'
'd apcp'
pcp=subwrd(result,16)
'd tmpsfc'
tmp=subwrd(result,16)
dummy = write('output.txt', '%8.4f %8.4f', pcp, tmp)
Please let me know if there is some other way of formatting multiple variables in a text file using write command.
Anil
________________________________
From: Arlindo da Silva <dasilva at alum.mit.edu>
To: Anil acharya <acharya_anil at yahoo.com>; GrADS Users Forum <gradsusr at gradsusr.org>
Sent: Wednesday, November 9, 2011 11:51 AM
Subject: Re: [gradsusr] regriding problem
On Wed, Nov 9, 2011 at 1:11 PM, Anil acharya <acharya_anil at yahoo.com> wrote:
Hi
>I am also stucked after regridding my parameters in the control file. When I open the control file, I have two parameters tmp and pcp. I am able to regrid to my specific watershed location and display the result using opengrads (following commands)
>
>
>set lat 38 42
>set lon -105 -96
>set t 1 50
>define pcp1=re(pcp,65,linear,-104.1875,0.125,25,linear,38.5625,0.125,bl)
>d pcp1
>define tmp1=re(tmp,65,linear,-104.1875,0.125,25,linear,38.5625,0.125,bl)
>d tmp1
>
>
>I need to get the regridded output (pcp1, tmp1) for all time periods and for each lat. and lon. in text files.
>e.g. file 1_-104.1875_38.5625 (pcp1 tmp1, parameters columnwise in each file)
> file 2_-104.1875_38.6875
> file 3_-104.0625_38.5625
> file 4_-104.0625_38.6875
>
>
>
>If you notice the format above, each file varies in latitude and longitude by 0.125. Also the file names should have 4 decimal points as above.
>
>
>I tried using while endwhile loop based on some instruction available in the graduser list (link below) but not able to fix the error. I just started using GRADS and I am meshing it again and again. I have not attached the code thinking it might confuse you more.
>
>
>http://gibies.blogspot.com/2009/11/text-output-of-data-from-grads.html
>
>
>
>I appreciate if someone can help me out to get the required text file format.
>
>
>
>
>
I am not sure what is your problem, regridding or writing data to text files. For text files, are you familiar with these recipes?
http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file
http://cookbooks.opengrads.org/index.php?title=Recipe-003:_Using_PyGrADS_to_save_variable_data_to_a_text_file
Arlindo
--
Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20111109/6e1e8fb6/attachment-0003.html
More information about the gradsusr
mailing list