Commit 7f50e75c authored by Franssen, Wietse's avatar Franssen, Wietse
Browse files

revision4.0 complete and finisched

parent 2a09c227
......@@ -14,7 +14,7 @@ if (submitscript) {
locName <- 'X'
resolution <- 'X'
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.0/%s_%s", locName, resolution)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.3/%sdeg/%s_noBC", resolution, locName)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_noBC", resolution, locName)
} else {
members <- c(1:2)
initYears <- c(1981:1982)
......@@ -23,7 +23,7 @@ if (submitscript) {
#locName <- "EU"
resolution <- "0.75"
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.0/%s_%s", locName, resolution)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.3/%sdeg/%s_noBC", resolution, locName)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_noBC", resolution, locName)
}
mask<-Netcdf2R(inFile = sprintf("../DATA/mask/mask_wfdei_%s_%s.nc4", locName, resolution), "mask")
......
......@@ -13,8 +13,8 @@ if (submitscript) {
locName <- 'X'
resolution <- 'X'
bcInfo <- 'X'
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.3/%sdeg/%s_%s", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.3/%sdeg/%s_%s_biasformat", resolution, locName, bcInfo)
inPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s_biasformat", resolution, locName, bcInfo)
} else {
members <- c(1:2)
initYears <- c(1981:1982)
......@@ -24,8 +24,8 @@ if (submitscript) {
resolution <- "0.75"
# bcInfo <- "BC"
bcInfo <- "noBC"
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.3/%sdeg/%s_%s", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.3/%sdeg/%s_%s_biasformat2", resolution, locName, bcInfo)
inPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s_biasformat2", resolution, locName, bcInfo)
}
variables<-names(variableInfo)
......
......@@ -21,19 +21,19 @@ if (submitscript) {
locName <- 'X'
resolution <- 'X'
obsPath <- sprintf("../DATA/wfdei_rev3.0/%sdeg/%s/", resolution, locName)
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_noBC_biasformat", resolution, locName)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_BC_biasformat", resolution, locName)
inPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_noBC_biasformat", resolution, locName)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_BC_biasformat", resolution, locName)
} else {
members <- c(1:15)
initYears <- c(1981:2010)
targetMonths <- 6
targetMonths <- 1
leadMonths <- c(0:6)
locName <- "GHA"
# locName <- "EU"
resolution <- "0.75"
obsPath <- sprintf("../DATA/wfdei_rev3.0/%sdeg/%s/", resolution, locName)
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_noBC_biasformat", resolution, locName)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_BC_biasformat", resolution, locName)
inPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_noBC_biasformat", resolution, locName)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_BC_biasformat", resolution, locName)
}
variables<-names(variableInfo)
......
#!/bin/bash
tmpScripts="./tmpScripts"
#location="EU"; resolution="0.50"
location="EU"; resolution="0.50"
location="GHA"; resolution="0.50"
#location="GHA"; resolution="0.75"
......
rm(list=ls())
source(file = "./functions/functionsGeneral.R")
source(file = "./functions/functionReformat.R")
source(file = "./functions/functionR2Netcdf.R")
source(file = "./functions/functionNetcdf2R.R")
source(file = "./functions/functionConvert.R")
......@@ -15,8 +14,8 @@ if (submitscript) {
locName <- 'X'
resolution <- 'X'
bcInfo <- 'X'
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_%s_biasformat", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_%s", resolution, locName, bcInfo)
inPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s_biasformat", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s", resolution, locName, bcInfo)
} else {
members <- c(1:15)
initYears <- c(1981:2010)
......@@ -25,8 +24,8 @@ if (submitscript) {
#locName <- "EU"
resolution <- "0.75"
bcInfo <- "BC"
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_%s_biasformat", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_%s", resolution, locName, bcInfo)
inPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s_biasformat", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s", resolution, locName, bcInfo)
}
variables<-names(variableInfo)
......
#!/bin/bash
#SBATCH --account=5120867-01
#SBATCH --time=5000
#SBATCH --mem=16024
#SBATCH --mem=32024
#SBATCH --ntasks=1
#SBATCH --output=./log/log_4_doReorder_sepYears_sepMembers_combLeadmonths_<location>_<bcInfo>_<resolution>deg_initMonth<initMonth>_%j.txt
#SBATCH --job-name=Reorder
......
#!/bin/bash
tmpScripts="./tmpScripts"
#location="EU"; resolution="0.50"
location="GHA"; resolution="0.50"
#location="GHA"; resolution="0.75"
#location="GHA"; resolution="0.50"
location="GHA"; resolution="0.75"
#bcInfo="noBC"
bcInfo="BC"
......
rm(list=ls())
library(ncdf4)
source(file = "./functions/functionsGeneral.R")
source(file = "./functions/functionReformat.R")
source(file = "./functions/functionR2Netcdf.R")
source(file = "./functions/functionNetcdf2R.R")
source(file = "./functions/functionConvert.R")
......@@ -16,8 +15,8 @@ if (submitscript) {
locName <- 'X'
resolution <- 'X'
bcInfo <- 'X'
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_%s", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_%s_final", resolution, locName, bcInfo)
inPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s_final", resolution, locName, bcInfo)
} else {
members <- c(1:15)
initYears <- c(1981:2010)
......@@ -26,8 +25,8 @@ if (submitscript) {
#locName <- "EU"
resolution <- "0.75"
bcInfo <- "BC"
inPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_%s", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_%s_final", resolution, locName, bcInfo)
inPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s", resolution, locName, bcInfo)
outPath <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_%s_final", resolution, locName, bcInfo)
}
variables<-names(variableInfo)
......@@ -39,7 +38,7 @@ for (iMember in members) {
firstVar<-TRUE
for (variableName in variables) {
## OPEN NCin-Data
nameFileNCin <- sprintf("%s/%s/%s_forcing_seas15_%s_%s_E%02d_%4d_%02d.nc4",
nameFileNCin <- sprintf("%s/%s/%s_forcing_seas15_%s_%s_E%02d_INIT%4d_%02d.nc4",
inPath,
variableName,
variableName,
......@@ -67,7 +66,7 @@ for (iMember in members) {
FillValue <- 1e20
## SAVE AS NC-DATA
nameFileNCout <- sprintf("%s/forcing_seas15_%s_%s_E%02d_%4d_%02d.nc4",
nameFileNCout <- sprintf("%s/forcing_seas15_%s_%s_E%02d_INIT%4d_%02d.nc4",
outPath,
locName,
bcInfo,
......
......@@ -16,27 +16,26 @@ if (submitscript) {
locName <- 'X'
resolution <- 'X'
obsPath <- sprintf("../DATA/wfdei_rev3.0/%sdeg/%s/", resolution, locName)
inPathNoBC <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_noBC_biasformat", resolution, locName)
inPathBC <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_BC_biasformat", resolution, locName)
outPath <- sprintf("../Analysis_output/pics/checkBias_rev1.2")
inPathNoBC <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_noBC_biasformat", resolution, locName)
inPathBC <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_BC_biasformat", resolution, locName)
outPath <- sprintf("../Analysis_output/pics/checkBias_rev4.0")
} else {
members <- c(1:15)
initYears <- c(1981:2010)
targetMonths <- c(1:12)
leadMonths <- c(0:6)
locName <- "GHA"
#locName <- "EU"
resolution <- "0.75"
#locName <- "GHA"
locName <- "EU"
resolution <- "0.50"
obsPath <- sprintf("../DATA/wfdei_rev3.0/%sdeg/%s/", resolution, locName)
inPathNoBC <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_noBC_biasformat", resolution, locName)
inPathBC <- sprintf("../DATA/System4_seasonal_15_rev1.2/%sdeg/%s_BC_biasformat", resolution, locName)
outPath <- sprintf("../Analysis_output/pics/checkBias_rev1.2")
inPathNoBC <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_noBC_biasformat", resolution, locName)
inPathBC <- sprintf("../DATA/System4_seasonal_15_rev4.0/%sdeg/%s_BC_biasformat", resolution, locName)
outPath <- sprintf("../Analysis_output/pics/checkBias_rev4.0")
}
mask<-Netcdf2R(inFile = sprintf("../DATA/mask/mask_wfdei_%s_%s.nc4", locName, resolution), "mask")
variables<-names(variableInfo)
#variables<-c("pr")
dir.create(outPath, recursive = TRUE, showWarnings = FALSE)
......
#!/bin/bash
#SBATCH --account=5120867-01
#SBATCH --time=5000
#SBATCH --mem=16024
#SBATCH --mem=32024
#SBATCH --ntasks=1
#SBATCH --output=./log/log_6_biasCheck_<location>_<resolution>deg_targetMonth<targetMonth>_%j.txt
#SBATCH --job-name=check
......
......@@ -140,7 +140,7 @@ biasCorrectCell<-function(obscell, predcell, minobs, npred, nbin = 100, epsilon
# meansimbin = sumsimbin / nsimbin
diffmean = abs (mean (simcell [indvalobs]) - mean (obscell [indvalobs]))
# diffbinmax = max (abs (meansimbin - meanobsbin), na.rm = T)
if (diffmean > 0.01) {
if ((diffmean*86400) > 0.01 ) {
print (paste ("error: ", diffmean, morepred0, length(indbel0), sep = " "))
}
return(simcell)
......@@ -158,9 +158,7 @@ biasCorrect <- function(obs, pred, nbin = 100, epsilon = 0.00001) {
ntime<-dim(pred$Data)[2]
nlat<-dim(obs$Data)[2]
nlon<-dim(obs$Data)[3]
print(dim(obs_new$Data))
obs_new$Data <- array(NA, dim = c(ntime, nlat, nlon))
print(dim(obs_new$Data))
obs_new$Data[which(element==TRUE),,]<-obs$Data[]
# obs_new$Data[,10,10]
# obs$Data[,10,10]
......@@ -199,9 +197,11 @@ biasCorrect <- function(obs, pred, nbin = 100, epsilon = 0.00001) {
# Selection of all data for a single cell
obscell <- obsselmem[ ,ilat, ilon]
predcell <- aperm( predsel[ , ,ilat, ilon])
rm(nmem,nsam,ib,ie,imem,obssel)
rm(ib,ie,imem,obssel)
simcell <- biasCorrectCell(obscell, predcell, npred = npred, minobs = minobs, nbin = nbin, epsilon = epsilon)
# transpose back to the right member/timestep order
dim(simcell) <- c(nsam, nmem)
simcell<-t(simcell)
RData_BC$Data[,,ilat,ilon]<-simcell
}
}
......
Supports Markdown
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