library(plyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(ggplot2)
library(HURDAT)
library(sf)
## Linking to GEOS 3.6.1, GDAL 2.2.3, PROJ 4.9.3
library(lubridate)
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:plyr':
##
## here
## The following object is masked from 'package:base':
##
## date
library(tmap)
Am <- st_read("C:/Users/USUARIO/Documents/R/Tesis/Americas/Americas.shp")
## Reading layer `Americas' from data source `C:\Users\USUARIO\Documents\R\Tesis\Americas\Americas.shp' using driver `ESRI Shapefile'
## Simple feature collection with 53 features and 1 field
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: -186.5396 ymin: -58.49861 xmax: -12.15764 ymax: 83.6236
## epsg (SRID): 4326
## proj4string: +proj=longlat +datum=WGS84 +no_defs
AL <- get_hurdat(basin = "AL")
AL$Basin <- "AL"
EP <- get_hurdat(basin = "EP")
EP$Basin <- "EP"
hu1 <- rbind(AL,EP) %>% dplyr::select( Key, Name, DateTime, Record, Status, Lat, Lon, Wind, Basin)%>%filter(year(DateTime) > 1969,!is.na(Lat), !is.na(Lon)) %>% mutate(Year = year(DateTime))
Hurricane <- st_as_sf(hu1, coords = c("Lon", "Lat"), crs = 4326 )
Year <- c(1970:2018)
el_nino <- c(0, 0, 3, 0, 0, 0, 1, 1, 0, 1, 0, 0, 4, 0, 0, 0, 2, 3, 0, 0, 0, 3, 0, 0, 2, 0, 0, 4, 0, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 2, 0, 0, 0, 0, 1, 4, 0, 0, 1)
la_nina <- c(2, 1, 0, 3, 1, 3, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 3, 3, 1, 0, 0, 0, 0, 1, 0, 3, 1, 0, 3, 2, 0, 0, 0, 0, 1, 1, 0)
enzo <- cbind(Year, el_nino, la_nina)
db <- merge(Hurricane, enzo, by.x = "Year", by.y = "Year")
hur_join <- st_join(db, Am)
## although coordinates are longitude/latitude, st_intersects assumes that they are planar
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## although coordinates are longitude/latitude, st_intersects assumes that they are planar
hur_join
## Simple feature collection with 46112 features and 11 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: -180 ymin: 0.4 xmax: 179.9 ymax: 70.7
## epsg (SRID): 4326
## proj4string: +proj=longlat +datum=WGS84 +no_defs
## First 10 features:
## Year Key Name DateTime Record Status Wind Basin el_nino
## 1 1970 AL011970 ALMA 1970-05-17 18:00:00 <NA> TD 25 AL 0
## 2 1970 AL011970 ALMA 1970-05-18 00:00:00 <NA> TD 25 AL 0
## 3 1970 AL011970 ALMA 1970-05-18 06:00:00 <NA> TD 25 AL 0
## 4 1970 AL011970 ALMA 1970-05-18 12:00:00 <NA> TD 25 AL 0
## 5 1970 AL011970 ALMA 1970-05-18 18:00:00 <NA> TD 25 AL 0
## 6 1970 AL011970 ALMA 1970-05-19 00:00:00 <NA> TD 25 AL 0
## 7 1970 AL011970 ALMA 1970-05-19 06:00:00 <NA> TD 25 AL 0
## 8 1970 AL011970 ALMA 1970-05-19 12:00:00 <NA> TD 25 AL 0
## 9 1970 AL011970 ALMA 1970-05-19 18:00:00 <NA> TD 25 AL 0
## 10 1970 AL011970 ALMA 1970-05-20 00:00:00 <NA> TS 35 AL 0
## la_nina COUNTRY geometry
## 1 2 <NA> POINT (-79 11.5)
## 2 2 <NA> POINT (-79.2 11.7)
## 3 2 <NA> POINT (-79.7 12.1)
## 4 2 <NA> POINT (-80.1 12.3)
## 5 2 <NA> POINT (-80.5 12.5)
## 6 2 <NA> POINT (-81 13)
## 7 2 <NA> POINT (-81.5 13.5)
## 8 2 <NA> POINT (-82 14)
## 9 2 <NA> POINT (-82.5 14.5)
## 10 2 <NA> POINT (-82.5 15.5)
Ya tenemos nuestra base de datos con las coordeneadas y puntos de impacto. Ahora queremos saber cuantos huracanes hubo en Centroamérica y que tan intensos fueron. Podemos ver varias trayectorias de mapas a continuación.
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
## Warning in st_is_longlat(x): bounding box has potentially an invalid value
## range for longlat data
Aqui podemos ver 5 mapas con trayectorias en intervalos de 5 años.
## # A tibble: 7 x 2
## COUNTRY tot_hits
## <fct> <int>
## 1 Belize 16
## 2 Colombia 2
## 3 Costa Rica 2
## 4 El Salvador 1
## 5 Guatemala 18
## 6 Honduras 18
## 7 Nicaragua 25
Aqui podemos ver cuantos huracanes/tormentas tropicales pegaron por país en los ultimos 48 años.
Y aqui podemos ver cuales de esos golpes fueron de huracánes ``fuertes’’ de categría 3 o mayor (más de 110 millas por hora).
## # A tibble: 3 x 5
## # Groups: Year, Key, COUNTRY [3]
## Year Key COUNTRY Wind n
## <dbl> <chr> <fct> <int> <int>
## 1 1978 AL161978 Honduras 115 1
## 2 1988 AL111988 Nicaragua 120 1
## 3 2007 AL062007 Nicaragua 140 1
Se identificó que por como se toman las medidas (cada 6 horas), la velocidad de golpe no cuenta la historia completa del huracán. Se quizo ver si había algún huracán que fue fuerte 6 horas antes de la medición de impacto.
Se identifico sólo 1 - Huracán Iris 2001-10-09 02:00:00 Velocidad 125 mph. Además todas las mediciones de los 3 huracanes fuertes que hicieron contanto también eran de categoría 3 o mayor 6 horas antes de la medición de contacto.
## # A tibble: 82 x 4
## # Groups: Year, Key [51]
## Year Key COUNTRY Max_Wind
## <dbl> <chr> <fct> <dbl>
## 1 1971 AL081971 Belize 25
## 2 1971 AL131971 Belize 60
## 3 1971 AL131971 Honduras 100
## 4 1971 AL181971 Nicaragua 60
## 5 1971 AL221971 Belize 60
## 6 1971 AL221971 Guatemala 60
## 7 1971 EP151971 Nicaragua 25
## 8 1973 AL171973 Nicaragua NA
## 9 1974 AL141974 Guatemala 60
## 10 1975 AL161975 Belize NA
## # ... with 72 more rows
Finalmente vemos una tabla de velocidades máximas de impacto por huracán por país. Para nuestra eventual tabla de frecuencias.
Preguntas a resolver:
¿Usamos sólo los 3 huracanes que tuvieron impacto fuerto o usamos el potencial 4to? Si este último es el caso ¿Como se usaría? Y ¿Cómo afectaría a los otros huracanes?
Dada la poca frecuencia de huracanes por país ¿Valdría la pena agrupar algunos paises? ¿Valdría la pena agrupar todos? ¿Cómo se haría?
Hubo un gran problema al tratar de integrar las temperaturas. El nivel de complejidad aumenta demasiado.
Pronpongo solo usar el fenómeno de la niña y el niño como indicador de intensidad y hacer un pronóstico solo con estos fenómenos en mente. Además recalcar la teoría de valores extremos para distintos casos de la niña y el niño en los próximos 10 - 100 años.