Re: IDL missing date and data [message #64898] |
Thu, 29 January 2009 04:42  |
loebasboy
Messages: 26 Registered: August 2008
|
Junior Member |
|
|
On 29 jan, 13:41, loebasboy <stijn....@gmail.com> wrote:
> On 29 jan, 11:15, mbo <msty...@gmail.com> wrote:
>
>
>
>
>
>> I am to creating a monthly time series data from daily averages data
>> that spans from 1999 to 2008.
>
>> However, there data gaps of about 2 to for 4 days for some of the
>> monts. So that this data would look like this
>
>> 20/07/1999 20
>> 24/07/1999 40
>
>> You would notice that there are 4 days missing but the data shows no
>> gaps int it.
>
>> How can I expand this kind of data to look like this
>
>> 20/07/1999 20
>> 21/07/1999 NaN
>> 22/07/1999 NaN
>> 23/07/1999 NaN
>> 24/ 07/1999 40
>
> First make a matrix with 2 columns with length of all days. The first
> column consist of all the dates of days you need. I think you can
> generate that with the TIMEGEN function. The second column all consist
> of Nan values which you can create by using !values.f_nan . Then do a
> for loop on the original matrix to fill in the data you have by
> comparing the dates of the second matrix with the first matrix and
> getting the index with a where function. Then fill in the second
> matrix with that index and the right value. An easy, but maybe not
> that efficient (cause of the for loop), solution.- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
Nevermind my bollocks and use the code of Wox :)
|
|
|