Closed marosteg closed 10 months ago
Appears to be an issue in get_srss()
which add_daynight()
relies on to get sunrise/sunset times:
> srss[34,]
day latitude longitude tz n_locs DateTime sunrise sunset
34 2017-06-20 38.80659 -29.16954 Etc/GMT+2 1 2017-06-20 2017-06-19 06:31:29 2017-06-19 21:24:44
day_interval night_interval
34 2017-06-19 06:31:29 +00--2017-06-19 21:24:44 +00 2017-06-19 21:24:44 +00--2017-06-21 06:31:24 +00
The issue stems from an animal moving between time zones AND from our assumption that input times to get_srss
need to be converted to local time. Maybe they do BUT in the current iteration we are feeding in daily locations that are arbitrarily set at 00:00 UTC. When the animal moves out of the UTC time zone, east or west from the Azores in this case, the incoming time stamp is auto-transformed to UTC which pushes Jan 10 2000 00:00 (now assumed to be in GMT +1, for example) to Jan 9 2000 23:00 UTC.
I believe this is fixed with https://github.com/camrinbraun/tags2etuff/commit/737bee79e9fcb2451be4d636458d051039ed7ad5 with an error catch for erroneous date assignment.
No more NAs in the example data.
MWE for add_daynight failure to assign daytime only on certain days. The needed metadata file is attached and you'll have to change the setwd() lines. After running this whole block (this takes a long time given the archival resolution), you should have NaN results in the resulting dailymetrics object on days 34 and 56 only. This is because those two calendar days lack daytime assignments entirely.:
add_azoressharks_meta.csv