Re: Satellite Swath Overlap [message #87527 is a reply to message #87523] |
Wed, 12 February 2014 12:06   |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
On Wednesday, February 12, 2014 11:14:21 AM UTC-6, Chase Calkins wrote:
>
> I was wanting to know if there is a way IDL can say where the overlap is and average the result between the two files in the overlap section.
>
Well, your example shows the arrays are the same size and cover the same lat/lon, so I would say they "overlap" everywhere (assuming the same thing as Andy about the size of result1/result2).
Let's say you have a missing value (again, building off Andy's example). The non-loop way would be to do something like this:
ind1 = WHERE(result1 EQ missingValue, count1) ;find missing values...
IF count1 NE 0 THEN result1[ind1] = !VALUES.F_NAN ;.. and replace them with NaNs
ind2 = WHERE(result2 EQ missingValue, count2) ;find/replace the missing value in result2 too...
IF count2 NE 0 THEN result2[ind2] = !VALUES.F_NAN
;to find the mean, build a 36x400x2 array, do the mean over the third dimension
resultAvg = MEAN([[[result1]], [[result2]]], dim=3, /NAN) ;avg the results
;find the NaNs; this will be where both arrays have the missing value...
indAvg = WHERE(~FINITE(resultAvg), countAvg)
IF countAvg NE 0 THEN resultAvg[indAvg] = missingValue ;...and put the missing value back
;go plot....
Notice I'm overwriting the original arrays - so you would modify this slightly if this isn't acceptable.
Also, I'm testing for equality between floats, always a precarious affair. You may want to test instead if the difference b/t the results and the missing value is some small number.
|
|
|