Converts a calendar saved by an earlier version of the package. Four things are converted; a calendar that needs none is returned as is.
Arguments
- calendar
A
Calendar, in the current or an earlier form.
Value
A Calendar in the current form.
Details
The earlier layout. Such a calendar stores bare labels in its timeframe columns (
h00) and identifies its rows by a separatetimeslicecolumn. The result holds the members of each timeframe in its column (m01_h00), with the finest timeframe as the leaf column. The leaf ids are the formertimeslicevalues, row for row.The timeframes
DAYHOURandHOURTYPE. The hours of an average day were held asDAYHOURfor a time, and the hour-type blocks ofhp3asHOURTYPE; both areHOUR, in the leaftable, the members, the tokens and the other per-timeframe metadata. Member names stay as they are. A calendar of hour-type blocks stored in an earlier form keeps the hours its blocks had then (DAYh06-h16 and h21,NIGHTh22-h05,PEAKh17-h20: 12, 8 and 4 hours) and their order; the assignment is recorded inmeta$hour_blocks, and datetimes are matched by it. Only a freshly built design has the present blocks.Share, width and weight. A leaftable without the column
totalis in the earlier arrangement, wheresharewas the part of the year a timeslice stands for andweightthat part in hours. The part of the year is kept and stated asshare(one unit),widthandweight(seeCalendar): an hour of an average day becomes one hour with the days it stands for as its weight, a block ofhp3one hour times its hours per day times its days, and any other timeslice its own unit. A timeslice stored with weight 0 keeps it. A storedwidthis not read: its meaning changed between versions. The units used are recorded inmeta$units, and the coverage of a subset is re-keyed tototal.The coverage class.
representativeisaveraged.
The time every timeslice stands for and the rest of the metadata are
unchanged. A stored subset that carries no record of its source (see
calendar_source()) is left without one; the record it has is carried
over.
The functions of the package apply the same conversion to their calendar
argument, so an old object keeps working without an explicit call;
upgrade_calendar() is for converting a stored object once and saving
it again.
Where the old timeslice values are not the _-joined labels of the
row, the labels of the finest timeframe cannot be read off the new
member names; they are kept in meta$member_labels.
See also
calendar_from_leaftable(), which accepts a table of bare
labels.
