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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: merge data-array with calender-date-array [message #61647] Fri, 25 July 2008 06:03
Bob[3] is currently offline  Bob[3]
Messages: 60
Registered: December 2006
Member
On Jul 24, 11:47 am, julia.waltersp...@gmail.com wrote:
> p.s. I have monthly averaged data, so 1month = 1 datapoint = 1 date
> (e.g. 1/01/2002)
>
> I don't need to plot ALL of the 99 dates, it would be sufficient if
> only the year (2000, 2001 etc) would be plotted, but not the day and
> month (and the year only ONCE for the following 12 data points). Does
> this avoid the problem with the max of 60 elements? and if yes, how on
> earth is it done? :)
> cheers
> juls

Sounds like you might want to convert your date array to julian date
(as Chris suggestted) after all.
Then use "plot, jdate, data" with tickunits='years', etc. There's
lots of tick keywords, so you should be abble to get a plot similar to
what you describe.
Re: merge data-array with calender-date-array [message #61656 is a reply to message #61647] Thu, 24 July 2008 08:47 Go to previous message
julia.walterspiel is currently offline  julia.walterspiel
Messages: 35
Registered: July 2008
Member
p.s. I have monthly averaged data, so 1month = 1 datapoint = 1 date
(e.g. 1/01/2002)

I don't need to plot ALL of the 99 dates, it would be sufficient if
only the year (2000, 2001 etc) would be plotted, but not the day and
month (and the year only ONCE for the following 12 data points). Does
this avoid the problem with the max of 60 elements? and if yes, how on
earth is it done? :)
cheers
juls
Re: merge data-array with calender-date-array [message #61657 is a reply to message #61656] Thu, 24 July 2008 08:32 Go to previous message
julia.walterspiel is currently offline  julia.walterspiel
Messages: 35
Registered: July 2008
Member
> [Chris I read the OP differently - that what is needed is to place the
> string dates on the axis for the time series plot of the data]

yes Bob, this is what I'm trying to do.

> I think the TICKNAME graphic keyword for your PLOT command may help
> you.
> something like:
> plot, data, xticks=xnum, xtickname=date
> where xnum is the number of dates.

The problem with the tickname is, as far as i understand, that it's a
string array holding only up to 60 elements. My date-array contains 99
dates.
Or am I misunderstanding something?
cheers
Re: merge data-array with calender-date-array [message #61662 is a reply to message #61657] Thu, 24 July 2008 05:58 Go to previous message
Bob[3] is currently offline  Bob[3]
Messages: 60
Registered: December 2006
Member
On Jul 24, 5:29 am, 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

[Chris I read the OP differently - that what is needed is to place the
string dates on the axis for the time series plot of the data]

Juls,

I think the TICKNAME graphic keyword for your PLOT command may help
you.
something like:
plot, data, xticks=xnum, xtickname=date
where xnum is the number of dates.

Bob.
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
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Wed Oct 08 13:46:02 PDT 2025

Total time taken to generate the page: 0.00641 seconds