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 #89888 is a reply to message #89881] Wed, 17 December 2014 12:54 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
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
[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: Wed Oct 08 17:51:58 PDT 2025

Total time taken to generate the page: 0.00429 seconds