library(rgee)
ee_Initialize("tarredwall@gmail.com", drive = TRUE)
## -- rgee 1.0.9 --------------------------------------- earthengine-api 0.1.259 -- 
##  v email: tarredwall@gmail.com 
##  v Google Drive credentials:
 v Google Drive credentials:  FOUND
##  v Initializing Google Earth Engine:
 v Initializing Google Earth Engine:  DONE!
## 
 v Earth Engine user: users/tarredwall 
## --------------------------------------------------------------------------------

R

A partir del 15 de febrero de 2018, se debe utilizar la siguiente denominación:

Yo

I Región de Arica y Parinacota. Lunes 24 II Región de Tarapacá. Martes 25 III Región de Antofagasta. Miercoles 26 IV Región de Atacama. Jueves 27 V Región de Coquimbo. Viernes 28 VI Región de Valparaíso. Lunes 31

Victor

VII Región Metropolitana de Santiago. Lunes 24 VIII Región del Libertador General Bernardo O’Higgins. Martes 25 IX Región del Maule. Miercoles 26 X Región del Ñuble. Jueves 27 XI Región del Biobío. Viernes 28 XII Región de La Araucanía. Lunes 31

Abner

XIII Región de Los Ríos. Miercoles 26 XIV Región de Los Lagos. Jueves 27 XV Región de Aysén del General Carlos Ibáñez del Campo. Viernes 28 XVI Región de Magallanes y la Antártica Chilena. Lunes 31

1. Cargamos el shp de la primera region y lo filterboundiamos con la imagen satelital sentinel. Cargamos el shp de glaciares, y obtenemos las muestras interiores de los limites administrativos de color rojo que significaran glaciares que tendren numero 0. Obtenemos muestras para los colores verdes fuera de los limites administrativos. Unimos ambas muestras y categorizamos nuevamente la imagen satelital sentinel.

I Región de Tarapacá.

1 Lo primero es dibujar el shp de la Región de Tarapacá

region_tara <- st_read("rrss/Region_01.shp", 
        quiet = TRUE) %>% 
        sf_as_ee()
## Registered S3 method overwritten by 'geojsonsf':
##   method        from   
##   print.geojson geojson
tara <- region_tara$geometry()
Map$setCenter(lon = -69.7522, lat = -20.18, zoom = 7)
Map$addLayer(tara)

2 lo segundo es asociar una imagen satelital Sentinel filtrada por fecha, nubosidad y vinculada a la region de estudio. Y establecemos que el parametro sea la media.

start <- ee$Date("2019-01-01")
finish <- ee$Date("2019-04-01")
cc <- 20

sentinel1 = ee$ImageCollection('COPERNICUS/S2')$filterDate(start, finish)$filterBounds(tara)$
  filter(ee$Filter$lt("CLOUDY_PIXEL_PERCENTAGE", cc))

first <- sentinel1$median()

vizParams <- list(
  bands = c("B8","B5" , "B3"),
  #  bands = c("B2", "B3"),
  min = 100,
  max = 1000,
  gamma = 2
)
Map$setCenter(lon = -69.7522, lat = -20.18, zoom = 7)
Map$addLayer(first, vizParams, "Landsat 8 image")

3 Lo tercero es construir un raster con NDGI mayor a 0 siempre vinculada a la primera imagen satelital que hemos extraído.

Construimos una imagen raster con una columna llamada nd con dos categorías para cada pixel: 0 si es rojo, 1 si es verde

getNDGI <- function(image) 
{
     image$normalizedDifference(c("B4", "B3")) > 0
}

ndgi <- getNDGI(first)
## Warning: Ops.ee.image.Image will be deprecated in rgee v.1.1.0. Please install
## rgeeExtra (https://github.com/r-earthengine/rgeeExtra). Deeply sorry for the
## inconveniences.
ndgiParams <- list(palette = c(
  "#d73027", "#f46d43", "#fdae61",
  "#fee08b", "#d9ef8b", "#a6d96a",
  "#66bd63", "#1a9850"
))

Map$setCenter(lon = -69.7522, lat = -20.18, zoom = 7)
Map$addLayer(ndgi, ndgiParams, "NDGI")

4 obtenemos los shp que nos indican la presencia de glaciares en la Region de Tarapaca.

glaciar_tara <- st_read("GlaciaresxRegion/Simple_TARAPACA.shp",
        quiet = TRUE) %>%
        sf_as_ee()
glaciar_tara <- glaciar_tara$geometry()
Map$setCenter(lon = -69.7522, lat = -20.18, zoom = 7)
Map$addLayer(glaciar_tara, ndgiParams, "NDGI")

5 Intersectamos las regiones glaciares de la region de Tarapaca con nuestro ndvi, y de esta forma obtenemos un universo muestral del cual poder extraer nuestro primer set de muestras (pixeles rojos interiores).

ESTA ES LA IMAGEN SOBRE LA QUE EXTRAEREMOS EL PRIMER SET DE MUESTRAS

glaciares_adm_con_ngvi <- ndgi$clip(glaciar_tara)
Map$setCenter(lon = -69.7522, lat = -20.18, zoom = 7)
Map$addLayer(glaciares_adm_con_ngvi, ndgiParams, "NDGI")

Con esto concluimos la primera parte de nuestra generacion de raster para, como siguiente paso, extraer las muestras.

6 Hay que hacer una diferencia (se le resta al shp de la región de Tarapaca los shps de los glaciares) para intersectarla con nuestra imagen ngdi y obtener el segundo universo muestral.

6.1 Primero obtenemos nuestros shapes sin zonas administrativas glaciares:

tara_sin_glacia <- tara$difference(glaciar_tara, ee$ErrorMargin(1))
Map$setCenter(lon = -69.7522, lat = -20.18, zoom = 7)
Map$addLayer(tara_sin_glacia, ndgiParams, "NDGI")

6.2 Necesitamos intersectar nuestro ndvi con la zona de Tarapaca que excluye los glaciares.

ndvi_tarapaca_sin_glaciares <- ndgi$clip(tara_sin_glacia)
Map$setCenter(lon = -69.7522, lat = -20.18, zoom = 7)
Map$addLayer(ndvi_tarapaca_sin_glaciares, ndgiParams, "NDGI")

7 Ahora tenemos dos regiones preparadas sobre las cuales podemos extraer nuestras muestras. A efectos de orden nombrémoslas:

7.1. pixeles rojos interiores

7.2. pixeles verdes exteriores

7.1. pixeles rojos interiores

Necesitamos intersectar las regiones administrativas glaciares con nuestro raster ndvi y de ahi extraer las muestras de color rojo que simbolizarán los glaciares.

limites_glaciares_con_rasters <- ndgi$clip(glaciar_tara)
Map$setCenter(lon = -68.69644, lat = -19.7581, zoom = 15)
Map$addLayer(limites_glaciares_con_rasters , ndgiParams, "NDGI")

1 Muestreo

# region_arica <- st_read("Regiones_separadas/Region_15.shp", quiet = TRUE)
# region_arica

Los rojos interiores son glaciares, 0 = rojo y son llamados muestras_in_gee_rojas.

muestras_in <- ndgi$sampleRegions(
    collection = ee$Feature(glaciar_tara),
    scale = 100,
    tileScale = 16,
    geometries = TRUE
  )

muestras_in_gee_rojas = muestras_in$filter(ee$Filter$eq('nd', 0))

Map$setCenter(lon = -68.69644, lat = -19.7581, zoom = 15)
Map$addLayer(
  eeObject =  muestras_in_gee_rojas,
  visParams = {},
  name = "puntos glaciares"
)

7.2. Pixeles verdes exteriores

ndvi_tara_sin_glaciares <- ndgi$clip(tara_sin_glacia)
Map$setCenter(lon = -68.69644, lat = -19.7581, zoom = 8)
Map$addLayer(ndvi_tara_sin_glaciares, ndgiParams, "NDGI")

Los verdes exteriores no son glaciares 1 = verde

muestras_in <- ndgi$sampleRegions(
    collection = ee$Feature(ndvi_tara_sin_glaciares),
    scale = 10000,
    tileScale = 16,
    geometries = TRUE
  )

muestras_out_gee_verdes = muestras_in$filter(ee$Filter$eq('nd', 1))

Map$setCenter(lon = -69.80584, lat = -17.67837, zoom = 7)
Map$addLayer(
  eeObject =  muestras_out_gee_verdes,
  visParams = {},
  name = "puntos no glaciares"
)

III debemos unir muestras y generar el random forest

union_total <- muestras_out_gee_verdes$merge(muestras_in_gee_rojas)

3 Aplicamos Random Forest

(volver al índice)

region_arica <- st_read("rrss/Region_01.shp", 
        quiet = TRUE) %>% 
        sf_as_ee()
arica <- region_arica$geometry()

start <- ee$Date("2019-01-01")
finish <- ee$Date("2019-04-01")
cc <- 20

sentinel1 = ee$ImageCollection('COPERNICUS/S2')$filterDate(start, finish)$filterBounds(arica)$
  filter(ee$Filter$lt("CLOUDY_PIXEL_PERCENTAGE", cc))

first <- sentinel1$median()

# Use these bands for prediction.
bands <- c("B2", "B3", "B4", "B8")

# This property of the table stores the land cover labels.
label <- "nd"

# Overlay the points on the imagery to get training.
training <- first$select(bands)$sampleRegions(
  collection = union_total,
  properties = list(label),
  scale = 10
)

# Train a CART classifier with default parameters.
trained <- ee$Classifier$smileRandomForest(10)$train(training, label, bands)

# Classify the image with the same bands used for training.
classified_rf <- first$select(bands)$classify(trained)

# Viz parameters.
# viz_img <- list(bands = c("B4", "B3", "B2"), max = 0.4)
vizParams <- list(
  bands = c("B8","B5" , "B3"),
  #  bands = c("B2", "B3"),
  min = 100,
  max = 1000,
  gamma = 2
)

viz_class <- list(palette = c("red", "green", "blue"), min = 0, max = 2)

Map$addLayer(first, vizParams, name = "image") +
Map$addLayer(classified_rf, viz_class, name = "classification")

18:29 18:30

Le aplicamos la matriz de confusion:

trainAccuracy = trained$confusionMatrix()
trainAccuracy$getInfo()
## [[1]]
## [1] 11  1
## 
## [[2]]
## [1]   0 451

18:40 18:43

4 Aplicamos CART

(volver al índice)

region_tara <- st_read("rrss/Region_01.shp", 
        quiet = TRUE) %>% 
        sf_as_ee()
tara <- region_tara$geometry()

start <- ee$Date("2019-01-01")
finish <- ee$Date("2019-04-01")
cc <- 20

sentinel1 = ee$ImageCollection('COPERNICUS/S2')$filterDate(start, finish)$filterBounds(tara)$
  filter(ee$Filter$lt("CLOUDY_PIXEL_PERCENTAGE", cc))

first <- sentinel1$median()

# Use these bands for prediction.
bands <- c("B2", "B3", "B4", "B8")

# This property of the table stores the land cover labels.
label <- "nd"

# Overlay the points on the imagery to get training.
training <- first$select(bands)$sampleRegions(
  collection = union_total,
  properties = list(label),
  scale = 10
)

# Train a CART classifier with default parameters.
trained <- ee$Classifier$smileCart(10)$train(training, label, bands)

# Classify the image with the same bands used for training.
classified <- first$select(bands)$classify(trained)

# Viz parameters.
# viz_img <- list(bands = c("B4", "B3", "B2"), max = 0.4)
vizParams <- list(
  bands = c("B8","B5" , "B3"),
  #  bands = c("B2", "B3"),
  min = 100,
  max = 1000,
  gamma = 2
)

viz_class <- list(palette = c("red", "green", "blue"), min = 0, max = 2)

Map$addLayer(first, vizParams, name = "image") +
Map$addLayer(classified, viz_class, name = "classification")

18:47 18:50

trainAccuracy = trained$confusionMatrix()
trainAccuracy$getInfo()
## [[1]]
## [1] 12  0
## 
## [[2]]
## [1]   0 451

18:51 18 53

4 Aplicamos SVM

(volver al índice)

region_arica <- st_read("Regiones_separadas/Region_15.shp", 
        quiet = TRUE) %>% 
        sf_as_ee()
arica <- region_arica$geometry()

start <- ee$Date("2019-01-01")
finish <- ee$Date("2019-04-01")
cc <- 20

sentinel1 = ee$ImageCollection('COPERNICUS/S2')$filterDate(start, finish)$filterBounds(arica)$
  filter(ee$Filter$lt("CLOUDY_PIXEL_PERCENTAGE", cc))

first <- sentinel1$median()

# Use these bands for prediction.
bands <- c("B2", "B3", "B4", "B8")

# This property of the table stores the land cover labels.
label <- "nd"

# Overlay the points on the imagery to get training.
training <- first$select(bands)$sampleRegions(
  collection = union_total,
  properties = list(label),
  scale = 10
)
classifier = ee$Classifier$libsvm(
  kernelType = "RBF",
  gamma = 0.5,
  cost = 10
)
# Train a CART classifier with default parameters.
trained = classifier$train(training, label, bands)

# Classify the image with the same bands used for training.
classified <- first$select(bands)$classify(trained)

# Viz parameters.
# viz_img <- list(bands = c("B4", "B3", "B2"), max = 0.4)
vizParams <- list(
  bands = c("B8","B5" , "B3"),
  #  bands = c("B2", "B3"),
  min = 100,
  max = 1000,
  gamma = 2
)

viz_class <- list(palette = c("red", "green", "blue"), min = 0, max = 2)

Map$addLayer(first, vizParams, name = "image") +
Map$addLayer(classified, viz_class, name = "classification")

No se puede obtener la matriz de confusion para libsvm pues excede limites de memoria

trainAccuracy = trained$confusionMatrix()
trainAccuracy$getInfo()
## [[1]]
## [1] 1 0
## 
## [[2]]
## [1]   0 142

Analisis espacial

2. Una vez obtenido nuestro raster random forest interceptamos por limites glaciares, Y EN CADA UNO DE ELLOS determinamos la cantidad de pixeles rojos

mask_0 <- read_sf("GlaciaresxRegion/Simple_TARAPACA.shp")
#mask_0

reg_15_2 <- mask_0 %>% dplyr::select(COD_GLA,AREA_Km2)
varia <- reg_15_2 %>%
sf_as_ee()

region_0 <- varia$geometry()
sale_4 <- classified_rf$clip(region_0)

puntos_r <- sale_4$select('classification')$eq(0)


# Reducer$sum() returns a Reducer that computes the (weighted) sum of its inputs.

areas_rojas = puntos_r$reduceRegions(
reducer= ee$Reducer$sum(),
collection= varia,
scale= 30
)

rojas <- areas_rojas$getInfo()

rojas1 <- as.data.frame(rojas)
# rojas1


puntos_v <- sale_4$select('classification')$eq(1)

areas_verdes = puntos_v$reduceRegions(
reducer= ee$Reducer$sum(),
collection= varia,
scale= 30
)

verdes <- areas_verdes$getInfo()

verdes1 <- as.data.frame(verdes)
# verdes1



r_v <- rbind(colnames(rojas1),rojas1,verdes1)
r_v <- r_v[1:4,]
r_v <- r_v[-3,]
r_v <- t(r_v)
r_v <- as.data.frame(r_v)
names(r_v)[1] <- "col1"
names(r_v)[2] <- "col2"
names(r_v)[3] <- "col3"
r_v$col4 <- r_v$col3
r_v$col5 <- r_v$col3
# r_v


data1 <- filter(r_v, grepl("features.properties.COD_GLA",col1))
data1 <- as.data.frame(data1[,2])
# data1

data2 <- filter(r_v, grepl("features.properties.sum",col1))
data2 <- as.data.frame(data2[,c(2,3)])
# data2

data3 <- filter(r_v, grepl("features.properties.AREA_Km2",col1))
data3 <- as.data.frame(data3[,c(2,3)])
# data3

data4 <- cbind(data1,data2,data3)
colnames(data4) <- c("codigo_gla", "rojo", "verde", "area_Km2(shp)")
data4
##                             codigo_gla              rojo              verde
## features.properties.sum    CL101044025  49.2274509803922                  0
## features.properties.sum.1  CL101044018  10.2509803921569   102.247058823529
## features.properties.sum.2  CL101044017                 2   124.862745098039
## features.properties.sum.3  CL101044019                 0   97.7882352941177
## features.properties.sum.4  CL101044016  1.05098039215686   74.0392156862745
## features.properties.sum.5  CL101044015                 0   34.8666666666667
## features.properties.sum.6  CL101044014  1.02352941176471   29.9019607843137
## features.properties.sum.7  CL101044013                 0   40.1607843137255
## features.properties.sum.8  CL101044012                 0   13.8980392156863
## features.properties.sum.9  CL101044011                 0   265.913725490196
## features.properties.sum.10 CL101044010                 0   5.82352941176471
## features.properties.sum.11 CL101044007                 0   57.3803921568627
## features.properties.sum.12 CL101044008                 0   201.643137254902
## features.properties.sum.13 CL101044006                 0   221.235294117647
## features.properties.sum.14 CL101042002                 0   81.0078431372549
## features.properties.sum.15 CL101042001  2.75294117647059   77.1843137254902
## features.properties.sum.16 CL101042003                 0   63.2117647058824
## features.properties.sum.17 CL101042005  1.00392156862745    32.878431372549
## features.properties.sum.18 CL101042004                 0    20.121568627451
## features.properties.sum.19 CL101610012                 0   154.098039215686
## features.properties.sum.20 CL101610013                 0   110.176470588235
## features.properties.sum.21 CL101610011                 0   6.61960784313725
## features.properties.sum.22 CL101610010                 0   94.2666666666667
## features.properties.sum.23 CL101610009                 0   72.7764705882353
## features.properties.sum.24 CL101610008                 0   41.6274509803922
## features.properties.sum.25 CL101610005                 0   78.9098039215686
## features.properties.sum.26 CL101610004                 0   63.0549019607843
## features.properties.sum.27 CL101610002                 0   113.752941176471
## features.properties.sum.28 CL101610003                 0   97.6431372549019
## features.properties.sum.29 CL101610001                 0    114.43137254902
## features.properties.sum.30 CL101611002                 0   159.976470588235
## features.properties.sum.31 CL101720004                 0   30.7843137254902
## features.properties.sum.32 CL101720003                 0                129
## features.properties.sum.33 CL101720001                 0   9.56470588235294
## features.properties.sum.34 CL101720002                 0   73.6862745098039
## features.properties.sum.35 CL101720008                 0   188.541176470588
## features.properties.sum.36 CL101720005                 0   22.3333333333333
## features.properties.sum.37 CL101720006                 0   15.2666666666667
## features.properties.sum.38 CL101720009                 0   13.2156862745098
## features.properties.sum.39 CL101720007                 0   9.65490196078431
## features.properties.sum.40 CL101730001                 0   129.050980392157
## features.properties.sum.41 CL101730002                 0   35.5254901960784
## features.properties.sum.42 CL101730009                 0    21.278431372549
## features.properties.sum.43 CL101730008                 0   19.0705882352941
## features.properties.sum.44 CL101730011                 0   53.4156862745098
## features.properties.sum.45 CL101730012 0.203921568627451   72.8862745098039
## features.properties.sum.46 CL101730013                 0   63.9176470588235
## features.properties.sum.47 CL101730010                 0   7.74117647058823
## features.properties.sum.48 CL101730014                 0   144.137254901961
## features.properties.sum.49 CL101730016                 0   25.1607843137255
## features.properties.sum.50 CL101730017                 0   9.94901960784314
## features.properties.sum.51 CL101730015                 0   9.06666666666666
## features.properties.sum.52 CL101730018                 0   11.5607843137255
## features.properties.sum.53 CL101730004                 0   33.2745098039216
## features.properties.sum.54 CL101730003                 0   79.1529411764706
## features.properties.sum.55 CL101730006                 0   27.6901960784314
## features.properties.sum.56 CL101730007                 0   24.5843137254902
## features.properties.sum.57 CL101730005                 0   13.2509803921569
## features.properties.sum.58 CL101044001                 2   47.4078431372549
## features.properties.sum.59 CL101044002                 0   27.0235294117647
## features.properties.sum.60 CL101044003 0.156862745098039   97.0078431372549
## features.properties.sum.61 CL101044004                 0   31.4117647058824
## features.properties.sum.62 CL101044009                 0   13.6901960784314
## features.properties.sum.63 CL101044005  3.29411764705882   18.8235294117647
## features.properties.sum.64 CL101040008                 0   51.1137254901961
## features.properties.sum.65 CL101611001                 0   128.905882352941
## features.properties.sum.66 CL101610024                 0   53.6862745098039
## features.properties.sum.67 CL101610023                 0    256.78431372549
## features.properties.sum.68 CL101610022                 0   229.074509803922
## features.properties.sum.69 CL101610021                 0   180.870588235294
## features.properties.sum.70 CL101610020                 0   106.007843137255
## features.properties.sum.71 CL101610018                 0    145.83137254902
## features.properties.sum.72 CL101610017                 0   119.317647058824
## features.properties.sum.73 CL101610016                 0   63.3176470588235
## features.properties.sum.74 CL101040006                 0   53.2901960784314
## features.properties.sum.75 CL101040005                 0   55.3372549019608
## features.properties.sum.76 CL101040004   3.6078431372549   9.25882352941177
## features.properties.sum.77 CL101040003                 0   7.43529411764706
## features.properties.sum.78 CL101610015                 0   9.92156862745098
## features.properties.sum.79 CL101610014                 0   59.9921568627451
## features.properties.sum.80 CL101610019                 0   253.152941176471
## features.properties.sum.81 CL101040002                 0   50.8196078431372
## features.properties.sum.82 CL101040007  3.75686274509804   45.8470588235294
## features.properties.sum.83 CL101040001  23.7176470588235    24.756862745098
## features.properties.sum.84 CL101040009  45.1254901960784               54.4
## features.properties.sum.85 CL101044024  410.019607843137 0.0549019607843137
## features.properties.sum.86 CL101070001  18.7686274509804   10.3019607843137
## features.properties.sum.87 CL101044020  30.8039215686274                  0
## features.properties.sum.88 CL101044022  24.9058823529412                  0
## features.properties.sum.89 CL101044021  15.3411764705882                  0
## features.properties.sum.90 CL101044023   11.956862745098                  0
##                              area_Km2(shp)              NA
## features.properties.sum    0.0397270010711 0.0397270010711
## features.properties.sum.1   0.100876482862  0.100876482862
## features.properties.sum.2   0.109852809052  0.109852809052
## features.properties.sum.3  0.0873709651722 0.0873709651722
## features.properties.sum.4  0.0639482581884 0.0639482581884
## features.properties.sum.5  0.0390825631323 0.0390825631323
## features.properties.sum.6  0.0327605622869 0.0327605622869
## features.properties.sum.7  0.0382199791074 0.0382199791074
## features.properties.sum.8  0.0167628398049 0.0167628398049
## features.properties.sum.9   0.234736140147  0.234736140147
## features.properties.sum.10 0.0123072515574 0.0123072515574
## features.properties.sum.11 0.0490761861993 0.0490761861993
## features.properties.sum.12  0.181770894446  0.181770894446
## features.properties.sum.13  0.187241197168  0.187241197168
## features.properties.sum.14 0.0822324117868 0.0822324117868
## features.properties.sum.15 0.0811335051897 0.0811335051897
## features.properties.sum.16 0.0517317014976 0.0517317014976
## features.properties.sum.17 0.0342342838388 0.0342342838388
## features.properties.sum.18  0.025537434093  0.025537434093
## features.properties.sum.19   0.14556645363   0.14556645363
## features.properties.sum.20 0.0969989514597 0.0969989514597
## features.properties.sum.21 0.0133418051918 0.0133418051918
## features.properties.sum.22 0.0876500187874 0.0876500187874
## features.properties.sum.23 0.0722716222512 0.0722716222512
## features.properties.sum.24 0.0460606415757 0.0460606415757
## features.properties.sum.25 0.0863192881262 0.0863192881262
## features.properties.sum.26 0.0786716671606 0.0786716671606
## features.properties.sum.27 0.0996942476728 0.0996942476728
## features.properties.sum.28 0.0926249593749 0.0926249593749
## features.properties.sum.29  0.107310516435  0.107310516435
## features.properties.sum.30  0.125452215699  0.125452215699
## features.properties.sum.31 0.0370788979097 0.0370788979097
## features.properties.sum.32  0.121432954093  0.121432954093
## features.properties.sum.33 0.0156484103605 0.0156484103605
## features.properties.sum.34 0.0637414139919 0.0637414139919
## features.properties.sum.35  0.163304691787  0.163304691787
## features.properties.sum.36 0.0228456773695 0.0228456773695
## features.properties.sum.37 0.0161851633664 0.0161851633664
## features.properties.sum.38 0.0165129804368 0.0165129804368
## features.properties.sum.39 0.0198858464782 0.0198858464782
## features.properties.sum.40  0.121994691845  0.121994691845
## features.properties.sum.41 0.0391150993622 0.0391150993622
## features.properties.sum.42 0.0305984387632 0.0305984387632
## features.properties.sum.43 0.0225271588162 0.0225271588162
## features.properties.sum.44 0.0661863412709 0.0661863412709
## features.properties.sum.45 0.0641183674004 0.0641183674004
## features.properties.sum.46 0.0711972768362 0.0711972768362
## features.properties.sum.47 0.0127425943588 0.0127425943588
## features.properties.sum.48  0.130168840973  0.130168840973
## features.properties.sum.49 0.0425520003997 0.0425520003997
## features.properties.sum.50 0.0157886226892 0.0157886226892
## features.properties.sum.51 0.0155196563794 0.0155196563794
## features.properties.sum.52 0.0181153020415 0.0181153020415
## features.properties.sum.53 0.0346999506794 0.0346999506794
## features.properties.sum.54  0.071272988267  0.071272988267
## features.properties.sum.55 0.0311922006569 0.0311922006569
## features.properties.sum.56 0.0269613307305 0.0269613307305
## features.properties.sum.57 0.0182961256272 0.0182961256272
## features.properties.sum.58 0.0474476041426 0.0474476041426
## features.properties.sum.59  0.030925134966  0.030925134966
## features.properties.sum.60 0.0990839862833 0.0990839862833
## features.properties.sum.61 0.0316396276002 0.0316396276002
## features.properties.sum.62 0.0151640809662 0.0151640809662
## features.properties.sum.63 0.0261707721535 0.0261707721535
## features.properties.sum.64 0.0531454414338 0.0531454414338
## features.properties.sum.65  0.108143702435  0.108143702435
## features.properties.sum.66 0.0585930577914 0.0585930577914
## features.properties.sum.67  0.232784007153  0.232784007153
## features.properties.sum.68  0.189817275455  0.189817275455
## features.properties.sum.69  0.157189625326  0.157189625326
## features.properties.sum.70 0.0937245066846 0.0937245066846
## features.properties.sum.71  0.128313247654  0.128313247654
## features.properties.sum.72   0.11302848218   0.11302848218
## features.properties.sum.73 0.0630994631392 0.0630994631392
## features.properties.sum.74 0.0559590444049 0.0559590444049
## features.properties.sum.75 0.0578071886107 0.0578071886107
## features.properties.sum.76 0.0229483888793 0.0229483888793
## features.properties.sum.77 0.0126627103916 0.0126627103916
## features.properties.sum.78 0.0139952832236 0.0139952832236
## features.properties.sum.79 0.0548194450787 0.0548194450787
## features.properties.sum.80  0.224397707218  0.224397707218
## features.properties.sum.81 0.0476141336392 0.0476141336392
## features.properties.sum.82 0.0443321397721 0.0443321397721
## features.properties.sum.83 0.0490302735314 0.0490302735314
## features.properties.sum.84 0.0920502698629 0.0920502698629
## features.properties.sum.85  0.343230877798  0.343230877798
## features.properties.sum.86 0.0303463589963 0.0303463589963
## features.properties.sum.87 0.0304940656141 0.0304940656141
## features.properties.sum.88 0.0301132769341 0.0301132769341
## features.properties.sum.89 0.0145008622673 0.0145008622673
## features.properties.sum.90 0.0173113872952 0.0173113872952

Podemos obtener todos los glaciares de Chile y podemos obtener sus areas. A travaés de nuestros proceso de clasificación hemos podido determinar cantidades que debiesen ser glaciares en color rojo y cantidades que no son glaciares con valor de 1. Nuestro proceso de analisis nos llevo a la obtencion de estas cantidades cuyas magnitudes desconocemos. Pero lo anterior no es problema. Debemos seguir el siguiente procedimiento:

  1. Calcular el porcentaje de rojo que hay dentro de la relación rojo-verde

  2. Llamemos el porcentaje del punto 1 β.

  3. debemos calcular el porcentaje que β representa en el area_Km2(shp). de cada glaciar.

\[ {\%rojo \over x} = {(rojo +verde) \over 100 } \]

Lo que nos interesa es obtener la superficie glaciar dentro de cada glaciar.

\[ { \%superficie\_roja \over 100} = {\%rojo \over region\_glaciar }\]

data4$porcentaje_rojo <- (100*as.numeric(data4$rojo)) / (as.numeric(data4$rojo) + as.numeric(data4$verde))
data4$porcentaje_area_glaciar <- (data4$porcentaje_rojo * as.numeric(data4$`area_Km2(shp)`)) / 100
data4
##                             codigo_gla              rojo              verde
## features.properties.sum    CL101044025  49.2274509803922                  0
## features.properties.sum.1  CL101044018  10.2509803921569   102.247058823529
## features.properties.sum.2  CL101044017                 2   124.862745098039
## features.properties.sum.3  CL101044019                 0   97.7882352941177
## features.properties.sum.4  CL101044016  1.05098039215686   74.0392156862745
## features.properties.sum.5  CL101044015                 0   34.8666666666667
## features.properties.sum.6  CL101044014  1.02352941176471   29.9019607843137
## features.properties.sum.7  CL101044013                 0   40.1607843137255
## features.properties.sum.8  CL101044012                 0   13.8980392156863
## features.properties.sum.9  CL101044011                 0   265.913725490196
## features.properties.sum.10 CL101044010                 0   5.82352941176471
## features.properties.sum.11 CL101044007                 0   57.3803921568627
## features.properties.sum.12 CL101044008                 0   201.643137254902
## features.properties.sum.13 CL101044006                 0   221.235294117647
## features.properties.sum.14 CL101042002                 0   81.0078431372549
## features.properties.sum.15 CL101042001  2.75294117647059   77.1843137254902
## features.properties.sum.16 CL101042003                 0   63.2117647058824
## features.properties.sum.17 CL101042005  1.00392156862745    32.878431372549
## features.properties.sum.18 CL101042004                 0    20.121568627451
## features.properties.sum.19 CL101610012                 0   154.098039215686
## features.properties.sum.20 CL101610013                 0   110.176470588235
## features.properties.sum.21 CL101610011                 0   6.61960784313725
## features.properties.sum.22 CL101610010                 0   94.2666666666667
## features.properties.sum.23 CL101610009                 0   72.7764705882353
## features.properties.sum.24 CL101610008                 0   41.6274509803922
## features.properties.sum.25 CL101610005                 0   78.9098039215686
## features.properties.sum.26 CL101610004                 0   63.0549019607843
## features.properties.sum.27 CL101610002                 0   113.752941176471
## features.properties.sum.28 CL101610003                 0   97.6431372549019
## features.properties.sum.29 CL101610001                 0    114.43137254902
## features.properties.sum.30 CL101611002                 0   159.976470588235
## features.properties.sum.31 CL101720004                 0   30.7843137254902
## features.properties.sum.32 CL101720003                 0                129
## features.properties.sum.33 CL101720001                 0   9.56470588235294
## features.properties.sum.34 CL101720002                 0   73.6862745098039
## features.properties.sum.35 CL101720008                 0   188.541176470588
## features.properties.sum.36 CL101720005                 0   22.3333333333333
## features.properties.sum.37 CL101720006                 0   15.2666666666667
## features.properties.sum.38 CL101720009                 0   13.2156862745098
## features.properties.sum.39 CL101720007                 0   9.65490196078431
## features.properties.sum.40 CL101730001                 0   129.050980392157
## features.properties.sum.41 CL101730002                 0   35.5254901960784
## features.properties.sum.42 CL101730009                 0    21.278431372549
## features.properties.sum.43 CL101730008                 0   19.0705882352941
## features.properties.sum.44 CL101730011                 0   53.4156862745098
## features.properties.sum.45 CL101730012 0.203921568627451   72.8862745098039
## features.properties.sum.46 CL101730013                 0   63.9176470588235
## features.properties.sum.47 CL101730010                 0   7.74117647058823
## features.properties.sum.48 CL101730014                 0   144.137254901961
## features.properties.sum.49 CL101730016                 0   25.1607843137255
## features.properties.sum.50 CL101730017                 0   9.94901960784314
## features.properties.sum.51 CL101730015                 0   9.06666666666666
## features.properties.sum.52 CL101730018                 0   11.5607843137255
## features.properties.sum.53 CL101730004                 0   33.2745098039216
## features.properties.sum.54 CL101730003                 0   79.1529411764706
## features.properties.sum.55 CL101730006                 0   27.6901960784314
## features.properties.sum.56 CL101730007                 0   24.5843137254902
## features.properties.sum.57 CL101730005                 0   13.2509803921569
## features.properties.sum.58 CL101044001                 2   47.4078431372549
## features.properties.sum.59 CL101044002                 0   27.0235294117647
## features.properties.sum.60 CL101044003 0.156862745098039   97.0078431372549
## features.properties.sum.61 CL101044004                 0   31.4117647058824
## features.properties.sum.62 CL101044009                 0   13.6901960784314
## features.properties.sum.63 CL101044005  3.29411764705882   18.8235294117647
## features.properties.sum.64 CL101040008                 0   51.1137254901961
## features.properties.sum.65 CL101611001                 0   128.905882352941
## features.properties.sum.66 CL101610024                 0   53.6862745098039
## features.properties.sum.67 CL101610023                 0    256.78431372549
## features.properties.sum.68 CL101610022                 0   229.074509803922
## features.properties.sum.69 CL101610021                 0   180.870588235294
## features.properties.sum.70 CL101610020                 0   106.007843137255
## features.properties.sum.71 CL101610018                 0    145.83137254902
## features.properties.sum.72 CL101610017                 0   119.317647058824
## features.properties.sum.73 CL101610016                 0   63.3176470588235
## features.properties.sum.74 CL101040006                 0   53.2901960784314
## features.properties.sum.75 CL101040005                 0   55.3372549019608
## features.properties.sum.76 CL101040004   3.6078431372549   9.25882352941177
## features.properties.sum.77 CL101040003                 0   7.43529411764706
## features.properties.sum.78 CL101610015                 0   9.92156862745098
## features.properties.sum.79 CL101610014                 0   59.9921568627451
## features.properties.sum.80 CL101610019                 0   253.152941176471
## features.properties.sum.81 CL101040002                 0   50.8196078431372
## features.properties.sum.82 CL101040007  3.75686274509804   45.8470588235294
## features.properties.sum.83 CL101040001  23.7176470588235    24.756862745098
## features.properties.sum.84 CL101040009  45.1254901960784               54.4
## features.properties.sum.85 CL101044024  410.019607843137 0.0549019607843137
## features.properties.sum.86 CL101070001  18.7686274509804   10.3019607843137
## features.properties.sum.87 CL101044020  30.8039215686274                  0
## features.properties.sum.88 CL101044022  24.9058823529412                  0
## features.properties.sum.89 CL101044021  15.3411764705882                  0
## features.properties.sum.90 CL101044023   11.956862745098                  0
##                              area_Km2(shp)              NA porcentaje_rojo
## features.properties.sum    0.0397270010711 0.0397270010711     100.0000000
## features.properties.sum.1   0.100876482862  0.100876482862       9.1121414
## features.properties.sum.2   0.109852809052  0.109852809052       1.5765070
## features.properties.sum.3  0.0873709651722 0.0873709651722       0.0000000
## features.properties.sum.4  0.0639482581884 0.0639482581884       1.3996240
## features.properties.sum.5  0.0390825631323 0.0390825631323       0.0000000
## features.properties.sum.6  0.0327605622869 0.0327605622869       3.3096627
## features.properties.sum.7  0.0382199791074 0.0382199791074       0.0000000
## features.properties.sum.8  0.0167628398049 0.0167628398049       0.0000000
## features.properties.sum.9   0.234736140147  0.234736140147       0.0000000
## features.properties.sum.10 0.0123072515574 0.0123072515574       0.0000000
## features.properties.sum.11 0.0490761861993 0.0490761861993       0.0000000
## features.properties.sum.12  0.181770894446  0.181770894446       0.0000000
## features.properties.sum.13  0.187241197168  0.187241197168       0.0000000
## features.properties.sum.14 0.0822324117868 0.0822324117868       0.0000000
## features.properties.sum.15 0.0811335051897 0.0811335051897       3.4438776
## features.properties.sum.16 0.0517317014976 0.0517317014976       0.0000000
## features.properties.sum.17 0.0342342838388 0.0342342838388       2.9629630
## features.properties.sum.18  0.025537434093  0.025537434093       0.0000000
## features.properties.sum.19   0.14556645363   0.14556645363       0.0000000
## features.properties.sum.20 0.0969989514597 0.0969989514597       0.0000000
## features.properties.sum.21 0.0133418051918 0.0133418051918       0.0000000
## features.properties.sum.22 0.0876500187874 0.0876500187874       0.0000000
## features.properties.sum.23 0.0722716222512 0.0722716222512       0.0000000
## features.properties.sum.24 0.0460606415757 0.0460606415757       0.0000000
## features.properties.sum.25 0.0863192881262 0.0863192881262       0.0000000
## features.properties.sum.26 0.0786716671606 0.0786716671606       0.0000000
## features.properties.sum.27 0.0996942476728 0.0996942476728       0.0000000
## features.properties.sum.28 0.0926249593749 0.0926249593749       0.0000000
## features.properties.sum.29  0.107310516435  0.107310516435       0.0000000
## features.properties.sum.30  0.125452215699  0.125452215699       0.0000000
## features.properties.sum.31 0.0370788979097 0.0370788979097       0.0000000
## features.properties.sum.32  0.121432954093  0.121432954093       0.0000000
## features.properties.sum.33 0.0156484103605 0.0156484103605       0.0000000
## features.properties.sum.34 0.0637414139919 0.0637414139919       0.0000000
## features.properties.sum.35  0.163304691787  0.163304691787       0.0000000
## features.properties.sum.36 0.0228456773695 0.0228456773695       0.0000000
## features.properties.sum.37 0.0161851633664 0.0161851633664       0.0000000
## features.properties.sum.38 0.0165129804368 0.0165129804368       0.0000000
## features.properties.sum.39 0.0198858464782 0.0198858464782       0.0000000
## features.properties.sum.40  0.121994691845  0.121994691845       0.0000000
## features.properties.sum.41 0.0391150993622 0.0391150993622       0.0000000
## features.properties.sum.42 0.0305984387632 0.0305984387632       0.0000000
## features.properties.sum.43 0.0225271588162 0.0225271588162       0.0000000
## features.properties.sum.44 0.0661863412709 0.0661863412709       0.0000000
## features.properties.sum.45 0.0641183674004 0.0641183674004       0.2789999
## features.properties.sum.46 0.0711972768362 0.0711972768362       0.0000000
## features.properties.sum.47 0.0127425943588 0.0127425943588       0.0000000
## features.properties.sum.48  0.130168840973  0.130168840973       0.0000000
## features.properties.sum.49 0.0425520003997 0.0425520003997       0.0000000
## features.properties.sum.50 0.0157886226892 0.0157886226892       0.0000000
## features.properties.sum.51 0.0155196563794 0.0155196563794       0.0000000
## features.properties.sum.52 0.0181153020415 0.0181153020415       0.0000000
## features.properties.sum.53 0.0346999506794 0.0346999506794       0.0000000
## features.properties.sum.54  0.071272988267  0.071272988267       0.0000000
## features.properties.sum.55 0.0311922006569 0.0311922006569       0.0000000
## features.properties.sum.56 0.0269613307305 0.0269613307305       0.0000000
## features.properties.sum.57 0.0182961256272 0.0182961256272       0.0000000
## features.properties.sum.58 0.0474476041426 0.0474476041426       4.0479403
## features.properties.sum.59  0.030925134966  0.030925134966       0.0000000
## features.properties.sum.60 0.0990839862833 0.0990839862833       0.1614400
## features.properties.sum.61 0.0316396276002 0.0316396276002       0.0000000
## features.properties.sum.62 0.0151640809662 0.0151640809662       0.0000000
## features.properties.sum.63 0.0261707721535 0.0261707721535      14.8936170
## features.properties.sum.64 0.0531454414338 0.0531454414338       0.0000000
## features.properties.sum.65  0.108143702435  0.108143702435       0.0000000
## features.properties.sum.66 0.0585930577914 0.0585930577914       0.0000000
## features.properties.sum.67  0.232784007153  0.232784007153       0.0000000
## features.properties.sum.68  0.189817275455  0.189817275455       0.0000000
## features.properties.sum.69  0.157189625326  0.157189625326       0.0000000
## features.properties.sum.70 0.0937245066846 0.0937245066846       0.0000000
## features.properties.sum.71  0.128313247654  0.128313247654       0.0000000
## features.properties.sum.72   0.11302848218   0.11302848218       0.0000000
## features.properties.sum.73 0.0630994631392 0.0630994631392       0.0000000
## features.properties.sum.74 0.0559590444049 0.0559590444049       0.0000000
## features.properties.sum.75 0.0578071886107 0.0578071886107       0.0000000
## features.properties.sum.76 0.0229483888793 0.0229483888793      28.0402316
## features.properties.sum.77 0.0126627103916 0.0126627103916       0.0000000
## features.properties.sum.78 0.0139952832236 0.0139952832236       0.0000000
## features.properties.sum.79 0.0548194450787 0.0548194450787       0.0000000
## features.properties.sum.80  0.224397707218  0.224397707218       0.0000000
## features.properties.sum.81 0.0476141336392 0.0476141336392       0.0000000
## features.properties.sum.82 0.0443321397721 0.0443321397721       7.5737212
## features.properties.sum.83 0.0490302735314 0.0490302735314      48.9280803
## features.properties.sum.84 0.0920502698629 0.0920502698629      45.3406360
## features.properties.sum.85  0.343230877798  0.343230877798      99.9866117
## features.properties.sum.86 0.0303463589963 0.0303463589963      64.5622555
## features.properties.sum.87 0.0304940656141 0.0304940656141     100.0000000
## features.properties.sum.88 0.0301132769341 0.0301132769341     100.0000000
## features.properties.sum.89 0.0145008622673 0.0145008622673     100.0000000
## features.properties.sum.90 0.0173113872952 0.0173113872952     100.0000000
##                            porcentaje_area_glaciar
## features.properties.sum               0.0397270011
## features.properties.sum.1             0.0091920077
## features.properties.sum.2             0.0017318372
## features.properties.sum.3             0.0000000000
## features.properties.sum.4             0.0008950352
## features.properties.sum.5             0.0000000000
## features.properties.sum.6             0.0010842641
## features.properties.sum.7             0.0000000000
## features.properties.sum.8             0.0000000000
## features.properties.sum.9             0.0000000000
## features.properties.sum.10            0.0000000000
## features.properties.sum.11            0.0000000000
## features.properties.sum.12            0.0000000000
## features.properties.sum.13            0.0000000000
## features.properties.sum.14            0.0000000000
## features.properties.sum.15            0.0027941386
## features.properties.sum.16            0.0000000000
## features.properties.sum.17            0.0010143492
## features.properties.sum.18            0.0000000000
## features.properties.sum.19            0.0000000000
## features.properties.sum.20            0.0000000000
## features.properties.sum.21            0.0000000000
## features.properties.sum.22            0.0000000000
## features.properties.sum.23            0.0000000000
## features.properties.sum.24            0.0000000000
## features.properties.sum.25            0.0000000000
## features.properties.sum.26            0.0000000000
## features.properties.sum.27            0.0000000000
## features.properties.sum.28            0.0000000000
## features.properties.sum.29            0.0000000000
## features.properties.sum.30            0.0000000000
## features.properties.sum.31            0.0000000000
## features.properties.sum.32            0.0000000000
## features.properties.sum.33            0.0000000000
## features.properties.sum.34            0.0000000000
## features.properties.sum.35            0.0000000000
## features.properties.sum.36            0.0000000000
## features.properties.sum.37            0.0000000000
## features.properties.sum.38            0.0000000000
## features.properties.sum.39            0.0000000000
## features.properties.sum.40            0.0000000000
## features.properties.sum.41            0.0000000000
## features.properties.sum.42            0.0000000000
## features.properties.sum.43            0.0000000000
## features.properties.sum.44            0.0000000000
## features.properties.sum.45            0.0001788902
## features.properties.sum.46            0.0000000000
## features.properties.sum.47            0.0000000000
## features.properties.sum.48            0.0000000000
## features.properties.sum.49            0.0000000000
## features.properties.sum.50            0.0000000000
## features.properties.sum.51            0.0000000000
## features.properties.sum.52            0.0000000000
## features.properties.sum.53            0.0000000000
## features.properties.sum.54            0.0000000000
## features.properties.sum.55            0.0000000000
## features.properties.sum.56            0.0000000000
## features.properties.sum.57            0.0000000000
## features.properties.sum.58            0.0019206507
## features.properties.sum.59            0.0000000000
## features.properties.sum.60            0.0001599612
## features.properties.sum.61            0.0000000000
## features.properties.sum.62            0.0000000000
## features.properties.sum.63            0.0038977746
## features.properties.sum.64            0.0000000000
## features.properties.sum.65            0.0000000000
## features.properties.sum.66            0.0000000000
## features.properties.sum.67            0.0000000000
## features.properties.sum.68            0.0000000000
## features.properties.sum.69            0.0000000000
## features.properties.sum.70            0.0000000000
## features.properties.sum.71            0.0000000000
## features.properties.sum.72            0.0000000000
## features.properties.sum.73            0.0000000000
## features.properties.sum.74            0.0000000000
## features.properties.sum.75            0.0000000000
## features.properties.sum.76            0.0064347814
## features.properties.sum.77            0.0000000000
## features.properties.sum.78            0.0000000000
## features.properties.sum.79            0.0000000000
## features.properties.sum.80            0.0000000000
## features.properties.sum.81            0.0000000000
## features.properties.sum.82            0.0033575927
## features.properties.sum.83            0.0239895716
## features.properties.sum.84            0.0417361778
## features.properties.sum.85            0.3431849251
## features.properties.sum.86            0.0195922938
## features.properties.sum.87            0.0304940656
## features.properties.sum.88            0.0301132769
## features.properties.sum.89            0.0145008623
## features.properties.sum.90            0.0173113873

Logica de la informacion temporal:

region_tara <- st_read("rrss/Region_01.shp", 
        quiet = TRUE) %>% 
        sf_as_ee()

glaciar_tara <- st_read("GlaciaresxRegion/Simple_TARAPACA.shp",
        quiet = TRUE) %>%
        sf_as_ee()
fn_cart <- function(a,m){

i_cuatrimestre <- switch(m, "01","05","09")
f_cuatrimestre <- switch(m, "04","08","12")


fecha_1 <- paste("20",a,"-",i_cuatrimestre,"-01", sep = "")
fecha_2 <- paste("20",a,"-",f_cuatrimestre,"-01", sep = "")
tara <- region_tara$geometry()


start <- ee$Date(fecha_1)
finish <- ee$Date(fecha_2)
cc <- 20

sentinel1 = ee$ImageCollection('COPERNICUS/S2')$filterDate(start, finish)$filterBounds(tara)$
  filter(ee$Filter$lt("CLOUDY_PIXEL_PERCENTAGE", cc))

first <- sentinel1$median()

vizParams <- list(
  bands = c("B8","B5" , "B3"),
  #  bands = c("B2", "B3"),
  min = 100,
  max = 1000,
  gamma = 2
)

getNDGI <- function(image) 
{
     image$normalizedDifference(c("B4", "B3")) > 0
}

ndgi <- getNDGI(first)

ndgiParams <- list(palette = c(
  "#d73027", "#f46d43", "#fdae61",
  "#fee08b", "#d9ef8b", "#a6d96a",
  "#66bd63", "#1a9850"
))



glaciar_tara <- glaciar_tara$geometry()

glaciares_adm_con_ngvi <- ndgi$clip(glaciar_tara)

tara_sin_glacia <- tara$difference(glaciar_tara, ee$ErrorMargin(1))

ndvi_tarapaca_sin_glaciares <- ndgi$clip(tara_sin_glacia)

limites_glaciares_con_rasters <- ndgi$clip(glaciar_tara)

# region_arica <- st_read("Regiones_separadas/Region_15.shp", quiet = TRUE)
# region_arica

muestras_in <- ndgi$sampleRegions(
    collection = ee$Feature(glaciar_tara),
    scale = 100,
    tileScale = 16,
    geometries = TRUE
  )

muestras_in_gee_rojas = muestras_in$filter(ee$Filter$eq('nd', 0))




ndvi_tara_sin_glaciares <- ndgi$clip(tara_sin_glacia)


muestras_in <- ndgi$sampleRegions(
    collection = ee$Feature(ndvi_tara_sin_glaciares),
    scale = 10000,
    tileScale = 16,
    geometries = TRUE
  )

muestras_out_gee_verdes = muestras_in$filter(ee$Filter$eq('nd', 1))


union_total <- muestras_out_gee_verdes$merge(muestras_in_gee_rojas)

region_arica <- st_read("rrss/Region_01.shp", 
        quiet = TRUE) %>% 
        sf_as_ee()
arica <- region_arica$geometry()

start <- ee$Date(fecha_1)
finish <- ee$Date(fecha_2)
cc <- 20

sentinel1 = ee$ImageCollection('COPERNICUS/S2')$filterDate(start, finish)$filterBounds(arica)$
  filter(ee$Filter$lt("CLOUDY_PIXEL_PERCENTAGE", cc))

first <- sentinel1$median()

# Use these bands for prediction.
bands <- c("B2", "B3", "B4", "B8")

# This property of the table stores the land cover labels.
label <- "nd"

# Overlay the points on the imagery to get training.
training <- first$select(bands)$sampleRegions(
  collection = union_total,
  properties = list(label),
  scale = 10
)

# Train a CART classifier with default parameters.
trained <- ee$Classifier$smileRandomForest(10)$train(training, label, bands)

# Classify the image with the same bands used for training.
classified1 <- first$select(bands)$classify(trained)


periodo <- paste(fecha_1," / ",fecha_2," ", sep = "")
print(periodo)

###################################################################
mask_0 <- read_sf("GlaciaresxRegion/Simple_TARAPACA.shp")


reg_15_2 <- mask_0 %>% dplyr::select(COD_GLA,AREA_Km2)
varia <- reg_15_2 %>%
sf_as_ee()

region_0 <- varia$geometry()
sale_4 <- classified1$clip(region_0)

puntos_r <- sale_4$select('classification')$eq(0)

areas_rojas = puntos_r$reduceRegions(
reducer= ee$Reducer$sum(),
collection= varia,
scale= 30
)

rojas <- areas_rojas$getInfo()

rojas1 <- as.data.frame(rojas)



puntos_v <- sale_4$select('classification')$eq(1)

areas_verdes = puntos_v$reduceRegions(
reducer= ee$Reducer$sum(),
collection= varia,
scale= 30
)

verdes <- areas_verdes$getInfo()

verdes1 <- as.data.frame(verdes)


###########

r_v <- rbind(colnames(rojas1),rojas1,verdes1)
r_v <- r_v[1:4,]
r_v <- r_v[-3,]
r_v <- t(r_v)
r_v <- as.data.frame(r_v)
names(r_v)[1] <- "col1"
names(r_v)[2] <- "col2"
names(r_v)[3] <- "col3"
r_v$col4 <- r_v$col3
r_v$col5 <- r_v$col3

###########

data1 <- filter(r_v, grepl("features.properties.COD_GLA",col1))
data1 <- as.data.frame(data1[,2])

data2 <- filter(r_v, grepl("features.properties.sum",col1))
data2 <- as.data.frame(data2[,c(2,3)])

data3 <- filter(r_v, grepl("features.properties.AREA_Km2",col1))
data3 <- as.data.frame(data3[,c(2,3)])

data4 <- cbind(data1,data2,data3)
data4 <- data4[,-c(4)]

colnames(data4) <- c("codigo_gla", "rojo", "verde", "area_Km2(shp)")

nombre <- paste("arica_",fecha_1,"_",fecha_2,".xlsx", sep = "")

data4$porcentaje_rojo <- (100*as.numeric(data4$rojo)) / (as.numeric(data4$rojo) + as.numeric(data4$verde))
data4$porcentaje_area_glaciar <- (data4$porcentaje_rojo * as.numeric(data4$`area_Km2(shp)`)) / 100

data4$fecha <- periodo

write_xlsx(data4,nombre)





}
# for (a in 18:18) {
# for (m in 2:3) {
# 
# fn_cart(a,m)
# 
# }
# }

Vamos a exponer la data de dos cuatrimetres, el segundo y el tercero ambos para el año 2018

segundo_cuatri_18 <- fn_cart(18,2)
## Warning: Ops.ee.image.Image will be deprecated in rgee v.1.1.0. Please install
## rgeeExtra (https://github.com/r-earthengine/rgeeExtra). Deeply sorry for the
## inconveniences.
## [1] "2018-05-01 / 2018-08-01 "
tercer_cuatri_18 <- fn_cart(18,3)
## Warning: Ops.ee.image.Image will be deprecated in rgee v.1.1.0. Please install
## rgeeExtra (https://github.com/r-earthengine/rgeeExtra). Deeply sorry for the
## inconveniences.
## [1] "2018-09-01 / 2018-12-01 "

Analisis temporal

library(readxl)

     
a <- read_xlsx("arica_2018-09-01_2018-12-01.xlsx")
b <- read_xlsx("arica_2018-05-01_2018-08-01.xlsx")

ab <- rbind(b,a)

write_xlsx(ab,"ab.xlsx")

kbl(ab) %>%
 kable_styling(bootstrap_options = c("striped", "hover")) %>%
 kable_paper() %>%
 scroll_box(width = "100%", height = "300px")
codigo_gla rojo verde area_Km2(shp) porcentaje_rojo porcentaje_area_glaciar fecha
CL101044025 0.666666666666667 48.5607843137255 0.0397270010711 1.3542579 0.0005380 2018-05-01 / 2018-08-01
CL101044018 14.8274509803922 100.4 0.100876482862 12.8679849 0.0129808 2018-05-01 / 2018-08-01
CL101044017 31.8039215686274 100.039215686275 0.109852809052 24.1225461 0.0264993 2018-05-01 / 2018-08-01
CL101044019 37.2980392156863 65.1764705882353 0.0873709651722 36.3973824 0.0318007 2018-05-01 / 2018-08-01
CL101044016 12.3058823529412 66.5803921568627 0.0639482581884 15.5995228 0.0099756 2018-05-01 / 2018-08-01
CL101044015 6.98039215686275 30.4666666666667 0.0390825631323 18.6406954 0.0072853 2018-05-01 / 2018-08-01
CL101044014 1.61176470588235 28.8 0.0327605622869 5.2998066 0.0017362 2018-05-01 / 2018-08-01
CL101044013 4.10588235294118 36.0549019607843 0.0382199791074 10.2236110 0.0039075 2018-05-01 / 2018-08-01
CL101044012 7.16470588235294 8.88627450980392 0.0167628398049 44.6371854 0.0074825 2018-05-01 / 2018-08-01
CL101044011 47.1137254901961 228.541176470588 0.234736140147 17.0915609 0.0401201 2018-05-01 / 2018-08-01
CL101044010 1.21176470588235 5.6078431372549 0.0123072515574 17.7688327 0.0021869 2018-05-01 / 2018-08-01
CL101044007 25.3529411764706 33.3764705882353 0.0490761861993 43.1690705 0.0211857 2018-05-01 / 2018-08-01
CL101044008 76.5843137254902 134.070588235294 0.181770894446 36.3553437 0.0660834 2018-05-01 / 2018-08-01
CL101044006 47.4509803921569 179.592156862745 0.187241197168 20.8995440 0.0391326 2018-05-01 / 2018-08-01
CL101042002 1.61176470588235 79.3960784313725 0.0822324117868 1.9896403 0.0016361 2018-05-01 / 2018-08-01
CL101042001 3.50196078431373 78.0705882352941 0.0811335051897 4.2930628 0.0034831 2018-05-01 / 2018-08-01
CL101042003 8.11764705882353 55.4 0.0517317014976 12.7801445 0.0066114 2018-05-01 / 2018-08-01
CL101042005 2.22745098039216 33.0588235294118 0.0342342838388 6.3125139 0.0021610 2018-05-01 / 2018-08-01
CL101042004 1.03529411764706 19.121568627451 0.025537434093 5.1361868 0.0013117 2018-05-01 / 2018-08-01
CL101610012 11.6745098039216 144.423529411765 0.14556645363 7.4789599 0.0108869 2018-05-01 / 2018-08-01
CL101610013 1 108.176470588235 0.0969989514597 0.9159483 0.0008885 2018-05-01 / 2018-08-01
CL101610011 0 6.61960784313725 0.0133418051918 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101610010 0 92.635294117647 0.0876500187874 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101610009 0 72.7764705882353 0.0722716222512 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101610008 0 41.6274509803922 0.0460606415757 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101610005 0 78.9098039215686 0.0863192881262 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101610004 0 63.0549019607843 0.0786716671606 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101610002 3.47843137254902 113.752941176471 0.0996942476728 2.9671506 0.0029581 2018-05-01 / 2018-08-01
CL101610003 0 97.6431372549019 0.0926249593749 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101610001 2.25882352941176 115.494117647059 0.107310516435 1.9182736 0.0020585 2018-05-01 / 2018-08-01
CL101611002 13.2980392156863 149.203921568627 0.125452215699 8.1833100 0.0102661 2018-05-01 / 2018-08-01
CL101720004 17.9490196078431 15.0549019607843 0.0370788979097 54.3845057 0.0201652 2018-05-01 / 2018-08-01
CL101720003 2.16078431372549 127.317647058824 0.121432954093 1.6688373 0.0020265 2018-05-01 / 2018-08-01
CL101720001 1.93725490196078 8.30588235294118 0.0156484103605 18.9127106 0.0029595 2018-05-01 / 2018-08-01
CL101720002 0.125490196078431 73.5607843137255 0.0637414139919 0.1703034 0.0001086 2018-05-01 / 2018-08-01
CL101720008 12.8588235294118 180.247058823529 0.163304691787 6.6589497 0.0108744 2018-05-01 / 2018-08-01
CL101720005 5.58823529411765 17.7450980392157 0.0228456773695 23.9495798 0.0054714 2018-05-01 / 2018-08-01
CL101720006 0.403921568627451 14.2588235294118 0.0161851633664 2.7547473 0.0004459 2018-05-01 / 2018-08-01
CL101720009 4.82352941176471 10.3921568627451 0.0165129804368 31.7010309 0.0052348 2018-05-01 / 2018-08-01
CL101720007 6.84705882352941 2.8 0.0198858464782 70.9756098 0.0141141 2018-05-01 / 2018-08-01
CL101730001 32.1019607843137 100.054901960784 0.121994691845 24.2908012 0.0296335 2018-05-01 / 2018-08-01
CL101730002 35.5254901960784 3 0.0391150993622 92.2129479 0.0360692 2018-05-01 / 2018-08-01
CL101730009 1.26274509803922 20.2313725490196 0.0305984387632 5.8748404 0.0017976 2018-05-01 / 2018-08-01
CL101730008 10.7490196078431 11.2862745098039 0.0225271588162 48.7809219 0.0109890 2018-05-01 / 2018-08-01
CL101730011 21.843137254902 36.3098039215686 0.0661863412709 37.5615348 0.0248606 2018-05-01 / 2018-08-01
CL101730012 22.8156862745098 47.9254901960784 0.0641183674004 32.2523421 0.0206797 2018-05-01 / 2018-08-01
CL101730013 34.3607843137255 35.3098039215686 0.0711972768362 49.3189238 0.0351137 2018-05-01 / 2018-08-01
CL101730010 4.42745098039216 3.31372549019608 0.0127425943588 57.1935157 0.0072879 2018-05-01 / 2018-08-01
CL101730014 62.5803921568628 95.2039215686275 0.130168840973 39.6619858 0.0516275 2018-05-01 / 2018-08-01
CL101730016 9.5921568627451 16.5686274509804 0.0425520003997 36.6661670 0.0156022 2018-05-01 / 2018-08-01
CL101730017 3.30196078431373 7.6156862745098 0.0157886226892 30.2442529 0.0047752 2018-05-01 / 2018-08-01
CL101730015 0 9.06666666666666 0.0155196563794 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101730018 2.67058823529412 8.88235294117647 0.0181153020415 23.1160896 0.0041875 2018-05-01 / 2018-08-01
CL101730004 14.5333333333333 21.7960784313725 0.0346999506794 40.0043178 0.0138815 2018-05-01 / 2018-08-01
CL101730003 31.8588235294118 53.9921568627451 0.071272988267 37.1094464 0.0264490 2018-05-01 / 2018-08-01
CL101730006 5.6156862745098 22.0745098039216 0.0311922006569 20.2804135 0.0063259 2018-05-01 / 2018-08-01
CL101730007 10.2549019607843 14.843137254902 0.0269613307305 40.8593750 0.0110162 2018-05-01 / 2018-08-01
CL101730005 0 13.2509803921569 0.0182961256272 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101044001 0 49.4078431372549 0.0474476041426 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101044002 2.73333333333333 24.2901960784314 0.030925134966 10.1146423 0.0031280 2018-05-01 / 2018-08-01
CL101044003 7.8156862745098 89.3568627450981 0.0990839862833 8.0431010 0.0079694 2018-05-01 / 2018-08-01
CL101044004 2.23137254901961 30.1803921568627 0.0316396276002 6.8844525 0.0021782 2018-05-01 / 2018-08-01
CL101044009 0.470588235294118 13.6901960784314 0.0151640809662 3.3231792 0.0005039 2018-05-01 / 2018-08-01
CL101044005 0 22.1176470588235 0.0261707721535 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101040008 27.3333333333333 23.7803921568627 0.0531454414338 53.4755255 0.0284198 2018-05-01 / 2018-08-01
CL101611001 5.51764705882353 126.678431372549 0.108143702435 4.1738357 0.0045137 2018-05-01 / 2018-08-01
CL101610024 18.6392156862745 39.5490196078431 0.0585930577914 32.0326190 0.0187689 2018-05-01 / 2018-08-01
CL101610023 44.5764705882353 223.388235294118 0.232784007153 16.6352022 0.0387241 2018-05-01 / 2018-08-01
CL101610022 102.454901960784 142.329411764706 0.189817275455 41.8551746 0.0794484 2018-05-01 / 2018-08-01
CL101610021 67.7450980392157 121.549019607843 0.157189625326 35.7882743 0.0562555 2018-05-01 / 2018-08-01
CL101610020 44.5921568627451 67.6352941176471 0.0937245066846 39.7337340 0.0372402 2018-05-01 / 2018-08-01
CL101610018 83.9176470588235 76.3960784313725 0.128313247654 52.3458904 0.0671667 2018-05-01 / 2018-08-01
CL101610017 42.9176470588235 81.8313725490196 0.11302848218 34.4031939 0.0388854 2018-05-01 / 2018-08-01
CL101610016 30.843137254902 36.1725490196078 0.0630994631392 46.0237580 0.0290407 2018-05-01 / 2018-08-01
CL101040006 21.2352941176471 37.0666666666667 0.0559590444049 36.4229502 0.0203819 2018-05-01 / 2018-08-01
CL101040005 7.51764705882353 49.4470588235294 0.0578071886107 13.1970260 0.0076288 2018-05-01 / 2018-08-01
CL101040004 2.42745098039216 10.7960784313725 0.0229483888793 18.3570581 0.0042126 2018-05-01 / 2018-08-01
CL101040003 3.58823529411765 3.84705882352941 0.0126627103916 48.2594937 0.0061110 2018-05-01 / 2018-08-01
CL101610015 3.21176470588235 7.48627450980392 0.0139952832236 30.0219941 0.0042017 2018-05-01 / 2018-08-01
CL101610014 31.2980392156863 32.078431372549 0.0548194450787 49.3843203 0.0270722 2018-05-01 / 2018-08-01
CL101610019 28.4941176470588 239.41568627451 0.224397707218 10.6357129 0.0238663 2018-05-01 / 2018-08-01
CL101040002 1 50.6627450980392 0.0476141336392 1.9356308 0.0009216 2018-05-01 / 2018-08-01
CL101040007 5.91372549019608 38.4470588235294 0.0443321397721 13.3309760 0.0059099 2018-05-01 / 2018-08-01
CL101040001 8.51764705882353 40.956862745098 0.0490302735314 17.2162334 0.0084412 2018-05-01 / 2018-08-01
CL101040009 0.286274509803922 101.360784313726 0.0920502698629 0.2816358 0.0002592 2018-05-01 / 2018-08-01
CL101044024 85.3019607843137 343.8 0.343230877798 19.8791822 0.0682315 2018-05-01 / 2018-08-01
CL101070001 0 0 0.0303463589963 NA NA 2018-05-01 / 2018-08-01
CL101044020 6.49803921568627 25.4274509803922 0.0304940656141 20.3537649 0.0062067 2018-05-01 / 2018-08-01
CL101044022 0 24.9058823529412 0.0301132769341 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101044021 0.258823529411765 15.0823529411765 0.0145008622673 1.6871166 0.0002446 2018-05-01 / 2018-08-01
CL101044023 0 11.956862745098 0.0173113872952 0.0000000 0.0000000 2018-05-01 / 2018-08-01
CL101044025 0 0 0.0397270010711 NA NA 2018-09-01 / 2018-12-01
CL101044018 0 0 0.100876482862 NA NA 2018-09-01 / 2018-12-01
CL101044017 0 0 0.109852809052 NA NA 2018-09-01 / 2018-12-01
CL101044019 0 0 0.0873709651722 NA NA 2018-09-01 / 2018-12-01
CL101044016 0 0 0.0639482581884 NA NA 2018-09-01 / 2018-12-01
CL101044015 0 0 0.0390825631323 NA NA 2018-09-01 / 2018-12-01
CL101044014 0 0 0.0327605622869 NA NA 2018-09-01 / 2018-12-01
CL101044013 0 1.14509803921569 0.0382199791074 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044012 0 13.8980392156863 0.0167628398049 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044011 9.50588235294118 265.913725490196 0.234736140147 3.4514182 0.0081017 2018-09-01 / 2018-12-01
CL101044010 0 5.82352941176471 0.0123072515574 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044007 0 57.3803921568627 0.0490761861993 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044008 0 201.643137254902 0.181770894446 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044006 4 221.235294117647 0.187241197168 1.7759206 0.0033253 2018-09-01 / 2018-12-01
CL101042002 0 81.0078431372549 0.0822324117868 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101042001 0.00392156862745098 79.9372549019608 0.0811335051897 0.0049056 0.0000040 2018-09-01 / 2018-12-01
CL101042003 0 63.2117647058824 0.0517317014976 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101042005 0 34.8823529411765 0.0342342838388 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101042004 0 20.121568627451 0.025537434093 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610012 0 154.098039215686 0.14556645363 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610013 0 110.176470588235 0.0969989514597 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610011 1 6.61960784313725 0.0133418051918 13.1240350 0.0017510 2018-09-01 / 2018-12-01
CL101610010 0.0352941176470588 94.2666666666667 0.0876500187874 0.0374267 0.0000328 2018-09-01 / 2018-12-01
CL101610009 1.96470588235294 72.7764705882353 0.0722716222512 2.6286794 0.0018998 2018-09-01 / 2018-12-01
CL101610008 1.49019607843137 41.6274509803922 0.0460606415757 3.4561164 0.0015919 2018-09-01 / 2018-12-01
CL101610005 0 78.3176470588235 0.0863192881262 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610004 0 63.0549019607843 0.0786716671606 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610002 4.03529411764706 113.752941176471 0.0996942476728 3.4258889 0.0034154 2018-09-01 / 2018-12-01
CL101610003 0 97.6431372549019 0.0926249593749 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610001 0 115.494117647059 0.107310516435 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101611002 30.6 120.443137254902 0.125452215699 20.2591131 0.0254155 2018-09-01 / 2018-12-01
CL101720004 0 30.7843137254902 0.0370788979097 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101720003 0 129 0.121432954093 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101720001 0 9.56470588235294 0.0156484103605 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101720002 0 73.6862745098039 0.0637414139919 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101720008 0 188.070588235294 0.163304691787 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101720005 0 22.3333333333333 0.0228456773695 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101720006 0 15.2666666666667 0.0161851633664 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101720009 0 13.2156862745098 0.0165129804368 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101720007 0 9.65490196078431 0.0198858464782 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730001 0 129.050980392157 0.121994691845 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730002 0.345098039215686 35.5254901960784 0.0391150993622 0.9620641 0.0003763 2018-09-01 / 2018-12-01
CL101730009 0.368627450980392 20.9098039215686 0.0305984387632 1.7323996 0.0005301 2018-09-01 / 2018-12-01
CL101730008 0 19.0705882352941 0.0225271588162 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730011 0 53.4156862745098 0.0661863412709 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730012 0 73.0901960784314 0.0641183674004 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730013 0 63.9176470588235 0.0711972768362 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730010 0 7.74117647058823 0.0127425943588 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730014 1 144.137254901961 0.130168840973 0.6890030 0.0008969 2018-09-01 / 2018-12-01
CL101730016 0 25.1607843137255 0.0425520003997 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730017 0 9.94901960784314 0.0157886226892 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730015 0 9.06666666666666 0.0155196563794 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730018 0 11.5607843137255 0.0181153020415 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730004 0 33.2745098039216 0.0346999506794 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730003 0 79.1529411764706 0.071272988267 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730006 0 27.6901960784314 0.0311922006569 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730007 0 24.5843137254902 0.0269613307305 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101730005 0 13.2509803921569 0.0182961256272 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044001 0 49.4078431372549 0.0474476041426 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044002 0 27.0235294117647 0.030925134966 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044003 0 97.164705882353 0.0990839862833 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044004 0 31.4117647058824 0.0316396276002 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044009 0 13.6901960784314 0.0151640809662 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101044005 0 22.1176470588235 0.0261707721535 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101040008 1.86274509803922 51.1137254901961 0.0531454414338 3.5161744 0.0018687 2018-09-01 / 2018-12-01
CL101611001 0 128.905882352941 0.108143702435 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610024 0 53.6862745098039 0.0585930577914 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610023 1.21960784313726 254.564705882353 0.232784007153 0.4768110 0.0011099 2018-09-01 / 2018-12-01
CL101610022 2 229.074509803922 0.189817275455 0.8655217 0.0016429 2018-09-01 / 2018-12-01
CL101610021 5.35294117647059 180.870588235294 0.157189625326 2.8744709 0.0045184 2018-09-01 / 2018-12-01
CL101610020 15.8392156862745 106.007843137255 0.0937245066846 12.9992598 0.0121835 2018-09-01 / 2018-12-01
CL101610018 17.2156862745098 143.988235294118 0.128313247654 10.6794463 0.0137031 2018-09-01 / 2018-12-01
CL101610017 0 119.317647058824 0.11302848218 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610016 2.66274509803922 63.3176470588235 0.0630994631392 4.0356612 0.0025465 2018-09-01 / 2018-12-01
CL101040006 11.1450980392157 53.2901960784314 0.0559590444049 17.2965735 0.0096790 2018-09-01 / 2018-12-01
CL101040005 7.9921568627451 55.3372549019608 0.0578071886107 12.6199765 0.0072953 2018-09-01 / 2018-12-01
CL101040004 3.95294117647059 13.2235294117647 0.0229483888793 23.0136986 0.0052813 2018-09-01 / 2018-12-01
CL101040003 0 7.43529411764706 0.0126627103916 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610015 0 9.92156862745098 0.0139952832236 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101610014 0.874509803921569 59.0156862745098 0.0548194450787 1.4601886 0.0008005 2018-09-01 / 2018-12-01
CL101610019 0 250.643137254902 0.224397707218 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101040002 0 50.8196078431372 0.0476141336392 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101040007 0 49.5803921568627 0.0443321397721 0.0000000 0.0000000 2018-09-01 / 2018-12-01
CL101040001 0.819607843137255 49.4745098039216 0.0490302735314 1.6296296 0.0007990 2018-09-01 / 2018-12-01
CL101040009 1.63529411764706 101.011764705882 0.0920502698629 1.5931232 0.0014665 2018-09-01 / 2018-12-01
CL101044024 0 0 0.343230877798 NA NA 2018-09-01 / 2018-12-01
CL101070001 0 0 0.0303463589963 NA NA 2018-09-01 / 2018-12-01
CL101044020 0 0 0.0304940656141 NA NA 2018-09-01 / 2018-12-01
CL101044022 0 0 0.0301132769341 NA NA 2018-09-01 / 2018-12-01
CL101044021 0 0 0.0145008622673 NA NA 2018-09-01 / 2018-12-01
CL101044023 0 0 0.0173113872952 NA NA 2018-09-01 / 2018-12-01
# tercer_cuatri_18 <- fn_cart(18,3)
# 
# union <- rbind(segundo_cuatri_18,tercer_cuatri_18)
# 
# kbl(union) %>%
# kable_styling(bootstrap_options = c("striped", "hover")) %>%
# kable_paper() %>%
# scroll_box(width = "100%", height = "300px")
# 
# write_xlsx(union,"union.xlsx")