Commit 87fe8adc authored by md0276b's avatar md0276b
Browse files

grid correction to match PELGAS grid

parent 7a8c2e57
......@@ -50,18 +50,26 @@ lat=seq(36,60,length.out = 2401);length(lat)
# Default WGACEGG grid
xa1<-(-10.2); xa2<-(-1); ya1<-35.8; ya2<-48
# WGACEGG grid compatible with PELGAS grid
xa1<-(-12); xa2<-(14); ya1<-35; ya2<-61
# Define cell dimensions
ax=0.25;ay=0.25
define.grid.poly.mask(xa1,xa2,ya1,ya2,ax,ay,shelf=TRUE)
xg # grid cell centers' longitudes
yg # grid cell centers' latitudes
# 1.2. Define extended WGACEGG grid raster ----
lxae=seq(-10.7,13.3,0.25)
lyae=seq(35.8,60.3,0.25)
rae=raster(nrow=length(lyae),ncol=length(lxae),xmn=min(lxae),xmx=max(lxae),ymn=min(lyae),ymx=max(lyae))
lxae=seq(-12,14,0.25)
lyae=seq(35,61,0.25)
rae=raster(nrow=length(lyae),ncol=length(lxae),xmn=min(lxae),xmx=max(lxae),
ymn=min(lyae),ymx=max(lyae))
res(rae)=c(0.25,0.25)
rae.df=as.data.frame(rae,xy=TRUE)
sort(unique(rae.df$x))
sort(unique(rae.df$y))
# 1.3. Eventually, area of interest selection -------
x1=-12; x2=13; y1=36; y2=60
x1=-12; x2=14; y1=35; y2=61
ilon=(1:length(lon))[lon>(x1) & lon<(x2)]
jlat=(1:length(lat))[lat>y1 & lat<y2]
asp=1.2
......@@ -153,7 +161,7 @@ for (i in 1:length(year)) {
rasteri=flip(rasteri, 2)
names(rasteri)=paste(year[i],kkar,sep='-')
#plot(rasteri,main=paste('SSChla',paste(year[i],kkar,sep='-')))
# Resample to gridmaps resolution
# 2.2.1. Resample to gridmaps resolution ----
rasteri2=resample(rasteri,rae, fun='bilinear')
rasteri2m=mask(rasteri2,coastlsp,inverse=TRUE)
# par(mfrow=c(1,2))
......@@ -261,7 +269,7 @@ for (i in 1:length(year)) {
rasteri=flip(rasteri, 2)
names(rasteri)=paste(year[i],kkar,sep='-')
#plot(rasteri,main=paste('SST',paste(year[i],kkar,sep='-')))
# Resample to gridmaps resolution
# 3.1.1. Resample to gridmaps resolution ----
rasteri2=resample(rasteri,rae, fun='bilinear')
rasteri2m=mask(rasteri2,coastlsp,inverse=TRUE)
names(rasteri2m)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment