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

Home » Public Forums » archive » Re: merge data-array with calender-date-array
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: merge data-array with calender-date-array [message #61668 is a reply to message #61662] Thu, 24 July 2008 03:28 Go to previous message
Chris[6] is currently offline  Chris[6]
Messages: 84
Registered: July 2008
Member
On Jul 23, 11:29 pm, julia.waltersp...@gmail.com wrote:
> the newbie calls out for help again :)
>
> Problem:
> I have two arrays: one with my MODIS-data (float), the second with the
> "matching" calender dates of the data (string, like "01/Jan/2002").
> Say the first number of the "data-array" belongs to the first date of
> the "date-array".
> What's the easiest way to merge those two arrays so that I will be
> able to easily plot the data with the matching dates as x-axis.
>
> Goal/Purpose:
> Plotting a time series of the data with the matching date on the x-
> axis.
>
> probably a super-easy task, but I only come up with rather inelegant
> solutions and I'm sure there's a simple and elegant way to do this.
> Cheers,
> juls

The first thought that comes to mind is to convert the date strings to
julian dates using a procedure like juldate from the IDL astronomy
user's library. That's kind of clunky since:
1) You have to loop through the date array
2) You have to convert strings like 'jan' to numbers like 1

anyways, it would look like

nrec=n_elements(date_array)
output=fltarr(2,nrec)
output[1,*]=data_array

for i=0L, n_elements(date_array)-1, 1 do begin
date=strsplit(date_array[i],"/",/extract)
case date[1] of
'Jan': month=1
etc etc
endcase
juldate,[float(date[2]),month,float(date[0])],jd
output[0,i]=jd
endfor

This is probably the inelegant solution you are hoping to avoid?

chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: wind/WAVES reg.,
Next Topic: generating SST trend from HDF Pathfinder data v5 enquiry

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

Current Time: Sat Oct 11 04:03:01 PDT 2025

Total time taken to generate the page: 1.83912 seconds