Using where to create new variables of data [message #83676] |
Fri, 29 March 2013 09:09  |
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 #83810 is a reply to message #83676] |
Fri, 29 March 2013 16:36  |
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  |
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
|
|
|