![:scale 55%](/assets/images/20201027/20201027_daylight_saving_time.png) --- class: left, middle ## Intermezzo. UTC, time zones & Daylight Saving Time - Where is Daylight Saving Time used? ![:scale 90%](/assets/images/20201027/20201027_map_daylight_saving_time.png) --- class: left, middle ## Intermezzo. UTC, time zones & Daylight Saving Time - How to define time zones? Typically `"Continent/City"` works well: ```r as_datetime("2020-08-01 09:00:00", tz = "Asia/Tehran") [1] "2020-08-01 09:00:00 +0430" as_datetime("2020-08-01 09:00:00", tz = "Europe/Brussels") [1] "2020-08-01 09:00:00 CEST" ``` or a time zone abbreviation: ```r as_datetime("2020-08-01 09:00:00", tz = "CET") [1] "2020-08-01 09:00:00 CEST" ``` Note the authomatic conversion to CEST (Central Europe *Summer* Time). However, if you use CEST it will not work, and you get the GMT version: ```r as_datetime("2020-08-01 09:00:00", tz = "CEST") [1] "2020-08-01 07:00:00 GMT" Warning message: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'CEST' ``` CEST is ** NOT ** a time zone! --- background-image: url(/assets/images/background_challenge_2.png) class: left, middle # Challenge 2 We need to get a better insight of the behavior of the mammals of the [Red Forest](https://en.wikipedia.org/wiki/Red_Forest) in Ukraine, one of the most contaminated areas in the world today. To do so, brave Emma, Jim and Sander (FIS team) went there in 2018 and installed a camera trap deployment. The data are stored in `20201027_cameratrap_df.txt`, which you have just downloaded. 1. The datetime of the observations are stored in column `image_sequence` and are in UTC. Get correspondent clock times. 2. Contrary to `image_sequence_datetime`, the datetimes in `camera_deployment_start` and `camera_deployment_end` are already in clock time. Add the timezone information to these columns. --- background-image: url(/assets/images/background_challenge_3.png) class: left, middle # Challenge 3 Use the same data as for Challenge 2. 1. Get hour and day information of the observations. You can store them as additional columns 2. For each observation find whether it happened during "dawn" (between `dawn` and `sunriseEnd`), "day" (between `sunriseEnd` and `sunset`), "evening" (between `sunset` and `nightStart`) or "night" (from midnight to `dawn` or after `night`). You can do it by using the function `getSunlightTimes()` from the [suncalc](https://github.com/datastorm-open/suncalc#suncalc) package.* * __Note__: this challenge could require basic knowledge of data manipulation (e.g. `dplyr` package) --- class: left, middle # The future of UTC: to leap or not to leap? UTC is based on time as measured by atomic clocks so it is independent of Earth's rotation. The [leap second](https://en.wikipedia.org/wiki/Leap_second) is a one-second adjustment that is occasionally applied to Coordinated Universal Time (UTC), to accommodate the imprecise observed solar time (irregularities and slowdown in the Earth's rotation). ![:scale 75%](/assets/images/20201027/20201027_leapsecond2016.png) So, what to do with these annoying leap seconds? Should the standard UTC be getting rid of them or not? --- class: left, middle ## Resources - `lubridate` website: https://lubridate.tidyverse.org/ - Summary of all formats recognized by lubridate: https://lubridate.tidyverse.org/reference/parse_date_time.html#details - Commented [solutions](https://github.com/inbo/coding-club/blob/master/src/20201027/20201027_challenges_solutions.R) of the challenges - Video recording of the coding club session: https://vimeo.com/473564881 - R for Data Science. [Chapter 16: Dates and times](https://r4ds.had.co.nz/dates-and-times.html) - One useful internet site about time measurement and time zones: https://24timezones.com/ - Definition of UTC standard: https://24timezones.com/time-zone/utc - Difference between GMT vs UTC: https://24timezones.com/gmt-vs-utc - EU and the end of daylight saving time: https://www.timetemperature.com/europe/eu-ends-summer-time.shtml - World time zone map: https://24timezones.com/timezone-map --- class: center, middle ![:scale 30%](/assets/images/coding_club_logo_1.png) Room: 01.72 (Kaat Tilley)?? & online Date: __24/11/2020__, van 10:00 tot 12:00 Subject: ggplot for dummies (registration announced via DG_useR@inbo.be)