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 
Switch to threaded view of this topic Create a new topic Submit Reply
Daily to monthly [message #89879] Mon, 15 December 2014 20:10 Go to next message
manikbali is currently offline  manikbali
Messages: 4
Registered: December 2014
Junior Member
Hi
I have daily satellite scan files of soil moisture from 1979 - 2008. I want to convert it into monthly values.
What is the best way to to it.
-GlanPlon
Re: Daily to monthly [message #89880 is a reply to message #89879] Tue, 16 December 2014 09:49 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Monday, December 15, 2014 11:10:17 PM UTC-5, mani...@gmail.com wrote:
> Hi
> I have daily satellite scan files of soil moisture from 1979 - 2008. I want to convert it into monthly values.
> What is the best way to to it.

Decimation, averaging, and taking the median are all viable methods. What do you need?
Re: Daily to monthly [message #89881 is a reply to message #89880] Tue, 16 December 2014 10:21 Go to previous messageGo to next message
manikbali is currently offline  manikbali
Messages: 4
Registered: December 2014
Junior Member
Hi Craig,
I need Monthly means where missing values are taken care of
Glan
Re: Daily to monthly [message #89888 is a reply to message #89881] Wed, 17 December 2014 12:54 Go to previous messageGo to next 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
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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDLgrPolygon question
Next Topic: need personal IDL coach

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

Current Time: Wed Oct 08 07:14:09 PDT 2025

Total time taken to generate the page: 0.00399 seconds