spatial_catch_lat: Captura espacial por latitud

View source: R/spatial_catch_lat.R

spatial_catch_latR Documentation

Captura espacial por latitud

Description

Realiza una interpolacion bicubica por cuadriculas donde el eje x es el tiempo en dias y el eje y es la latitud cada medio grado.

Usage

spatial_catch_lat(data, fecha_inicio, fecha_final, lat_superior, lat_inferior, ...)

Arguments

data

la base de datos contiene por viaje la captura, fecha, latitud y longitud

fecha_inicio

fecha de inicio

fecha_final

fecha final

lat_superior

latitud superior

lat_inferior

latitud inferior

Author(s)

Pablo Marin

Examples

data(base_captura)
head(base_captura)

base_captura0    <- base_captura[!is.na(base_captura$lat) & !is.na(base_captura$lon), ]

base_captura0    <- base_captura0[!is.na(base_captura0$catch) & base_captura0$catch > 0, ]
base_captura0$fecha <- as.Date(paste0(base_captura0$year,"-", base_captura0$month, "-", base_captura0$day), format = "%Y-%m-%d")

# fechas de analisis
fecha_inicio <- as.Date("2018-01-01", format = "%Y-%m-%d")
fecha_final  <- as.Date("2019-04-01", format = "%Y-%m-%d")
  
# latitud de analisis
lat_superior <- 3
lat_inferior <- 18.5

catch <- spatial_catch_lat(data = base_captura0, fecha_inicio, fecha_final, lat_superior, lat_inferior)

require(fields)
scale.color = designer.colors(ceiling(max(catch$matriz_captura)), 
                              c("white",'cyan','cyan','cyan','green','green','green','green', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'red', 'red','black','black','black','black'))

png("captura_espacial2.png",width = 17, height = 5, units = "in", res = 140)

nf= layout(mat = matrix(c(1,2), nrow = 1, ncol = 2), widths = c(0.9, 0.1))
layout.show(nf)

par(mar = c(5, 3.7,0.3,0))
image(catch$akima.bic, col = scale.color, ylim = c(4,18),
      xlab = "", ylab = "", axes = F)
axis(1, at = seq(0,length(catch$xLab), length.out = length(catch$labels_month)), labels = catch$labels_month, las = 2, cex.axis = 0.75)
axis(2, at = seq(lat_superior,lat_inferior,2),labels = seq(lat_inferior,lat_superior,-2), las = 2)

mtext(text = "Latitud °S)", side = 2, line = 2)
box()

require(geoR)  
par(mar = c(1,0,0,0))
plot(NA, NA, xlim = c(0,1), ylim = c(0,1), axes = FALSE, xlab = "", ylab = "")
legend.krige(x.leg = c(0.1,0.3),y.leg = c(0.2,0.9), 0:ceiling(max(catch$matriz_captura)),
             col=scale.color,  vertical=T)
text(x = 0.2, y = 0.95, labels = "Tons", cex = 0.8, font = 2)

dev.off()



PabloMBooster/fenix documentation built on Oct. 21, 2023, 8:22 p.m.