Sys.setenv(LANG = "en")
Sys.setlocale("LC_TIME","en_GB")
library(startR)
library(s2dverification)
library(abind)
library(CSTools)
library(zeallot)
library(s2dv)
library(easyVerification)
library(ClimProjDiags)
library(ggplot2)

data0 <- readRDS("/esarchive/scratch/eduzenli/downscaling/impetus/subseasonal/catalonia/intlr/data/cerra/tasmax-intlr-4nn-tw33-lt0.RDS")

# Select the point of Barcelona
anom <- CST_Anomaly(data0$obs, data0$obs,dim_anom = 'syear',dat_dim = "dat")

# Select August 2003
aug03 <- anom$obs$data[5,1,1,1,,1,] -273.15

Lat <- data0$hcst$coords$latitude
Lon <- data0$hcst$coords$longitude

PlotEquiMap(aug03,Lon,Lat,coast_width=1.5, filled.continents = FALSE, brks = 21, bar_limits = c(-10,10), toptitle = ("blablabla"),width=10, height= 10,units = "Pa", country.borders=TRUE, bar_extra_margin = c(1, 0, 1, 0), fileout = "tas_cat_130803.png",triangle_ends = c(TRUE,TRUE),intylat=10,intxlon=10)


#ggsave("subseasonal_BCN_heatwave_tasmax_bss90.png", plot, width = 7, height = 5)

