-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDEFINITIONS.R
executable file
·106 lines (81 loc) · 2.52 KB
/
DEFINITIONS.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#'
#' Variables for the Training and location analysis project
#'
## Main Data Base ------------------------------------------------------------
DATASET <- "~/DATA/Other/Activities_records"
DBcodec <- "brotli"
DBlevel <- 5
DB_fl <- "~/DATA/Other/Activities_records.duckdb"
## Input paths ---------------------------------------------------------------
## no slash at end of path !!
## read this first, containing current active data
IMP_DIR <- "~/TRAIN/GoldenCheetah/Athan/imports"
## read this and remove duplicate training activities
FIT_DIR <- "~/TRAIN/Garmin_Exports/original"
## sync this with download script
GAR_RETAIN <- 300
## this should also contain all activities form IMP_DIR
GC_DIR <- "~/TRAIN/GoldenCheetah/Athan/activities"
## more data of location and activities
GPX_DIR <- "~/GISdata/GPX"
## GarminDB root dir
GDB_DIR <- "~/TRAIN/Volumes/HealthData/"
## Other variables -----------------------------------------------------------
## Datums used for locations
EPSG_WGS84 <- 4326 ## Usual gps datum
EPSG_PMERC <- 3857 ## Pseudo-Mercator, Spherical Mercator, Google Maps, OpenStreetMap
## A list of files to remove from DB
REMOVEFL <- "~/CODE/training_location_analysis/runtime/dropfiles.csv"
## expected fields in GoldenCheeatah files
expect <- c("STARTTIME",
"RECINTSECS",
"DEVICETYPE",
"OVERRIDES",
"IDENTIFIER",
"TAGS",
"INTERVALS",
"SAMPLES",
"XDATA")
## Active elements -----------------------------------------------------------
library(arrow, quietly = TRUE, warn.conflicts = FALSE)
opendata <- function() {
cat("\n ~ LOADING DATABASE ~ \n\n")
open_dataset(DATASET,
partitioning = c("year"),
hive_style = FALSE,
unify_schemas = TRUE)
}
FAILED_fl <- "~/CODE/training_location_analysis/runtime/Failed_to_parse.csv"
## Temporal aggregation
rsltemp <- 300 ## in seconds, it is computed to minutes for lubridate
## points inside the square counts once every 300 secs
fl_gis_data <- "~/DATA/GIS/GRID_POINTS/Grid_static.gpkg"
fl_gis_data_time <- "~/DATA/GIS/GRID_POINTS/Grid_temporal.gpkg"
## get time resolution from speed and spatial resolution
SPEED_RES_kmh <- 3
## Spatial aggregation static
rsls <- unique(c(
5,
15,
50,
100,
500,
1000,
2000,
5000,
10000,
20000,
50000
))
## Spatial aggregation temporal
rsls_T <- unique(c(
25,
50,
100,
500,
1000,
2000,
5000,
10000,
20000
))