Está en la página 1de 20

Variabilidad Climática vs Cambio Climático

Juan Diego Giraldo-Osorio

Contents
1 Preliminares 2
1.1 Programas que deben estar instalados . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Preparación de los datos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Funciones a utilizar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Lectura de los datos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4.1 Precipitación . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4.2 Temperatura . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4.3 Variables dimensionales (latitud lat, longitud lon, y tiempo time) . . . . . . . . . . . 5

2 Análisis Puntual 8
2.1 Variabilidad interanual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Ciclo anual y ENSO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Variabilidad climática VS Cambio climático . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3 Análisis Espacial 15
3.1 Precipitación . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2 Temperatura . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

1
1 Preliminares

1.1 Programas que deben estar instalados

Para la ejecución del presente tutorial, es necesario tener instalados los siguientes programas:

• Es necesario tener instalado R en el computador (https://www.r-project.org/).

Recuerde direccionar el R hacia la carpeta donde va a poner los archivos de datos.

setwd( "A/algún/directorio/de/su/preferencia" )

Las librerías a cargar son las siguientes:

library("mapproj")
library("ncdf4")
library("sp")
library("animation")

1.2 Preparación de los datos

De la página web https://www.esrl.noaa.gov/psd/data/gridded/data.UDel_AirT_Precip.html descárguense


los archivos con la última versión de la base de datos de precipitación y temperatura (i. e. a la fecha, la
versión 5).

• air.mon.mean.v501.nc contiene los datos de temperatura del aire media mensual entre entre 01/1900-
12/2017.
• precip.mon.total.v501.nc contiene los datos de profundidad mensual de precipitación entre 01/1900-
12/2017.

Háganse todas las operaciones necesarias para recortarlos:


ncks -d lat,-56.0,13.0 -d lon,278.0,326.0
air.mon.mean.v501.nc air.mon.mean.v501.SouthAmerica.nc
ncks -d lat,-56.0,13.0 -d lon,278.0,326.0
precip.mon.total.v501.nc precip.mon.total.v501.SouthAmerica.nc
Ejecútese lo siguiente desde la consola de RStudio. La función system simula la consola de comandos dentro
de R.

system( "ncdump -h air.mon.mean.v501.SouthAmerica.nc" )


system( "ncdump -h precip.mon.total.v501.SouthAmerica.nc" )

1.3 Funciones a utilizar

Las siguientes funciones son necesarias para ejecutar los comandos en este tutorial. En general, las funciones
en R se escriben en la parte superior del R-script (en caso que se vayan a guardar los comandos utilizados
en este tipo de archivos).

2
La función escalas_color construye la escala de color a aplicar en el dibujo de los mapas, además de la
leyenda a colocar con éste. La función recibe una secuencia de valores (secuencia), donde se quieren realizar
los cortes de los colores de la leyenda. Además, recibe un vector con los colores que se le quieren colocar al
mapa (ramp).

escalas_color <- function( secuencia , ramp , transparencia=127 , ndigitos=1 ) {

lengthseq = length(secuencia)
leyenda=vector(mode="character",length=lengthseq-1)
for( i in 1:(lengthseq-1) ) {
leyenda[i] = paste(
round( secuencia[i],digits=ndigitos) , round(secuencia[i+1] ,
digits=ndigitos ) ,
sep=" - ")
}
palete_fill = rgb( ramp( seq(0,1,length=lengthseq-1) ) , max = 255 , alpha=255 )
palete_trans = rgb( ramp( seq(0,1,length=lengthseq-1) ) , max = 255 , alpha=transparencia )
return( list( "secuencia"=secuencia , "leyenda"=leyenda ,
"palete_fill"=palete_fill , "palete_trans"=palete_trans ) )

La función crearestructuraespacial construye la estructura espacial con los información en formato matriz
que se le pase (datos). Recibe también como parámetros dos matrices, con las mismas dimensiones que
datos, que contienen las coordenadas x e y de cada píxel en datos.

crearestructuraespacial <- function( datos , xlon , ylat ,


proyeccion="+proj=longlat +datum=WGS84 +ellps=WGS84" ) {

toreturn = data.frame( datos=as.vector(datos) , x=as.vector(xlon) , y=as.vector(ylat) )


coordinates(toreturn)=~x+y
proj4string(toreturn) = CRS( proyeccion )
gridded(toreturn) = TRUE
return( toreturn )

La función ensoyears realiza la discriminación de los años El Niño (ensoyears = 1), años La niña (ensoyears
= 2), y los años normales (ensoyears = 2):

ensoyears <- function( tiempo_anual , strength="moderate" ) {

origin = 1949
yeari = tiempo_anual[1]
yearf = tiempo_anual[length(tiempo_anual)]

# https://ggweather.com/enso/oni.htm
# https://origin.cpc.ncep.noaa.gov/products/analysis_monitoring/ensostuff/ONI_v5.php
# Three months running mean above the threshold

weak.niño = c( 1952 , 1953 , 1958 , 1969 , 1976 , 1977 , 1979 , 2004 , 2006 , 2014 )
moderate.niño = c( 1951 , 1963 , 1968 , 1986 , 1994 , 2002 , 2009 )
strong.niño = c( 1957 , 1965 , 1972 , 1987 , 1991 )

3
super.niño = c( 1982 , 1997 , 2015 )

weak.niña = c( 1954 , 1964 , 1971 , 1974 , 1983 , 1984 , 2000 , 2005 , 2008 , 2016 , 2017 )
moderate.niña = c( 1955 , 1970 , 1995 , 2011 , 2020 )
strong.niña = c( 1973 , 1975 , 1988 , 1998 , 1999 , 2007 , 2010 )

if (strength=="weak") {
elniño.years = sort( c( weak.niño , moderate.niño , strong.niño , super.niño ) ) - origin
laniña.years = sort( c( weak.niña , moderate.niña , strong.niña , super.niña ) ) - origin
}
if (strength=="moderate") {
laniña.years = sort( c( moderate.niña , strong.niña ) ) - origin
elniño.years = sort( c( moderate.niño , strong.niño , super.niño ) ) - origin
}
if (strength=="strong") {
laniña.years = sort( c( strong.niña ) ) - origin
elniño.years = sort( c( strong.niño , super.niño ) ) - yeari + 1
}

normal.years = ((origin+1):yearf)[ -c(elniño.years,laniña.years) ] - origin

enso.years = vector( length=length(tiempo_anual) , mode="numeric" )


enso.years[elniño.years] = 1
enso.years[laniña.years] = 2
enso.years[normal.years] = 3

temp = which( (origin+1):yearf >= yeari & (origin+1):yearf <= yearf )


enso.years = enso.years[temp]

return( data.frame( years=tiempo_anual , ensoyears=enso.years ) )

Copie y pegue el texto de las funciones en la consola de RStudio. Con eso quedarán cargadas en la memoria
de R, y éste sabrá que hacer con ellas.

1.4 Lectura de los datos

1.4.1 Precipitación

La lectura de las diferentes variables dentro del archivo NetCDF (variables dimensionales lat, lon y time,
y la variable que nos interesa, que en este caso es precip) se realizará con las siguientes líneas, y luego éste
se cerrará.

file = nc_open("precip.mon.total.v501.SouthAmerica.nc")
lonmat = ncvar_get( nc=file , varid="lon" )
latmat = ncvar_get( nc=file , varid="lat" )
variable_precip = ncvar_get( nc=file , varid="precip" , start=c(1,1,1) )
time = ncvar_get( nc=file , varid="time" )
time_units = ncatt_get(file,"time",attname="units")$value
time_delta = ncatt_get(file,"time",attname="delta_t")$value
nc_close(file)

4
1.4.2 Temperatura

Lectura de los datos de temperatura (variable air). No es necesario repetir la lectura de las variables dimen-
sionales (lon, lat y time), ya que son idénticas en estructura a las leídas para el archivo de precipitación.

file = nc_open("air.mon.mean.v501.SouthAmerica.nc")
variable_temp = ncvar_get( nc=file , varid="air" , start=c(1,1,1) )
nc_close(file)

1.4.3 Variables dimensionales (latitud lat, longitud lon, y tiempo time)

Las siguientes líneas realizarán un tratamiento adicional a las variables dimensionales. Las siguientes líneas
muestran el estado actual de las diferentes variables, luego de la lectura desde los archivos:

if( unlist(strsplit(time_units," "))[1]=="seconds" ) time = time/(24*86400)


if( unlist(strsplit(time_units," "))[1]=="hours" ) time = time/24
if( unlist(strsplit(time_units," "))[1]=="days") time = time
time_origin = as.Date( unlist(strsplit(time_units," "))[3] )
time_vector = time_origin + time
dim(variable_precip)

## [1] 96 138 1416

dim(variable_temp)

## [1] 96 138 1416

head(time_vector)

## [1] "1900-01-01" "1900-02-01" "1900-03-01" "1900-04-01" "1900-05-01"


## [6] "1900-06-01"

tail(time_vector)

## [1] "2017-07-01" "2017-08-01" "2017-09-01" "2017-10-01" "2017-11-01"


## [6] "2017-12-01"

Con las siguientes líneas, se realizará una selección de los mapas mensuales de precipitación y temperatura
posteriores a 1950/01 (inclusive):

tiempo_anual = seq( as.Date( "1950-01-01" ) , as.Date( "2017-12-31" ) , by="1 year" )


cuales = which( time_vector >= as.Date("1950-01-01") )
time_vector = time_vector[cuales]
variable_precip = variable_precip[,,cuales]
dim(variable_precip)

## [1] 96 138 816

5
variable_temp = variable_temp[,,cuales]
dim(variable_precip)

## [1] 96 138 816

head(time_vector)

## [1] "1950-01-01" "1950-02-01" "1950-03-01" "1950-04-01" "1950-05-01"


## [6] "1950-06-01"

tail(time_vector)

## [1] "2017-07-01" "2017-08-01" "2017-09-01" "2017-10-01" "2017-11-01"


## [6] "2017-12-01"

El vector lonmat guarda la lectura de la longitud geográfica (variable lon) de los diferentes píxeles. Sin
embargo, este valor está en [0, 360], por lo que debe ser modificado para que quede en [−180, 180], que son
los valores utilizados por la mayoría de los Sistemas de Información Geográfica (SIG) para representar las
coordenadas geográficas.

lonmat

## [1] 278.25 278.75 279.25 279.75 280.25 280.75 281.25 281.75 282.25 282.75
## [11] 283.25 283.75 284.25 284.75 285.25 285.75 286.25 286.75 287.25 287.75
## [21] 288.25 288.75 289.25 289.75 290.25 290.75 291.25 291.75 292.25 292.75
## [31] 293.25 293.75 294.25 294.75 295.25 295.75 296.25 296.75 297.25 297.75
## [41] 298.25 298.75 299.25 299.75 300.25 300.75 301.25 301.75 302.25 302.75
## [51] 303.25 303.75 304.25 304.75 305.25 305.75 306.25 306.75 307.25 307.75
## [61] 308.25 308.75 309.25 309.75 310.25 310.75 311.25 311.75 312.25 312.75
## [71] 313.25 313.75 314.25 314.75 315.25 315.75 316.25 316.75 317.25 317.75
## [81] 318.25 318.75 319.25 319.75 320.25 320.75 321.25 321.75 322.25 322.75
## [91] 323.25 323.75 324.25 324.75 325.25 325.75

lonmat[which(lonmat>180)] = lonmat[which(lonmat>180)]-360
lonmat

## [1] -81.75 -81.25 -80.75 -80.25 -79.75 -79.25 -78.75 -78.25 -77.75 -77.25
## [11] -76.75 -76.25 -75.75 -75.25 -74.75 -74.25 -73.75 -73.25 -72.75 -72.25
## [21] -71.75 -71.25 -70.75 -70.25 -69.75 -69.25 -68.75 -68.25 -67.75 -67.25
## [31] -66.75 -66.25 -65.75 -65.25 -64.75 -64.25 -63.75 -63.25 -62.75 -62.25
## [41] -61.75 -61.25 -60.75 -60.25 -59.75 -59.25 -58.75 -58.25 -57.75 -57.25
## [51] -56.75 -56.25 -55.75 -55.25 -54.75 -54.25 -53.75 -53.25 -52.75 -52.25
## [61] -51.75 -51.25 -50.75 -50.25 -49.75 -49.25 -48.75 -48.25 -47.75 -47.25
## [71] -46.75 -46.25 -45.75 -45.25 -44.75 -44.25 -43.75 -43.25 -42.75 -42.25
## [81] -41.75 -41.25 -40.75 -40.25 -39.75 -39.25 -38.75 -38.25 -37.75 -37.25
## [91] -36.75 -36.25 -35.75 -35.25 -34.75 -34.25

Las siguientes líneas construyen, además, las matrices que deben entrar a la función crearestructuraespacial
para crear las estructuras espaciales. Recuérdese que estas matrices comparten las dimensiones espaciales
de la variable hidrometeorológica leída (i. e. precipitación y/o temperatura).

6
xx = as.vector(lonmat) %*% t(as.vector(rep(1,length(latmat))))
yy = as.vector(latmat) %*% t(as.vector(rep(1,length(lonmat))))
yy = t(yy)
dim(xx)

## [1] 96 138

dim(yy)

## [1] 96 138

7
2 Análisis Puntual
Discriminación de años normales (NOR), años El Niño (NOY), y años La Niña (NAY):

enso.years = ensoyears( 1950:2017 )$ensoyears


elniño.years = which(enso.years == 1)
laniña.years = which(enso.years == 2)
normal.years = which(enso.years == 3)

2.1 Variabilidad interanual

Selección de un punto sobre el dominio de los mapas para dibujar las series temporales de las variables. En la
siguiente lista están las coordenadas de las capitales suramericanas (aunque se podría seleccionar cualquier
punto de interés). Para seleccionar un punto en particular, cópiese la línea sin el # del inicio de la misma.

# coordinates = c( "57-38-00-W" , "25-18-00-S" ) # Asunción


# coordinates = c( "74-04-14-W" , "04-36-46-N" ) # Bogotá
# coordinates = c( "47-52-05-W" , "15-47-38-S" ) # Brasilia
# coordinates = c( "58-22-55-W" , "34-35-59-S" ) # Buenos Aires
# coordinates = c( "66-56-00-W" , "09-59-00-S" ) # Caracas
# coordinates = c( "68-08-00-W" , "16-29-44-S" ) # La Paz
# coordinates = c( "76-59-00-W" , "12-03-00-S" ) # Lima
# coordinates = c( "56-10-00-W" , "34-52-00-S" ) # Montevideo
# coordinates = c( "78-30-35-W" , "00-13-07-S" ) # Quito
# coordinates = c( "70-40-00-W" , "33-27-00-S" ) # Santiago

x_lon = unlist( strsplit(coordinates[1],"-") )


if( x_lon[4]=="E" ) x_latlon = +( as.numeric(x_lon[1]) +
as.numeric(x_lon[2])/60 +
as.numeric(x_lon[3])/3600 )
if( x_lon[4]=="W" ) x_latlon = -( as.numeric(x_lon[1]) +
as.numeric(x_lon[2])/60 +
as.numeric(x_lon[3])/3600 )
y_lat = unlist( strsplit(coordinates[2],"-") )
if( y_lat[4]=="N" ) y_latlon = +( as.numeric(y_lat[1]) +
as.numeric(y_lat[2])/60 +
as.numeric(y_lat[3])/3600 )
if( y_lat[4]=="S" ) y_latlon = -( as.numeric(y_lat[1]) +
as.numeric(y_lat[2])/60 +
as.numeric(y_lat[3])/3600 )

x_pix = floor( x_latlon - (-82) ) / 0.5 + 1


y_pix = floor( 13 - y_latlon ) / 0.5 + 1

Una vez seleccionado el punto, las siguientes líneas extraen las series temporales de precipitación y temper-
atura de la base de datos (a nivel mensual), y se agregan a nivel anual:

ts_precip = ts( as.vector( variable_precip[ x_pix , y_pix ,] ) ,


start = as.numeric( c(substr(time_vector[1],1,4), substr(time_vector[1],6,7)) ) ,
frequency = 12 )
ts_precip_yearly = 12*aggregate.ts( ts_precip , nfrecuency=1 , FUN=mean )
ts_temp = ts( as.vector( variable_temp[ x_pix , y_pix ,] ) ,

8
start = as.numeric( c(substr(time_vector[1],1,4), substr(time_vector[1],6,7)) ) ,
frequency = 12 )
ts_temp_yearly = aggregate.ts( ts_temp , nfrequency=1 , FUN=mean )

layout( matrix( c( rep(1,4) , rep(2,4) ), 2 , 4 , byrow=TRUE) )


plot( ts_precip , xlab="Time" , ylab="P [cm/month]" )
plot( ts_temp , xlab="Time" , ylab="T [°C]" )
40
P [cm/month]

30
20
10
0

1950 1960 1970 1980 1990 2000 2010 2020

Time
24 25 26 27 28
T [°C]

1950 1960 1970 1980 1990 2000 2010 2020

Time

layout( matrix( c( rep(1,3) , c(2,2) , rep(3,3) , c(4,4) ) , 2 , 5 , byrow=TRUE) )


plot( tiempo_anual , ts_precip_yearly , xlab="Time" , ylab="P [cm/year]" ,
type="l" , lty=2 )
points( tiempo_anual[laniña.years] , ts_precip_yearly[laniña.years] ,
pch=20 , col="blue" , cex=1 )
points( tiempo_anual[elniño.years] , ts_precip_yearly[elniño.years] ,
pch=20 , col="red" , cex=1 )
points( tiempo_anual[normal.years] , ts_precip_yearly[normal.years] ,
pch=20 , col="black" , cex=1 )
legend( "bottomleft" , legend=c("Normal year","El Niño year","La Niña year") ,
col=c("black","red","blue") , lty=c(NA,NA,NA) , pch=c(20,20,20) ,
lw=c(NA,NA,NA) , cex=0.5 )
datos = data.frame( variable=ts_precip_yearly , enso=enso.years )
boxplot( variable~enso , datos , xaxt="n" , ylab="P [cm/year]" )
axis( 1 , 1:3 , c("El Niño","La Niña","Normal") )

plot( tiempo_anual , ts_temp_yearly , xlab="Time" , ylab="T [°C]" ,

9
type="l" , lty=2 )
points( tiempo_anual[laniña.years] , ts_temp_yearly[laniña.years] ,
pch=20 , col="blue" , cex=1 )
points( tiempo_anual[elniño.years] , ts_temp_yearly[elniño.years] ,
pch=20 , col="red" , cex=1 )
points( tiempo_anual[normal.years] , ts_temp_yearly[normal.years] ,
pch=20 , col="black" , cex=1 )
legend( "bottomleft" , legend=c("Normal year","El Niño year","La Niña year") ,
col=c("black","red","blue") , lty=c(NA,NA,NA) , pch=c(20,20,20) ,
lw=c(NA,NA,NA) , cex=0.5 )
datos = data.frame( variable=ts_temp_yearly , enso=enso.years )
boxplot( variable~enso , datos , xaxt="n" , ylab="T [°C]" )
axis( 1 , 1:3 , c("El Niño","La Niña","Normal") )
220

220
P [cm/year]

P [cm/year]
180

180
140

140
Normal year
El Niño year
100

100
La Niña year

1960 1980 2000 El Niño La Niña Normal

Time enso
27.0

27.0
T [°C]

T [°C]
26.0

26.0

Normal year
El Niño year
25.0

25.0

La Niña year

1960 1980 2000 El Niño La Niña Normal

Time enso

2.2 Ciclo anual y ENSO

Las siguientes líneas construyen el ciclo anual de las variables precipitación y temperatura, utilizando los
promedios mensuales multianuales. Para observar las afectaciones en las variables del ciclo del ENSO, se
discrimina entre años calificados como El Niño, La Niña y normales.

layout( matrix( c( rep(1,1) , rep(2,1) ) , 1 , 2 , byrow=TRUE) )

# Precipitacion
ts_precip2 = matrix( ts_precip , ncol=12 , byrow=TRUE )

10
ciclo_anual_precip = list( noy=apply( ts_precip2[elniño.years,] , 2 , mean ) ,
nay=apply( ts_precip2[laniña.years,] , 2 , mean ) ,
nor=apply( ts_precip2[normal.years,] , 2 , mean ) )
minimorum = min( unlist(ciclo_anual_precip) )
maximorum = max( unlist(ciclo_anual_precip) )

par( fig=c(0.00,0.53,0.0,1.0) , new=FALSE )


plot( c(1,12) , c(minimorum,maximorum) ,
xaxt="n" , ann=TRUE , type="n" ,
xlab="Month" , ylab="P [cm/month]" )
axis( 1 , 1:12 , c("J","F","M","A","M","J","J","A","S","O","N","D") )
lines( 1:12 , ciclo_anual_precip[[1]] , col="red" )
lines( 1:12 , ciclo_anual_precip[[2]] , col="blue" )
lines( 1:12 , ciclo_anual_precip[[3]] , col="black" )

# Temperatura
ts_temp2 = matrix( ts_temp , ncol=12 , byrow=TRUE )
ciclo_anual_temp = list( noy=apply( ts_temp2[elniño.years,] , 2 , mean ) ,
nay=apply( ts_temp2[laniña.years,] , 2 , mean ) ,
nor=apply( ts_temp2[normal.years,] , 2 , mean ) )
minimorum = min( unlist(ciclo_anual_temp) )
maximorum = max( unlist(ciclo_anual_temp) )

par( fig=c(0.37,0.90,0.0,1.0) , new=TRUE )


plot( c(1,12) , c(minimorum,maximorum) ,
xaxt="n" , yaxt="n" , ann=TRUE , type="n" ,
xlab="Month" , ylab="" )
axis( 1 , 1:12 , c("J","F","M","A","M","J","J","A","S","O","N","D") )
lines( 1:12 , ciclo_anual_temp[[1]] , col="red" )
lines( 1:12 , ciclo_anual_temp[[2]] , col="blue" )
lines( 1:12 , ciclo_anual_temp[[3]] , col="black" )
axis( 4 , at=NULL )
mtext( "T [°C]" , side=4 , line=3 )

11
25

27.0
26.5
20
P [cm/month]

26.0

T [°C]
15

25.5
10

25.0
5

J M M J S N J M M J S N

Month Month

2.3 Variabilidad climática VS Cambio climático

Se seleccionarán dos periodos para comparar el cambio de largo plazo de las variables, con el cambio debido
a variabilidad interanual debido al ciclo del ENSO.

periodo1 = 1950:1979 - 1949


periodo2 = 1988:2017 - 1949
periodo3 = (1950:2017)[ -c(periodo1,periodo2) ] - 1949
periodos.years = vector( length=length(tiempo_anual) , mode="numeric" )
periodos.years[periodo1] = 1
periodos.years[periodo2] = 2
periodos.years[periodo3] = NA

# Precipitación
layout( matrix( c( rep(1,1) , rep(2,1) ) , 1 , 2 , byrow=TRUE) )
datos = data.frame( variable=ts_precip_yearly , periodos=periodos.years )
boxplot( variable~periodos , datos , xaxt="n" , ylab="P [cm/year]" )
axis( 1 , 1:2 , c("1950-1979","1988-2017") )

datos = data.frame( variable=ts_precip_yearly , enso=enso.years )


boxplot( variable~enso , datos , xaxt="n" , ylab="P [cm/year]" )
axis( 1 , 1:3 , c("El Niño","La Niña","Normal") )

12
220

220
180

180
P [cm/year]

P [cm/year]
140

140
100

1950−1979 100 El Niño Normal

periodos enso

# Temperatura
layout( matrix( c( rep(1,1) , rep(2,1) ) , 1 , 2 , byrow=TRUE) )
datos = data.frame( variable=ts_temp_yearly , periodos=periodos.years )
boxplot( variable~periodos , datos , xaxt="n" , ylab="T [°C]" )
axis( 1 , 1:2 , c("1950-1979","1988-2017") )

datos = data.frame( variable=ts_temp_yearly , enso=enso.years )


boxplot( variable~enso , datos , xaxt="n" , ylab="T [°C]" )
axis( 1 , 1:3 , c("El Niño","La Niña","Normal") )

13
T [°C]

25.0 25.5 26.0 26.5 27.0

1950−1979

periodos

14
T [°C]

El Niño 25.0 25.5 26.0 26.5 27.0

enso
Normal
3 Análisis Espacial
Construcción de la estructura gridlimites:

xlim = c( -82 , -34 )


ylim = c( -56 , 13 )
gridlimites = data.frame( x=xlim , y=ylim )
coordinates(gridlimites)=~x+y
proj4string(gridlimites) = CRS("+proj=longlat +datum=WGS84 +ellps=WGS84")
gridded(gridlimites) = TRUE

Las siguientes líneas construyen los mapas anuales:

variable_precip_yearly = variable_temp_yearly =
array( data=NA , dim=c(dim(variable_precip)[1],dim(variable_precip)[2],length(tiempo_anual)) )
for( i in 1:length(tiempo_anual) ) {
variable_precip_yearly[,,i] = apply( variable_precip[,,(i-1)*12+1:12] , c(1,2) , sum )
variable_temp_yearly[,,i] = apply( variable_temp[,,(i-1)*12+1:12] , c(1,2) , mean )
}

3.1 Precipitación

Cálculo de los promedios anuales multianuales de la precipitación, discriminando por años El Niño, La Niña
y normales:

change.precip = list( noy = apply( variable_precip_yearly[,,elniño.years] , c(1,2) , mean ) ,


nay = apply( variable_precip_yearly[,,laniña.years] , c(1,2) , mean ) ,
nor = apply( variable_precip_yearly[,,normal.years] , c(1,2) , mean ) ,
per1 = apply( variable_precip_yearly[,,periodo1] , c(1,2) , mean ) ,
per2 = apply( variable_precip_yearly[,,periodo2] , c(1,2) , mean ) )
noyvsnor.precip = 100 * ( change.precip$noy - change.precip$nor ) / change.precip$nor
nayvsnor.precip = 100 * ( change.precip$nay - change.precip$nor ) / change.precip$nor
change.precip = 100 * ( change.precip$per2 - change.precip$per1 ) / change.precip$per1

Distribución del desvío de la precipitación promedio multianual anual en Suramérica debido al ciclo del
fenómeno ENSO:

summary( as.vector(noyvsnor.precip) )

## Min. 1st Qu. Median Mean 3rd Qu. Max. NA’s


## -34.839 -5.013 -1.360 -0.500 2.895 79.059 7065

summary( as.vector(nayvsnor.precip) )

## Min. 1st Qu. Median Mean 3rd Qu. Max. NA’s


## -50.973 -5.764 -1.393 -1.664 2.760 64.564 7065

Distribución del cambio de la precipitación promedio multianual anual en Suramérica debido a la tendencia
de largo plazo (tomando el periodo 1950-1979 como referencia):

15
summary( as.vector(change.precip) )

## Min. 1st Qu. Median Mean 3rd Qu. Max. NA’s


## -60.111 -4.069 -0.163 1.298 4.966 255.752 7065

secuencia = c( seq(5,20,5) , seq(40,100,20) , 1000 )


secuencia = c( -rev(secuencia) , secuencia )
ramp = colorRamp( c("red","orange","yellow","white","cyan","blue","purple") )
precip.change.colores = escalas_color( secuencia , ramp )

layout( matrix( 1:4 , 2 , 2 , byrow=TRUE) )

mapa = crearestructuraespacial( noyvsnor.precip , xlon=xx , ylat=yy )


plot( gridlimites ,col="white" , xlim=xlim , ylim=ylim ,
axes=T , pch=NULL , asp=1 , xlab="" , ylab="" ,
main="El Niño vs Normal" , cex=0.5 )
image( mapa , col=precip.change.colores$palete_fill ,
breaks=precip.change.colores$secuencia , add=TRUE )
map(add=TRUE,interior=TRUE)
box(which="plot",lwd=2)
grid()

mapa = crearestructuraespacial( nayvsnor.precip , xlon=xx , ylat=yy )


plot( gridlimites ,col="white" , xlim=xlim , ylim=ylim ,
axes=T , pch=NULL , asp=1 , xlab="" , ylab="" ,
main="La Niña vs Normal" , cex=0.5 )
image( mapa , col=precip.change.colores$palete_fill ,
breaks=precip.change.colores$secuencia , add=TRUE )
map(add=TRUE,interior=TRUE)
box(which="plot",lwd=2)
grid()

mapa = crearestructuraespacial( change.precip , xlon=xx , ylat=yy )


plot( gridlimites ,col="white" , xlim=xlim , ylim=ylim ,
axes=T , pch=NULL , asp=1 , xlab="" , ylab="" ,
main="Cambios de largo plazo" , cex=0.5 )
image( mapa , col=precip.change.colores$palete_fill ,
breaks=precip.change.colores$secuencia , add=TRUE )
map(add=TRUE,interior=TRUE)
box(which="plot",lwd=2)
grid()

plot( c(0,1) , c(0,1) , xaxt="n" , yaxt="n" , type="n" , axes=FALSE , ann=FALSE )


legend( "bottomright" , legend=precip.change.colores$leyenda ,
fill=precip.change.colores$palete_fill , cex=1.0 , title="DP [%]" )

16

El Niño vs Normal La Niña vs Normal


20°S

20°S
40°S

40°S
60°S

60°S

80°W 70°W 60°W 50°W 40°W 80°W 70°W 60°W 50°W 40°W

Cambios de largo plazo


DP [%]
−1000 − −100
−100 − −80
−80 − −60
20°S

−60 − −40
−40 − −20
−20 − −15
−15 − −10
−10 − −5
−5 − 5
5 − 10
40°S

10 − 15
15 − 20
20 − 40
40 − 60
60 − 80
80 − 100
100 − 1000
60°S

80°W 70°W 60°W 50°W 40°W

17
3.2 Temperatura

change.temp = list( noy = apply( variable_temp_yearly[,,elniño.years] , c(1,2) , mean ) ,


nay = apply( variable_temp_yearly[,,laniña.years] , c(1,2) , mean ) ,
nor = apply( variable_temp_yearly[,,normal.years] , c(1,2) , mean ) ,
per1 = apply( variable_temp_yearly[,,periodo1] , c(1,2) , mean ) ,
per2 = apply( variable_temp_yearly[,,periodo2] , c(1,2) , mean ) )
noyvsnor.temp = change.temp$noy - change.temp$nor
nayvsnor.temp = change.temp$nay - change.temp$nor
change.temp = change.temp$per2 - change.temp$per1

Distribución del desvío de la temperatura promedio multianual anual en Suramérica debido al ciclo del
fenómeno ENSO:

summary( as.vector(noyvsnor.temp) )

## Min. 1st Qu. Median Mean 3rd Qu. Max. NA’s


## -0.492 0.025 0.114 0.121 0.217 0.838 7065

summary( as.vector(nayvsnor.temp) )

## Min. 1st Qu. Median Mean 3rd Qu. Max. NA’s


## -0.881 -0.043 0.104 0.093 0.222 0.887 7065

Distribución del cambio de la temperatura promedio multianual anual en Suramérica debido a la tendencia
de largo plazo (tomando el periodo 1950-1979 como referencia):

summary( as.vector(change.temp) )

## Min. 1st Qu. Median Mean 3rd Qu. Max. NA’s


## -0.981 0.202 0.403 0.428 0.656 2.083 7065

secuencia = c( seq(0.1,0.9,0.2) , seq(1.2,2.1,0.3) )


secuencia = c( -rev(secuencia) , secuencia )
ramp = colorRamp( rev(c("red","orange","yellow","white","cyan","blue","purple")) )
temp.change.colores = escalas_color( secuencia , ramp )

layout( matrix( 1:4 , 2 , 2 , byrow=TRUE) )

mapa = crearestructuraespacial( noyvsnor.temp , xlon=xx , ylat=yy )


plot( gridlimites ,col="white" , xlim=xlim , ylim=ylim ,
axes=T , pch=NULL , asp=1 , xlab="" , ylab="" ,
main="El Niño vs Normal" , cex=0.5 )
image( mapa , col=temp.change.colores$palete_fill ,
breaks=temp.change.colores$secuencia , add=TRUE )
map(add=TRUE,interior=TRUE)
box(which="plot",lwd=2)
grid()

mapa = crearestructuraespacial( nayvsnor.temp , xlon=xx , ylat=yy )

18
plot( gridlimites ,col="white" , xlim=xlim , ylim=ylim ,
axes=T , pch=NULL , asp=1 , xlab="" , ylab="" ,
main="La Niña vs Normal" , cex=0.5 )
image( mapa , col=temp.change.colores$palete_fill ,
breaks=temp.change.colores$secuencia , add=TRUE )
map(add=TRUE,interior=TRUE)
box(which="plot",lwd=2)
grid()

mapa = crearestructuraespacial( change.temp , xlon=xx , ylat=yy )


plot( gridlimites ,col="white" , xlim=xlim , ylim=ylim ,
axes=T , pch=NULL , asp=1 , xlab="" , ylab="" ,
main="Cambios de largo plazo" , cex=0.5 )
image( mapa , col=temp.change.colores$palete_fill ,
breaks=temp.change.colores$secuencia , add=TRUE )
map(add=TRUE,interior=TRUE)
box(which="plot",lwd=2)
grid()

plot( c(0,1) , c(0,1) , xaxt="n" , yaxt="n" , type="n" , axes=FALSE , ann=FALSE )


legend( "bottomright" , legend=temp.change.colores$leyenda ,
fill=temp.change.colores$palete_fill , cex=1.0 , title="DT [°C]" )

19

El Niño vs Normal La Niña vs Normal


20°S

20°S
40°S

40°S
60°S

60°S

80°W 70°W 60°W 50°W 40°W 80°W 70°W 60°W 50°W 40°W

Cambios de largo plazo


DT [°C]
−2.1 − −1.8
−1.8 − −1.5
−1.5 − −1.2
20°S

−1.2 − −0.9
−0.9 − −0.7
−0.7 − −0.5
−0.5 − −0.3
−0.3 − −0.1
−0.1 − 0.1
0.1 − 0.3
40°S

0.3 − 0.5
0.5 − 0.7
0.7 − 0.9
0.9 − 1.2
1.2 − 1.5
1.5 − 1.8
1.8 − 2.1
60°S

80°W 70°W 60°W 50°W 40°W

20

También podría gustarte