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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Five days mean values [message #45752] Fri, 07 October 2005 05:10
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Julio wrote:
> Thanks Mike, now I undestand how rebin works...
>
> I'll try this, but I'm not sure rebin will help me... The fact is my
> temperature array size is not always multiple of five, due to the
> number of days in a month (28, 30 or 31).
>
> Kind Regards,
> J�lio
>
Hello,

I'm not sure what you want to do with the 'extra' days each month. But
if what you want is to bin the dates into 5-day consecutive groups then
I suggest you...

(1) Convert your dates from strings to Julian day values. You need to
used some string processing before you get to using JULDAY().

(2) Sort your dates into 5 day bins using HISTOGRAM().

H = HISTOGRAM(myJulianDayValues, START = JULDAY(8,1,2001), BIN = 5, $
REVERSE = r, LOCATION = binStartDates)

(3) Use the REVERSE_INDICES to extract the records for each 5 day group.

Hope that helps.

Cheers,
Ben
Re: Five days mean values [message #45757 is a reply to message #45752] Thu, 06 October 2005 11:04 Go to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> I'll try this, but I'm not sure rebin will help me... The fact is my
> temperature array size is not always multiple of five, due to the
> number of days in a month (28, 30 or 31).

With or without rebin, what do you with the days at the end of a month.
You said previously that you were calculating 5-day averages. What do
you want to do with the left over days?

-Mike
Re: Five days mean values [message #45758 is a reply to message #45757] Thu, 06 October 2005 10:54 Go to previous message
Julio[1] is currently offline  Julio[1]
Messages: 52
Registered: May 2005
Member
Thanks Mike, now I undestand how rebin works...

I'll try this, but I'm not sure rebin will help me... The fact is my
temperature array size is not always multiple of five, due to the
number of days in a month (28, 30 or 31).

Kind Regards,
Júlio
Re: Five days mean values [message #45760 is a reply to message #45758] Thu, 06 October 2005 07:23 Go 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
>
>
Re: Five days mean values [message #45761 is a reply to message #45760] Thu, 06 October 2005 05:56 Go to previous message
Julio[1] is currently offline  Julio[1]
Messages: 52
Registered: May 2005
Member
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
Re: Five days mean values [message #45764 is a reply to message #45761] Wed, 05 October 2005 14:57 Go to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: easy question
Next Topic: Easy question?

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

Current Time: Wed Oct 08 11:35:52 PDT 2025

Total time taken to generate the page: 0.00394 seconds