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

Home » Public Forums » archive » Using where to create new variables of data
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
Using where to create new variables of data [message #83676] Fri, 29 March 2013 09:09 Go to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
Hello,

I noticed that when I use where to find locations and then create a variable using those locations such as below, I get a 1D array for adatea and a 3D array for atempa. I was expecting a 2D array for adatea. I can see how its putting the matching columns and rows into the 1D array but it makes it more complicated when I want to plot the temperature profile for that corresponding date. Is there another way to do this?

acitya = where(strmatch(airport.orig,'PHL ') eq 1,acounta)
s = size(airport.orig)
ncol = s(1)
cola = acitya mod ncol
rowa = acitya/ncol
atempa = airport.temp(cola,rowa,*)
adatea = airport.date(cola,rowa)

Thank you.
Sincerely,
Morgan
Re: Using where to create new variables of data [message #83806 is a reply to message #83676] Fri, 29 March 2013 17:12 Go to previous message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
Just piggy-backing on Russell's answer....

ARRAY_INDICES is something to look into:

http://www.exelisvis.com/docs/ARRAY_INDICES.html

It will take the 1D array of indices from WHERE and give a 2D array to access your data. See the example in the documentation - it uses MAX, but the concept is similar.

It's also perfectly valid to use the 1D array to access the array - you will lose the dimensionality though.
Re: Using where to create new variables of data [message #83810 is a reply to message #83676] Fri, 29 March 2013 16:36 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Friday, March 29, 2013 12:09:06 PM UTC-4, morganls...@gmail.com wrote:
> Hello,
>
>
>
> I noticed that when I use where to find locations and then create a variable using those locations such as below, I get a 1D array for adatea and a 3D array for atempa. I was expecting a 2D array for adatea. I can see how its putting the matching columns and rows into the 1D array but it makes it more complicated when I want to plot the temperature profile for that corresponding date. Is there another way to do this?

You can use REFORM() to change a 2D array or 3D array into a 1D array.

Craig
Re: Using where to create new variables of data [message #83812 is a reply to message #83676] Fri, 29 March 2013 15:10 Go to previous message
Russell[1] is currently offline  Russell[1]
Messages: 101
Registered: August 2011
Senior Member
Again, I'm really not trying to be a jerk. But it's very hard to answer your question without knowing the details of the data. As a general rule, no one will look at a segment of code that they can't immediately dissect in the time it takes to drink a gulp of coffee (and that's killing your other questions). Here I can see what you want. But, I don't know what the structure airport looks like. Give us the output of the following two commands:

help,airport

and

help,airport,/structure

Then we have a good idea how to help you...

Russell



On Friday, March 29, 2013 12:09:06 PM UTC-4, morganls...@gmail.com wrote:
> Hello,
>
>
>
> I noticed that when I use where to find locations and then create a variable using those locations such as below, I get a 1D array for adatea and a 3D array for atempa. I was expecting a 2D array for adatea. I can see how its putting the matching columns and rows into the 1D array but it makes it more complicated when I want to plot the temperature profile for that corresponding date. Is there another way to do this?
>
>
>
> acitya = where(strmatch(airport.orig,'PHL ') eq 1,acounta)
>
> s = size(airport.orig)
>
> ncol = s(1)
>
> cola = acitya mod ncol
>
> rowa = acitya/ncol
>
> atempa = airport.temp(cola,rowa,*)
>
> adatea = airport.date(cola,rowa)
>
>
>
> Thank you.
>
> Sincerely,
>
> Morgan

Your question doesn't make a lot of sense without knowing more about the data, parituclarly the structure: airport. In any event, look at array_indices, it's a way of
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Calculating difference between each element in array from previous
Next Topic: Calculating difference between each element in array from previous

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

Current Time: Wed Oct 08 18:40:16 PDT 2025

Total time taken to generate the page: 0.00503 seconds