3 columns (Year, Day, Time) How do I make them Mon/Day/Year on a graph?

RochaJM79
Posts: 6
Joined: 2008-08-01
Location: United States

I have 3 columns on my chart from my data files

They come in as Year, Day (numerically 254 or 365 for example), and Time (either 0000 or 1200)

How can I get these 3 columns to graph as one date?


Posts: 82
Joined: 2007-06-21
Location: United States

Here is a solution which I have not tested:

Function CreateDateTimeWave(year, dayOfYear, timeOfDay, newWaveName)
	Wave year
	Wave dayOfYear
	Wave timeOfDay			// 1200 represents noon
	String newWaveName		// Name for new wave
 
	Variable numPoints = numpnts(year)		// Assume all input waves have the same number of points
 
	Make/O/N=(numPoints)/D $newWaveName
 
	Wave w = $newWaveName				// Create wave reference to new wave
	SetScale d, 0, 0, "dat", w				// Tell Igor it is a date/time wave
 
	w = date2secs(year, 0, 0)				// Convert to Igor date/time format (seconds since 1/1/1904)
 
	w += dayOfYear * 60*60*24			// Add seconds corresponding to day of year
 
	w += (timeOfDay / 100) * 60*60		// Add seconds corresponding to time of day
End

You can use the resulting wave as the X wave of an XY pair for graphing.


RochaJM79
Posts: 6
Joined: 2008-08-01
Location: United States

Thanks... I'll be trying this out tomorrow when I get to the office.


Back to top