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

Home » Public Forums » archive » Daily to monthly
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Daily to monthly [message #89897 is a reply to message #89888] Fri, 19 December 2014 01:31 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On Wednesday, December 17, 2014 9:54:17 PM UTC+1, Craig Markwardt wrote:
> On Tuesday, December 16, 2014 1:21:46 PM UTC-5, mani...@gmail.com wrote:
>> Hi Craig,
>> I need Monthly means where missing values are taken care of
>
> Average = sum / n_points
>
> The only trick is that n_points could be different depending on missing data. So if I had an array of values DATA[*,*] where DATA[i,j] is the ith position on the jth day, and missing value is -999, I could sum them like this,
>
> tot = 0 ;; cumulative sum of data values
> npt = 0 ;; cumulative sum of number of good data values
> for j = 0, NDAYS-1 do begin
> mask = data[*,j] NE -999 ;; mask of good values only, 1=good
> npt = npt + mask ;; add to number of good values
> tot = tot + (data[*,j]*mask) ;; add good vals to cumulative data sum
> endfor
>
> ;; Compute average
> av = tot / npt
>
> Craig

Hi Craig,
Note that you might simply do:
mask = data ne -999
av = Total(data*mask, 2)/Total(mask, 2); daily average
av = Total(data*mask)/Total(mask); overall average
etc...

alx.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDLgrPolygon question
Next Topic: need personal IDL coach

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

Current Time: Sat Oct 11 05:13:47 PDT 2025

Total time taken to generate the page: 0.47367 seconds