Create new variable with subset of 4D array [message #87625] |
Wed, 19 February 2014 10:13  |
morganlsilverman
Messages: 46 Registered: February 2013
|
Member |
|
|
Hello,
I have a 4d array of data (lat,lon,altitude,time) that I need to extract a certain subset from. I typically use where to search for data.
for i=0,n_elements(houram)-1 do begin
index = where(lat(*,*,0,i) gt 38.996 and lat(*,*,0,i) lt 39.43 $
and lon(*,*,0,i) gt -76.95 and lon(*,*,0,i) lt -76.56)
lat_new(0:n_elements(index),i) = lat(index)
endfor
I'm running into problems creating new variables with only the found index data points. I keep getting the error 'Array subscript for LAT_NEW must have same size as source expression'. I understand that the indexed result is a 1d array and I'm trying to then pull those indexes from a 4d array, which won't work. The only way I can think to make this work though is to add 2 more for loops to go through latitude and longitude and provide a 4d result in some way. This seems really inefficient though. I know IDL must have a more efficient way to search for this data and create a new variable with it.
I hope this makes sense. Thank you.
Sincerely,
Morgan
|
|
|
|