AGAIN for Binary to Ascii conversion
nana kum
amabro23 at YAHOO.COM
Thu Sep 6 12:06:03 EDT 2007
Dear good users,
I have gone through almost all the mail on this topic but I don't seem to get an answer to my problem.
I want to write a number of output files to ASCII format.
The output of d m3.1 is overwritten by d m3.2 and so the last value I have is that of d m3.3. My script is below.
I will be glad if someone can be of help.
Thank you.
Nana Browne
University of Cape Town
South Africa
'reinit'
'open ECMW_M05_PRCP.ctl'
'set gxout print'
'set prnopts %12.3e 5 2'
'set lon 0 60'
'set lat -40 0'
'set t 22 25'
'd m3.1'
'set dfile 2'
'set lon 0 60'
'set lat -40 0'
'set t 22 25'
'd m3.2'
'set dfile 3'
'set lon 0 60'
'set lat -40 0'
'set t 12 15'
'd m3.3'
rc=write(ECMW2.txt,result)
rc=close(ECMW2.txt)
> 'reinit'
> 'sdfopen /doma/horvath/uwnd.sig995.1961.nc'
> 'set t 1'
> 'set lon 15 25'
> 'set lat 38 48'
> 'set gxout print'
> 'set prnopts %10.3e 5 1'
> 'd uwnd'
> rc=write(ascii.txt,result)
> rc=close(ascii.txt)
> 'quit'
> return
>
> The script works and the result is:
>
> Printing Grid -- 30 Values -- Undef = 32766
> 3.100e+00 1.900e+00 1.400e+00 1.300e+00 -1.200e+00
> 1.400e+00 1.100e+00 2.000e-01 -6.000e-01 -2.100e+00
> 2.000e-01 -2.000e-01 -7.000e-01 -5.000e-01 -8.000e-01
> -1.900e+00 -2.100e+00 -2.500e+00 -1.800e+00 -8.000e-01
> 1.600e+00 1.400e+00 -1.000e-01 -8.000e-01 1.987e-06
> 5.700e+00 3.900e+00 1.700e+00 6.000e-01 7.000e-01
>
> Now if I modify the script:
> 'set lon 15 25'
> 'set lat 38' ; result is
> Printing Grid -- 5 Values -- Undef = 32766
> 3.100e+00 1.900e+00 1.400e+00 1.300e+00 -1.200e+00 ; which is ok.
>
> and the second modification:
> 'set lon 15 25'
> 'set lat 48'
> Printing Grid -- 5 Values -- Undef = 32766
> 1.600e+00 1.400e+00 -1.000e-01 -8.000e-01 1.987e-06 ; which is
> not in accordance with the "area" example
>
> What is the reason for the above discrepancy?
>
> Thanks and regards,
> Kristian
>
> At 23:05 22.2.2007, you wrote:
>> If you don't need the data in binary (which is what you have in file
>> yiki.dat), you can skip the "gxout fwrite" lines and use "gxout print"
>> instead. Eg, in a grads script:
>>
>> 'set gxout print'
>> 'set t 613 697'
>> 'display tloop(mean(soilw,lon=95.5,lon=112.5,lat=31.5,lat=42.5))'
>> rc=write(yiki.txt,result)
>> say 'return code from write is: 'rc
>> rc=close(yiki.txt)
>> say 'return code from close is: 'rc
>>
>> In the above, the output from the display command gets stored in
>> variable "result" and you write the contents of "result" to ascii file
>> yiki.txt.
>>
>> See the doc for 'set prnopts' at
>> http://grads.iges.org/grads/gadoc/gradcomdsetprnopts.html
>> if you want to change the format of the text output.
>>
>> Diane
>>
>>
>> Yitbarek Kifle wrote:
>>> Dear all,
>>>
>>> As a new and inexperienced user of Grads,i have come with a problem of
>>> converting the Grads time series binary output to Ascii format.I have
>>> read
>>> almost all such problems on the users group list but that doesn't
>>> seem to
>>> help me. Here is the discription of what i did,
>>>
>>> 'set gxout fwrite'
>>> 'set fwrite yiki.dat'
>>> set t 613 697
>>> d tloop(mean(soilw,lon=95.5,lon=112.5,lat=31.5,lat=42.5))
>>> disable fwrite
>>>
>>> i have the file Yiki.dat.
>>>
>>> Would somebody please tell me what to do next in step by step
>>> basis,as I do
>>> not have a programming skill?
>>>
>>> thanks in advance.
>>
>>
>> ________ Information from NOD32 ________
>> This message was checked by NOD32 Antivirus System for Linux Mail Server.
>> http://www.nod32.com
>>
>> __________ NOD32 2072 (20070220) Information __________
>>
>> This message was checked by NOD32 antivirus system.
>> http://www.eset.com
>>
>
> _________________________________
> Kristian Horvath email: horvath at cirus.dhz.hr
> Graduate Research Associate tel:+385-1-4565752
> Meteorological and Hydrological Service www:
> http://www.dhmz.htnet.hr/index.php
> Gric 3, 10000 Zagreb, Croatia personal www:
> http://radar.dhz.hr/~horvath
>
---------------------------------
Pinpoint customers who are looking for what you sell.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20070906/b77c3d4a/attachment.html
More information about the gradsusr
mailing list