Commit 54642d74 authored by Ben Anderson's avatar Ben Anderson
Browse files

fixed starttime & haflhour miscoding

parent 64a39e65
......@@ -84,6 +84,20 @@ reshape long pact sact lact, i(serial)
rename _j t_slot
* t_slot now has values 1 -> 144 (10 minute slots)
* change to 0 -> 143 to make time & date easier
replace t_slot = t_slot - 1
* which hour is it?
gen t_hourfromslot = floor(t_slot/6)
replace t_hourfromslot = 0 if t_hourfromslot == 24
* diary starts at 04:00
* NB this puts > 00:00 to the start of the diary day - remember this if doing sequences through 04:00
* also some charts will show discontinuities at 04:00
gen t_hour = t_hourfromslot + 4
* fix the t_hour > 24 problem
replace t_hour = t_hour - 24 if t_hour > 23
* calculate minute from slot (end of slot)
gen min = mod(t_slot,6)
......@@ -94,15 +108,6 @@ replace t_min = 30 if min == 3
replace t_min = 40 if min == 4
replace t_min = 50 if min == 5
* which hour is it?
gen t_hour = ceil(t_slot/6)
* diary starts at 04:00
* NB this puts > 00:00 to the start of the diary day - remember this if doing sequences through 04:00
* also some charts will show discontinuities at 04:00
replace t_hour = t_hour + 3
* fix the 'following hour' problem
replace t_hour = t_hour + 1 if t_min == 0
* fix dates
* Feb: we are going to assume this was the first full week of feb where Monday was the 7th
gen t_day = ba_dow + 6 if month == 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment