Commit b40fb5ec authored by DORAY's avatar DORAY
Browse files

sat maps update

parent 1e6b9361
......@@ -319,9 +319,9 @@ library(chron)
# 3.1. Chla ----------
#**********************
# 3.1.1. Eventually, import SSChla raster stack ------
echosonde='/run/user/1000/gvfs/smb-share:domain=ifr,server=echosonde,share=data,user=mdoray/'
donnees2='/run/user/1000/gvfs/smb-share:domain=ifr,server=nantes,share=donnees2,user=mdoray/'
path.export.grid.sat=paste(pref,'Satellite/Data/Atlantic/',sep='')
#echosonde='/run/user/1000/gvfs/smb-share:domain=ifr,server=echosonde,share=data,user=mdoray/'
#donnees2='/run/user/1000/gvfs/smb-share:domain=ifr,server=nantes,share=donnees2,user=mdoray/'
#path.export.grid.sat=paste(pref,'Satellite/Data/Atlantic/',sep='')
year=1998:2021
idi=paste('SSChla',paste(min(year),max(year),sep='-'),sep = "_")
filei2 = paste(path.export.grid.sat,'Chla/raster/',
......@@ -391,36 +391,8 @@ dim(chla.rs.aDates6d)
# correct layer names
names(chla.rb.6d)=substr(format(chla.rs.aDates6d[,2]),1,10)
# monthly averages: to be done by hand in a loop...
# lmyid=unique(chla.rs.times$myid)
# for (i in 1:length(lmyid)){
# print(lmyid[i])
# m=chla.rs.times$myid==lmyid[i]
# m <- grep(lmyid[i],chla.rs.times$myid)
# rmmi=raster::calc(chla.rb[[m]], mean,na.rm=TRUE)
# names(rmmi)=lmyid[i]
# rsdmi=raster::calc(chla.rb[[m]], sd,na.rm=TRUE)
# names(rsdmi)=lmyid[i]
# quantile90=function(x,...){quantile(x,probs=.9,na.rm=TRUE)}
# rq90mi=raster::calc(chla.rb[[m]], fun=quantile90,na.rm=TRUE)
# #plot(rq90mi)
# names(rq90mi)=lmyid[i]
# #plot(rmmi,main=lmyid[i])
# if (i==1){
# mchla.rb.yearmonth=rmmi
# sdchla.rb.yearmonth=rsdmi
# q90chla.rb.yearmonth=rq90mi
# }else{
# mchla.rb.yearmonth=stack(mchla.rb.yearmonth,rmmi)
# sdchla.rb.yearmonth=stack(sdchla.rb.yearmonth,rsdmi)
# q90chla.rb.yearmonth=stack(q90chla.rb.yearmonth,rq90mi)
# }
# }
# names(mchla.rb.yearmonth)=lmyid
# names(sdchla.rb.yearmonth)=lmyid
# names(q90chla.rb.yearmonth)=lmyid
# or easier, with stackApply:
# monthly averages:
# with stackApply:
quantile90=function(x,...){quantile(x,probs=.9,na.rm=TRUE)}
lmyid=unique(chla.rs.times$myid)
mchla.rb.yearmonth=stackApply(chla.rb,
......@@ -502,9 +474,9 @@ chla.rb.monthyear=aggregate(chla.rb,fact=c(1,1,30))
# 3.2. Create SST raster stack----------
#**********************
# 3.2.1. Eventually, import SSChla raste stack ------
echosonde='/run/user/1000/gvfs/smb-share:domain=ifr,server=echosonde,share=data,user=mdoray/'
donnees2='/run/user/1000/gvfs/smb-share:domain=ifr,server=nantes,share=donnees2,user=mdoray/'
path.export.grid.sat=paste(echosonde,'Satellite/Atlantic/',sep='')
#echosonde='/run/user/1000/gvfs/smb-share:domain=ifr,server=echosonde,share=data,user=mdoray/'
#donnees2='/run/user/1000/gvfs/smb-share:domain=ifr,server=nantes,share=donnees2,user=mdoray/'
#path.export.grid.sat=paste(echosonde,'Satellite/Atlantic/',sep='')
year=2000:2021
idi=paste('SST',paste(min(year),max(year),sep='-'),sep = "_")
filei2 = paste(path.export.grid.sat,'SST/raster/',paste('rasterStack',idi,sep='_'),'.grd',sep='')
......@@ -548,28 +520,7 @@ sst.rb.6d
# correct layer names
names(sst.rb.6d)=substr(format(sst.rs.aDates6d[,2]),1,10)
# monthly averages: to be done by hand in a loop...
#
# for (i in 1:length(lmyid)){
# print(lmyid[i])
# m=sst.rs.times$myid==lmyid[i]
# m <- grep(lmyid[i],sst.rs.times$myid)
# rmmi=raster::calc(sst.rb[[m]], mean,na.rm=TRUE)
# names(rmmi)=lmyid[i]
# rsdmi=raster::calc(sst.rb[[m]], sd,na.rm=TRUE)
# names(rsdmi)=lmyid[i]
# #plot(rmmi,main=lmyid[i])
# if (i==1){
# msst.rb.yearmonth=rmmi
# sdsst.rb.yearmonth=rsdmi
# }else{
# msst.rb.yearmonth=stack(msst.rb.yearmonth,rmmi)
# sdsst.rb.yearmonth=stack(sdsst.rb.yearmonth,rsdmi)
# }
# }
# names(msst.rb.yearmonth)=lmyid
# names(sdsst.rb.yearmonth)=lmyid
# monthly averages:
lmyid=unique(sst.rs.times$myid)
# or easier, with stackApply:
msst.rb.yearmonth=stackApply(sst.rb,indices=as.numeric(factor(sst.rs.times$myid)),fun=mean,na.rm=TRUE)
......
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