[gradsusr] opening text file data

Jennifer Adams jma at cola.iges.org
Sun Mar 6 10:23:07 EST 2011


Of course you can write more than one variable to a binary file, you  
just have to be careful in the order in which you write the grids.  
Please see:
http://iges.org/grads/gadoc/aboutgriddeddata.html#structure
--Jennifer


On Mar 5, 2011, at 8:25 AM, LeeJoice, Robert N wrote:

> Jennifer,
>
> Do you have to only output a single variable to each binary data  
> file?  I could see the utility of this to create line graphs within  
> GrADS from text data.
>
> Robert LeeJoice
>
>
> On 2/9/11 11:27 AM, "Jennifer Adams" <jma at cola.iges.org> wrote:
>
>> James,
>> Before GrADS can handle your data, you need to convert it from text  
>> to binary. Try something like this:
>>
>> 'open dummy.ctl'
>> file=7hA01.out.txt
>> nlinesinfile=755
>> i=1
>> 'set gxout fwrite'
>> 'set fwrite 7hA01.out.bin'
>> while (i<=nlinesinfile)
>>  res = read(file)
>>  line2=sublin(res,2)
>>  val = subwrd(line2,2)
>>  'd 'val
>>  i=i+1
>> endwhile
>> 'disable fwrite'
>>
>> ...dummy.ctl looks like this:
>>
>> dset foo
>> options template
>> undef -9.99e8
>> xdef 1 linear 1 1
>> ydef 1 linear 1 1
>> zdef 1 linear 1 1
>> tdef 755 linear 0Z01JAN1948 1mo
>> vars 1
>> foo 0 99 foo
>> endvars
>>
>> ... and your new GrADS data set looks like this:
>>
>> dset ^7hA01.out.bin
>> undef -9.99e8
>> xdef 1 linear 1 1
>> ydef 1 linear 1 1
>> zdef 1 linear 1 1
>> tdef 755 linear 0Z01JAN1948 1mo
>> vars 1
>> var 0 99 var
>> endvars
>>
>>
>> --Jennifer
>>
>>
>>
>> On Feb 7, 2011, at 10:48 AM, James Ciarlo` wrote:
>>
>>> Hi,
>>>
>>> I have several text files such as the one I attached and I need to  
>>> open them which GrADS but I cannot understand how to do so. Can  
>>> someone help me please?
>>>
>>> James
>>>  <7hA01.out.txt>_______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>> --
>> Jennifer M. Adams
>> IGES/COLA
>> 4041 Powder Mill Road, Suite 302
>> Calverton, MD 20705
>> jma at cola.iges.org
>>
>>
>>
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110306/2b46d6e5/attachment-0003.html 


More information about the gradsusr mailing list