inbo / etn

R package to access data from the European Tracking Network
https://inbo.github.io/etn/
MIT License
6 stars 5 forks source link

Use `{units}` package in functions that return values with units #299

Open PietrH opened 1 month ago

PietrH commented 1 month ago
          There are 243 possible entries for `log_data`:
id_pk metadata_type col_index col_name
1 DIAG 0 Device Time (UTC)
2 DIAG 1 Time
3 DIAG 2 Time Offset (h)
4 DIAG 3 Time Correction (s)
5 DIAG 6 Ambient Temperature (deg C)
6 DIAG 7 Noise Mean (mV)
7 DIAG 8 Tilt (deg)
8 DIAG 9 Depth (m)
9 DIAG 10 PPM Pings
10 DIAG 11 PPM Detections
12 ATTITUDE 0 Device Time (UTC)
13 ATTITUDE 1 Time
14 ATTITUDE 2 Time Offset (h)
15 ATTITUDE 3 Time Correction (s)
16 ATTITUDE 4 Model
17 ATTITUDE 5 Serial Number
18 ATTITUDE 6 Tilt (deg)
19 BATTERY 0 Device Time (UTC)
20 BATTERY 1 Time
21 BATTERY 2 Time Offset (h)
22 BATTERY 3 Time Correction (s)
23 BATTERY 4 Model
24 BATTERY 5 Serial Number
25 BATTERY 6 Battery Position
26 BATTERY 7 Battery Type
27 BATTERY 8 Battery Serial Number
28 BATTERY 9 Battery Voltage (V)
29 BATTERY 10 Battery Remaining (%)
30 CFG_CHANNEL 0 Device Time (UTC)
31 CFG_CHANNEL 1 Time
32 CFG_CHANNEL 2 Time Offset (h)
33 CFG_CHANNEL 3 Time Correction (s)
34 CFG_CHANNEL 4 Model
35 CFG_CHANNEL 5 Serial Number
36 CFG_CHANNEL 6 Index
37 CFG_CHANNEL 7 Frequency (kHz)
38 CFG_CHANNEL 8 Decoder
39 CFG_CHANNEL 9 PPM Map ID
40 CFG_CHANNEL 10 HR Coding ID
41 CFG_STATION 0 Device Time (UTC)
42 CFG_STATION 1 Time
43 CFG_STATION 2 Time Offset (h)
44 CFG_STATION 3 Time Correction (s)
45 CFG_STATION 4 Model
46 CFG_STATION 5 Serial Number
47 CFG_STATION 6 Station Name
48 CFG_STATION 7 Latitude (deg)
49 CFG_STATION 8 Longitude (deg)
50 CFG_STUDY 0 Device Time (UTC)
51 CFG_STUDY 1 Time
52 CFG_STUDY 2 Time Offset (h)
53 CFG_STUDY 3 Time Correction (s)
54 CFG_STUDY 4 Model
55 CFG_STUDY 5 Serial Number
56 CFG_STUDY 6 Description
57 CFG_TRANSMITTER 0 Device Time (UTC)
58 CFG_TRANSMITTER 1 Time
59 CFG_TRANSMITTER 2 Time Offset (h)
60 CFG_TRANSMITTER 3 Time Correction (s)
61 CFG_TRANSMITTER 4 Model
62 CFG_TRANSMITTER 5 Serial Number
63 CFG_TRANSMITTER 6 Transmission Type
64 CFG_TRANSMITTER 7 Full ID
65 CFG_TRANSMITTER 8 ID
66 CFG_TRANSMITTER 9 Power Level
67 CFG_TRANSMITTER 10 Min Delay (s)
68 CFG_TRANSMITTER 11 Max Delay (s)
69 CLOCK_REF 0 Device Time (UTC)
70 CLOCK_REF 1 Time
71 CLOCK_REF 2 Time Offset (h)
72 CLOCK_REF 3 Time Correction (s)
73 CLOCK_REF 4 Model
74 CLOCK_REF 5 Serial Number
75 CLOCK_REF 6 External Time (UTC)
76 CLOCK_REF 7 External Difference (s)
77 CLOCK_REF 8 Source
78 CLOCK_SET 0 Device Time (UTC)
79 CLOCK_SET 1 Time
80 CLOCK_SET 2 Time Offset (h)
81 CLOCK_SET 3 Time Correction (s)
82 CLOCK_SET 4 Model
83 CLOCK_SET 5 Serial Number
84 CLOCK_SET 6 Prior Device Time (UTC)
85 CLOCK_SET 7 Prior Difference (s)
86 CLOCK_SET 8 Source
87 DATA_ERROR 0 Type
88 DATA_ERROR 1 Error
89 DATA_ERROR 2 Page
90 DATA_ERROR 3 Offset
91 DATA_ERROR 4 Description
92 DATA_SOURCE_FILE 0 File Name
93 DATA_SOURCE_FILE 1 UUID
94 DATA_SOURCE_FILE 2 Type
95 DATA_SOURCE_FILE 3 Size
96 DATA_SOURCE_FILE 4 State
97 DEPTH 0 Device Time (UTC)
98 DEPTH 1 Time
99 DEPTH 2 Time Offset (h)
100 DEPTH 3 Time Correction (s)
101 DEPTH 4 Model
102 DEPTH 5 Serial Number
103 DEPTH 6 Depth (m)
104 DEPTH_STATS 0 Device Time (UTC)
105 DEPTH_STATS 1 Time
106 DEPTH_STATS 2 Time Offset (h)
107 DEPTH_STATS 3 Time Correction (s)
108 DEPTH_STATS 4 Model
109 DEPTH_STATS 5 Serial Number
110 DEPTH_STATS 6 Depth Min (m)
111 DEPTH_STATS 7 Depth Max (m)
112 DEPTH_STATS 8 Depth Mean (m)
113 DEPTH_STATS 9 Sample Count
114 DEPTH_STATS 10 Accumulation Period (s)
115 DET 0 Device Time (UTC)
116 DET 1 Time
117 DET 2 Time Offset (h)
118 DET 3 Time Correction (s)
119 DET 4 Model
120 DET 5 Serial Number
121 DET 6 Detection Type
122 DET 7 Full ID
123 DET 8 ID
124 DET 9 Signal Strength (dB)
125 DET 10 Noise (dB)
126 DET 11 Quality Score
127 DET 12 Decoder
128 DET 13 Sensor Value
129 DET 14 Sensor Unit
130 DET_FILTER 0 Filter Name
131 DET_FILTER 1 Details
132 DET_FILTER 2 Rejected Detections
133 DIAG_FAST 0 Device Time (UTC)
134 DIAG_FAST 1 Time
135 DIAG_FAST 2 Time Offset (h)
136 DIAG_FAST 3 Time Correction (s)
137 DIAG_FAST 4 Model
138 DIAG_FAST 5 Serial Number
139 DIAG_FAST 6 Ambient Temperature (deg C)
140 DIAG_FAST 7 Noise (mV)
141 DIAG_FAST 8 Tilt (deg)
142 DIAG_FAST 9 Depth (m)
143 EVENT 0 Device Time (UTC)
144 EVENT 1 Time
145 EVENT 2 Time Offset (h)
146 EVENT 3 Time Correction (s)
147 EVENT 4 Model
148 EVENT 5 Serial Number
149 EVENT 6 Event Type
150 EVENT 7 Event Details
151 EVENT_FAULT 0 Device Time (UTC)
152 EVENT_FAULT 1 Time
153 EVENT_FAULT 2 Time Offset (h)
154 EVENT_FAULT 3 Time Correction (s)
155 EVENT_FAULT 4 Model
156 EVENT_FAULT 5 Serial Number
157 EVENT_FAULT 6 Fault Importance
158 EVENT_FAULT 7 Fault Code
159 EVENT_FAULT 8 Fault Description
160 EVENT_INIT 0 Device Time (UTC)
161 EVENT_INIT 1 Time
162 EVENT_INIT 2 Time Offset (h)
163 EVENT_INIT 3 Time Correction (s)
164 EVENT_INIT 4 Model
165 EVENT_INIT 5 Serial Number
166 EVENT_INIT 6 Prior Device Time (UTC)
167 EVENT_INIT 7 External Time Zone
168 EVENT_INIT 8 Firmware Version
169 EVENT_OFFLOAD 0 Device Time (UTC)
170 EVENT_OFFLOAD 1 Time
171 EVENT_OFFLOAD 2 Time Offset (h)
172 EVENT_OFFLOAD 3 Time Correction (s)
173 EVENT_OFFLOAD 4 Model
174 EVENT_OFFLOAD 5 Serial Number
175 EVENT_OFFLOAD 6 External Time (UTC)
176 EVENT_OFFLOAD 7 External Time Zone
177 EVENT_OFFLOAD 8 HR Total Accepted Detections
178 EVENT_OFFLOAD 9 PPM Total Accepted Detections
179 EVENT_OFFLOAD 10 Memory Remaining (%)
180 EVENT_OFFLOAD 11 Battery Remaining (%)
181 EVENT_OFFLOAD 12 Original File
182 HEALTH_VR2W 0 Device Time (UTC)
183 HEALTH_VR2W 1 Time
184 HEALTH_VR2W 2 Time Offset (h)
185 HEALTH_VR2W 3 Time Correction (s)
186 HEALTH_VR2W 4 Model
187 HEALTH_VR2W 5 Serial Number
188 HEALTH_VR2W 6 Memory Remaining (%)
189 HEALTH_VR2W 7 RTC Time
190 TEMP 0 Device Time (UTC)
191 TEMP 1 Time
192 TEMP 2 Time Offset (h)
193 TEMP 3 Time Correction (s)
194 TEMP 4 Model
195 TEMP 5 Serial Number
196 TEMP 6 Ambient (deg C)
197 TEMP 7 Internal (deg C)
198 TEMP_STATS 0 Device Time (UTC)
199 TEMP_STATS 1 Time
200 TEMP_STATS 2 Time Offset (h)
201 TEMP_STATS 3 Time Correction (s)
202 TEMP_STATS 4 Model
203 TEMP_STATS 5 Serial Number
204 TEMP_STATS 6 Ambient Min (deg C)
205 TEMP_STATS 7 Ambient Max (deg C)
206 TEMP_STATS 8 Ambient Mean (deg C)
207 TEMP_STATS 9 Sample Count
208 TEMP_STATS 10 Accumulation Period (s)
209 DIAG_VR2TX_INTERIM 0 Device Time (UTC)
210 DIAG_VR2TX_INTERIM 1 Time
211 DIAG_VR2TX_INTERIM 2 Time Offset (h)
212 DIAG_VR2TX_INTERIM 3 Time Correction (s)
213 DIAG_VR2TX_INTERIM 4 Model
214 DIAG_VR2TX_INTERIM 5 Pings
215 DIAG_VR2TX_INTERIM 6 Detections
217 DIAG_VR2AR_INTERIM 6 Detections
218 DIAG_VR2AR_INTERIM 5 Pings
219 DIAG_VR2AR_INTERIM 4 Model
220 DIAG_VR2AR_INTERIM 3 Time Correction (s)
221 DIAG_VR2AR_INTERIM 2 Time Offset (h)
222 DIAG_VR2AR_INTERIM 1 Time
223 DIAG_VR2AR_INTERIM 0 Device Time (UTC)
224 DIAG_VR2AR 8 Noise (mV)
225 DIAG_VR2AR 7 Detections
226 DIAG_VR2AR 6 Pings
227 DIAG_VR2AR 5 Serial Number
228 DIAG_VR2AR 4 Model
229 DIAG_VR2AR 3 Time Correction (s)
230 DIAG_VR2AR 2 Time Offset (h)
231 DIAG_VR2AR 1 Time
232 DIAG_VR2AR 0 Device Time (UTC)
233 DIAG_VR2AR 9 Tilt (deg)
234 HEALTH_VR2AR 6 Memory Remaining (%)
235 HEALTH_VR2AR 5 Serial Number
236 HEALTH_VR2AR 4 Model
237 HEALTH_VR2AR 3 Time Correction (s)
238 HEALTH_VR2AR 2 Time Offset (h)
239 HEALTH_VR2AR 1 Time
240 HEALTH_VR2AR 0 Device Time (UTC)
241 HEALTH_VR2TX 6 Memory Remaining (%)
242 HEALTH_VR2TX 5 Serial Number
243 HEALTH_VR2TX 7 RTC Time

Of which 79 are unique.

Peter suggested using the units package: https://r-quantities.github.io/units/ to encode units, and like move2, we could store the unit per column in a constants object: https://gitlab.com/bartk/move2/-/blob/main/R/movebank_constants.R#L87

Originally posted by @PietrH in https://github.com/inbo/etn/issues/254#issuecomment-2338275562

PietrH commented 1 month ago

Will be handy for measurement of fact extension on dwc output, if that comes to be