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

Home » Public Forums » archive » Re: Five days mean values
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: Five days mean values [message #45760 is a reply to message #45758] Thu, 06 October 2005 07:23 Go to previous messageGo to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
I wouldn't have thought of using rebin, but rebin will do the job for
you as Ken describes. Rebin is used to resize arrays. When you
compress an array, rebin take averages of the data points in the array.
You can use rebin to compress your temperature array and when it does
so, averages will automatically be taken.

In order for the results to be accurate, you can neither have any
missing days nor can your temperature array size not be a multiple of
five. The array has to be a multiple of five because the compression
and averaging is occurring over every five data points.

; temp is your temperature array
avgtemp = rebin(temp, n_elements(temp) / 5)

The n_elements(temp) / 5 tells us how many five element groups there are
in your temperature array. The first five elements will be averaged and
stored in avgtemp[0]. The second five elements will be averaged and
stored in avgtemp[1], etc.

-Mike


Julio wrote:
> Hi Kenneth,
>
> I don't see how rebin can help me... An example, considering the
> meteorological data below, I want to find the temp(max) mean values
> from 01/08/2001 to 05/08/2001 and from 06/08/2001 to 10/08/2001...
>
> So I have Temp (max) = 27.2 and 27.4
>
> The problem is I have a very large amount of data. I can't see a way to
> find the mean value every five days.
>
> Any comments welcome!
>
> Regards,
> J�lio
>
> Kenneth Bowman escreveu:
>
>
>> In article <1128546470.965721.312300@g49g2000cwa.googlegroups.com>,
>> "Julio" <julio@cpa.unicamp.br> wrote:
>>
>>
>>> Hello people,
>>>
>>> I have meteorological data from several years, like these:
>>>
>>> Date Temp (max) Temp (min)
>>> 01/08/2001 27.2 12.7
>>> 02/08/2001 27.8 12.4
>>> 03/08/2001 26.8 16.3
>>> 04/08/2001 26.6 12
>>> 05/08/2001 27.4 11
>>> 06/08/2001 27.6 16.1
>>> 07/08/2001 27.6 11.2
>>> 08/08/2001 28.4 13.4
>>> 09/08/2001 27.2 10.9
>>> 10/08/2001 26 9.7
>>>
>>> I want to calculate mean value from 01-05 days, 05-10 days, 10-15 days
>>> and so on.
>>> In other words, I must get the mean value at each five days.
>>> I'm trying to make some code to get it automatically. I think this kind
>>> of work is trivial for meteorological data users. Does anybody have
>>> some idea?
>>>
>>> Regards,
>>> J�lio
>>
>> If the data are in an array T, this is a very quick way to compute averages
>>
>> IDL> T = findgen(15)
>> IDL> print, T
>> 0.00000 1.00000 2.00000 3.00000 4.00000 5.00000
>> 6.00000
>> 7.00000 8.00000 9.00000 10.0000 11.0000 12.0000
>> 13.0000
>> 14.0000
>> IDL> print, rebin(T, 3)
>> 2.00000 7.00000 12.0000
>>
>> but make sure that the number of days is a multiple of 5 and that you have no
>> missing data. Also, watch out for leap days.
>>
>> Ken Bowman
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: easy question
Next Topic: Easy question?

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

Current Time: Thu Oct 09 23:00:08 PDT 2025

Total time taken to generate the page: 0.71841 seconds