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

Home » Public Forums » archive » Re: IDL missing date and data
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: IDL missing date and data [message #64898] Thu, 29 January 2009 04:42
loebasboy is currently offline  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 :)
Re: IDL missing date and data [message #64899 is a reply to message #64898] Thu, 29 January 2009 04:41 Go to previous message
loebasboy is currently offline  loebasboy
Messages: 26
Registered: August 2008
Junior Member
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.
Re: IDL missing date and data [message #64900 is a reply to message #64899] Thu, 29 January 2009 04:38 Go to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Thu, 29 Jan 2009 02:15:05 -0800 (PST), mbo <mstyesi@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


How about this:

days=[20,24,25,26]
months=[7,7,7,7]
years=[1999,1999,1999,1999]
data=[20,40,10,10]
date=JULDAY(months,days,years)

ind=date-date[0]
ndays=ind[n_elements(date)-1]+1
date_full=lindgen(1,ndays)+date[0]
data_full=make_array(1,ndays,value=!values.f_nan)
data_full[ind]=data

CALDAT, date_full, months, days, years
print, [months, days, years, $
data_full],format='(I02,"/",I02,"/",I04,F)'
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL missing date and data
Next Topic: change mouse cursor in draw widget

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

Current Time: Wed Oct 08 19:31:17 PDT 2025

Total time taken to generate the page: 0.00899 seconds