Has anyone figured out an easy way to convert the CR10x date/time format into the newer CR-1000 date/time format? I need to go from the old format of the year, day of the year and time in 3 separate columns to the calendar day and time in one column like what comes out of the CR-1000.
If you are looking to convert it on the datalogger then you could use the PakBus operating system. It uses this format by default.
Just a portion of a solution, but if you're using linux or have the gnu date utility handy this function can convert from day-of-year to month-day formats:
jul () { date -d "$1-01-01 +$2 days -1 day" "+%Y/%m/%d"; }
This takes advantage of date's built-in math operations on dates, where the number of days is added to the date at the start of the year. The same technique can be used in other languages, and the day-of-year offset could be converted to seconds if that works more easily with the platform's date and time structures.
Just to clarify, the function in my previous message was for the bash shell. Here's another version that accomodates the time fields and formats the output more like the CR1000 timestamps (which are very close to ISO 8601):
doy2iso() { date -d "$1-01-01 -1 day +$2 days +$3 hours +$4 minutes +$5 seconds" +"%Y-%m-%d %H:%M:%S"; }
Again, in most environments it will probably be simpler to convert the days, hours, minutes, and seconds to an offset in seconds from the start of the year.
Given an array record like:
134,2011,262,1900,1.854,2.777,...
The function would be called with the parsed time fields:
doy2iso 2011 262 19 0 0
to produce:
2011-09-19 19:00:00
You could process the data file with Split (that comes in LoggerNet) and use the Date function to create the timestamp.
Split par files can be set up as a Task in the TaskMaster, so that they are run after data is collected from a datalogger.
Examples of both of the above are in the Split help & Task Master help respectively.
Dana W.
As far as ongoing data, we have switched the CR10x's to the PB OS. I don't have much experience with Split. I found the example of 'edate("mm/dd/yy, h:nn";4;3;2)'. When I enter this under Select, all it does is split the data from the file without converting the year, date, time, etc.
If you are processing a mixed array data file, do you have seconds, hour, day, year in the data array?
From the help
S is the element number that contains seconds; H is the element number that contains hours/minutes; D is the element number that contains day; and Y is the element number that contains the year. A constant can be used in place of any of the element numbers (the constant must be a valid value for the type of date field; e.g., 2000.0 for the year). If only three elements are specified, these will be assumed to be hour/minute, day, and year.
When using the Date function for a table-based datalogger (e.g., a timestamp in the format "2002-02-03 21:16:00"), if the timestamp is the first element in the array, a 1 is used for all of the timestamp elements (S; H; D; Y).
Dana
I got it figured out finally. Thanks for the help