forked from CenticMurcia/curso-ciencia-datos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
227 lines (227 loc) · 8.6 KB
/
.Rhistory
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
10²
20^2
10^2
log(120)
log(100)
log10(120)
10^3
1000/60
15*60
log10(900)
10^4
10000(3600)
10^4 / 3600
10^5 / 3600
install.packages("sf")
install.packages("mapview")
devtools::install_github("16EAGLE/getSpatialData")
library(getSpatialData)
library(getSpatialData)
library(raster)
library(sf)
library(sp)
## Define an AOI (either matrix, sf or sp object)
data("aoi_data") # example aoi
aoi <- aoi_data[[3]] # AOI as matrix object, or better:
aoi <- aoi_data[[2]] # AOI as sp object, or:
aoi <- aoi_data[[1]] # AOI as sf object
## set AOI for this session
set_aoi(aoi)
view_aoi() #view AOI in viewer, which will look like this:
#instead of using an existing AOI, you can simply draw one:
set_aoi() #call set_aoi() without argument, which opens a mapedit editor:
view_aoi()
## set login credentials and archive directory
login_CopHub(username = "jmbolarin") #asks you for password
## Use getSentinel_query to search for data (using the session AOI)
records <- getSentinel_query(time_range = c("2017-08-01", "2017-08-30"),
platform = "Sentinel-2") #or "Sentinel-1" or "Sentinel-3"
## Filter the records
colnames(records) #see all available filter attributes
unique(records$processinglevel) #use one of the, e.g. to see available processing levels
records_filtered <- records[which(records$processinglevel == "Level-1C"),] #filter by Level
records_filtered <- records_filtered[as.numeric(records_filtered$cloudcoverpercentage) <= 30, ] #filter by clouds
## View records table
View(records)
View(records_filtered)
## Preview a single record on a mapview map with session AOI
getSentinel_preview(record = records_filtered[9,])
## Preview a single record on a mapview map with session AOI
getSentinel_preview(record = records_filtered[8,])
## Preview a single record on a mapview map with session AOI
getSentinel_preview(record = records_filtered[1,])
## Preview a single record on a mapview map with session AOI
getSentinel_preview(record = records_filtered[2,])
## Preview a single record on a mapview map with session AOI
getSentinel_preview(record = records_filtered[3,])
## Preview a single record on a mapview map without session AOI
getSentinel_preview(record = records_filtered[3,], show_aoi = FALSE)
## Preview a single record as RGB plot
getSentinel_preview(record = records_filtered[3,], on_map = FALSE)
## Finally, define an output format and make them ready-to-use
datasets_prep <- prepSentinel(datasets, format = "tiff")
## Download some datasets to your archive directory
datasets <- getSentinel_data(records = records_filtered[c(3,4,5), ])
## Download some datasets to your archive directory
datasets <- getSentinel_data(records = records_filtered[c(3,4,5), ])
dir_out
dir_out = "/home/centic/Data/24 - Sentinel GIS/GetSpatialData/Data"
## Download some datasets to your archive directory
datasets <- getSentinel_data(records = records_filtered[c(3,4,5), ])
## Download some datasets to your archive directory
datasets <- getSentinel_data(records = records_filtered[c(3,4), ])
## Download some datasets to your archive directory
datasets <- getSentinel_data(records = records_filtered[c(3), ])
## Download some datasets to your archive directory
datasets <- getSentinel_data(records = records_filtered[c(3,4,5), dir_out])
## We could re-generate the dataset by the following R code
seed <- as.double(1)
RANDU <- function() {
seed <<- ((2^16 + 3) * seed) %% (2^31)
seed/(2^31)
}
for(i in 1:400) {
U <- c(RANDU(), RANDU(), RANDU(), RANDU(), RANDU())
print(round(U[1:3], 6))
}
shiny::runApp('Descargas/Cavas/Apps/EMKLAS')
#################################################################################
cat("\014")
rm(list = ls())
setwd(paste('/home/centic/Data/curso-ciencia-datos/09. Process Mining', sep=''))
library(bupaR)
eventlog <- patients
sample <- eventlog %>%
arrange(patient, time, handling)
sample %>% head(n = 50) %>% print.data.frame()
write.csv(sample, file='eventlog.txt')
summary(eventlog)
activities(eventlog)
cases(eventlog)
resources(eventlog)
traces(eventlog)
mapping(eventlog)
activity_id(eventlog)
activity_instance_id(eventlog)
case_id(eventlog)
lifecycle_id(eventlog)
resource_id(eventlog)
timestamp(eventlog)
n_activities(eventlog)
n_activity_instances(eventlog)
n_cases(eventlog)
n_events(eventlog)
n_resources(eventlog)
n_traces(eventlog)
eventlog %>% activity_frequency(level = 'activity') %>% plot()
eventlog %>% trace_length(level = 'trace') %>% plot()
eventlog %>% group_by_case() %>% trace_explorer(cov = 1, type = 'frequent')
eventlog %>% dotted_chart(x='absolute', sort='start', color='handling')
eventlog %>% dotted_chart(x='relative', sort='duration', units='days',
color='handling')
eventlog %>% dotted_chart(x='absolute', sort='start', color='employee')
eventlog %>% dotted_chart(x='relative', sort='duration', units='days',
color='employee')
eventlog %>% process_map(type=frequency('absolute'))
eventlog %>% process_map(type=frequency('relative'))
eventlog %>% process_map(performance(mean, 'hours'))
eventlog %>% processing_time('activity') %>% plot
eventlog %>% throughput_time('log') %>% plot
eventlog %>% resource_involvement('resource') %>% plot
eventlog %>% precedence_matrix(type = 'absolute') %>% plot
eventlog %>% precedence_matrix(type = 'relative') %>% plot
eventlog %>% resource_map()
#################################################################################
cat("\014")
rm(list = ls())
setwd(paste('/home/centic/Data/curso-ciencia-datos/09. Process Mining', sep=''))
setwd(paste('/home/centic/Data/curso-ciencia-datos/10. Process Mining', sep=''))
library(bupaR)
eventlog <- patients
sample <- eventlog %>%
arrange(patient, time, handling)
sample %>% head(n = 50) %>% print.data.frame()
write.csv(sample, file='eventlog.txt')
summary(eventlog)
activities(eventlog)
cases(eventlog)
resources(eventlog)
traces(eventlog)
mapping(eventlog)
activity_id(eventlog)
activity_instance_id(eventlog)
case_id(eventlog)
lifecycle_id(eventlog)
resource_id(eventlog)
timestamp(eventlog)
n_activities(eventlog)
n_activity_instances(eventlog)
n_cases(eventlog)
n_events(eventlog)
n_resources(eventlog)
n_traces(eventlog)
eventlog %>% activity_frequency(level = 'activity') %>% plot()
eventlog %>% trace_length(level = 'trace') %>% plot()
eventlog %>% group_by_case() %>% trace_explorer(cov = 1, type = 'frequent')
eventlog %>% dotted_chart(x='absolute', sort='start', color='handling')
eventlog %>% dotted_chart(x='relative', sort='duration', units='days',
color='handling')
eventlog %>% dotted_chart(x='absolute', sort='start', color='employee')
eventlog %>% dotted_chart(x='relative', sort='duration', units='days',
color='employee')
eventlog %>% process_map(type=frequency('absolute'))
eventlog %>% process_map(type=frequency('relative'))
eventlog %>% process_map(performance(mean, 'hours'))
eventlog %>% processing_time('activity') %>% plot
eventlog %>% throughput_time('log') %>% plot
eventlog %>% resource_involvement('resource') %>% plot
eventlog %>% precedence_matrix(type = 'absolute') %>% plot
eventlog %>% precedence_matrix(type = 'relative') %>% plot
eventlog %>% resource_map()
source('~/Data/curso-ciencia-datos/10. Process Mining/10.2 Process Mining con BupaR.R', echo=TRUE)
eventlog %>% idotted_chart()
source('~/Data/curso-ciencia-datos/10. Process Mining/10.2 Process Mining con BupaR.R', echo=TRUE)
View(eventlog)
eventlog %>% sort(patient, time)
eventlog %>% arrange(patient, time)
ojete <- eventlog %>% arrange(patient, time)
View(ojete)
#################################################################################
cat("\014")
rm(list = ls())
library(bupaR)
eventlog <- patients
sample <- eventlog %>%
arrange(patient, time, handling)
sample %>% head(n = 50) %>% print.data.frame()
summary(eventlog)
activities(eventlog)
cases(eventlog)
resources(eventlog)
traces(eventlog)
mapping(eventlog)
activity_id(eventlog)
activity_instance_id(eventlog)
case_id(eventlog)
lifecycle_id(eventlog)
resource_id(eventlog)
timestamp(eventlog)
n_activities(eventlog)
n_activity_instances(eventlog)
n_cases(eventlog)
n_events(eventlog)
n_resources(eventlog)
n_traces(eventlog)
eventlog %>% activity_frequency(level = 'activity') %>% plot()
eventlog %>% trace_length(level = 'trace') %>% plot()
eventlog %>% group_by_case() %>% trace_explorer(cov = 1, type = 'frequent')
eventlog %>% dotted_chart(x='absolute', sort='start', color='handling')
eventlog %>% dotted_chart(x='relative', sort='duration', units='days',
color='handling')
eventlog %>% dotted_chart(x='absolute', sort='start', color='employee')
eventlog %>% dotted_chart(x='relative', sort='duration', units='days',
color='employee')
eventlog %>% process_map(type=frequency('absolute'))
eventlog %>% process_map(type=frequency('relative'))
eventlog %>% process_map(performance(mean, 'hours'))
source('~/Data/curso-ciencia-datos/10. Process Mining/10.2 Process Mining con BupaR.R', echo=TRUE)