comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » ARRAYS
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
ARRAYS [message #2860] Thu, 08 September 1994 08:04 Go to next message
mallozzi is currently offline  mallozzi
Messages: 60
Registered: August 1994
Member
I must be missing something simple, but I sometimes find myself needing to
concatinate arrays as follows:

x = FINDGEN(10)
y = FINDGEN(4,20)
z = [x, y(1,*)]

This won't work because IDL sees y(1,*) as a 2-d array, and x is 1-d.
Is there an easy way to concatenate two "vectors" without looping through
the y-array and extracting the approriate elements like this:

temp = FLTARR(N_ELEMENTS(y))
for i=0,N_ELEMENTS(y)-1 do temp(i) = y(1,i)
z = [x,temp]

Thanks
Bob Mallozzi
mallozzi@ledzep.msfc.nasa.gov
Re: Arrays [message #39954 is a reply to message #2860] Wed, 30 June 2004 08:43 Go to previous message
rats is currently offline  rats
Messages: 11
Registered: June 2004
Junior Member
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b4bb6d9705c81819897bc@news.frii.com>...
> David Fanning writes:
>
>> Well, I don't know why your problems are confined to just
>> the second column, but I agree with Craig that you need
>> to make these values double precision. Note this experiment:
>>
>> IDL> d='3 492515.080 5506165.090 98.320'
>> IDL> a=fltarr(4)
>> IDL> print, a[1]
>> 492515.
>
> Whoops! Forgot that READS in there!
>
> IDL> d='3 492515.080 5506165.090 98.320'
> IDL> a=fltarr(4)
> IDL> reads, d, a
> IDL> print, a[1]
> 492515.
>
> Cheers,
>
> David


Thanks David and Craig ... Now with double precision it is working ...

Rafael
Re: Arrays [message #39967 is a reply to message #2860] Tue, 29 June 2004 17:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Well, I don't know why your problems are confined to just
> the second column, but I agree with Craig that you need
> to make these values double precision. Note this experiment:
>
> IDL> d='3 492515.080 5506165.090 98.320'
> IDL> a=fltarr(4)
> IDL> print, a[1]
> 492515.

Whoops! Forgot that READS in there!

IDL> d='3 492515.080 5506165.090 98.320'
IDL> a=fltarr(4)
IDL> reads, d, a
IDL> print, a[1]
492515.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Arrays [message #39968 is a reply to message #2860] Tue, 29 June 2004 17:26 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Rafael Loos writes:

> Hi, I am new with IDL and I am having some problems with arrays.
> I have a file with 4 column and 5,607,515 rows.
>
> Example of one line: 3 492515.080 5506165.090 98.320
>
> I am separating all the columns in different arrays (1, 5607515)
>
> The problem is when I try to visualize the SECOND column (492515.080)
> ... what I see is just the numbers before de "point" and the point (eg
> 492515.) all the numbers after I can not see ...
> With the other columns that is not a problem ... just with the second
> ... What am I doing wrong ?

Well, I don't know why your problems are confined to just
the second column, but I agree with Craig that you need
to make these values double precision. Note this experiment:

IDL> d='3 492515.080 5506165.090 98.320'
IDL> a=fltarr(4)
IDL> print, a[1]
492515.

And, then:

IDL> a=dblarr(4)
IDL> reads, d, a
IDL> print, a[1]
492515.08

And, especially,

IDL> print, a[1], format='(F20.4)'
492515.0800

You might find this article useful:

http://www.dfanning.com/tips/double.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Arrays [message #39970 is a reply to message #2860] Tue, 29 June 2004 16:18 Go to previous message
rats is currently offline  rats
Messages: 11
Registered: June 2004
Junior Member
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b4b557d4acd42de9897ba@news.frii.com>...
> Rafael Loos writes:
>
>> The problem is when I try to visualize the SECOND column (492515.080)
>> ... what I see is just the numbers before de "point" and the point (eg
>> 492515.) all the numbers after I can not see ...
>> With the other columns that is not a problem ... just with the second
>> ... What am I doing wrong ?
>
> There is nothing wrong with what you have shown
> us. How, exactly, are you trying to "visualize"
> this second column?
>
> Cheers,
>
> David

Thank you for the message, David.

I am saving all the values from the array into a txt file.
I see that problem when I open the txt file.
But all the other txt files are correct. Only the second with the
LATitudes values that are incorrect(492515.)
Even when I try anything like a MEAN function on the array this
problem occurs only with the second column ... All the others are
working perfeclty.

Thank you again,
Rafael
Re: Arrays [message #39976 is a reply to message #2860] Tue, 29 June 2004 11:48 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
rats@mail.geog.uvic.ca (Rafael Loos) writes:
> Hi, I am new with IDL and I am having some problems with arrays.
> I have a file with 4 column and 5,607,515 rows.
>
> Example of one line: 3 492515.080 5506165.090 98.320
>
> I am separating all the columns in different arrays (1, 5607515)
>
> The problem is when I try to visualize the SECOND column (492515.080)
> ... what I see is just the numbers before de "point" and the point (eg
> 492515.) all the numbers after I can not see ...
> With the other columns that is not a problem ... just with the second
> ... What am I doing wrong ?

...
> data = FltArr(4, 5607515)
...

Have you considered that your numbers require double precision (>7
digits), and you are using only single precision floating point (< 7
digits)?

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: Arrays [message #39978 is a reply to message #2860] Tue, 29 June 2004 10:32 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Rafael Loos writes:

> The problem is when I try to visualize the SECOND column (492515.080)
> ... what I see is just the numbers before de "point" and the point (eg
> 492515.) all the numbers after I can not see ...
> With the other columns that is not a problem ... just with the second
> ... What am I doing wrong ?

There is nothing wrong with what you have shown
us. How, exactly, are you trying to "visualize"
this second column?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: 3D overplotting??
Next Topic: Re: 3D overplotting??

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:41:32 PDT 2025

Total time taken to generate the page: 0.00833 seconds