Commit 1c89791a authored by Franssen, Wietse's avatar Franssen, Wietse
Browse files

improved step 5 and 6

parent e549609d
......@@ -61,19 +61,18 @@ for (variableName in variables) {
obsPath, variableName, locName,
initYears[1], initYears[length(initYears)],
targetMonth)
# RData_obs <- Netcdf2R(obsFile, variableName)
# RData_obs <- convert(RData_obs, toUnit = "mm day-1")
} else {
obsFile <- sprintf("%s/%s_wfdei_%s_%4d-%4d_%02d.nc4",
obsPath, variableName, locName,
initYears[1], initYears[length(initYears)],
targetMonth)
# RData_obs <- Netcdf2R(obsFile, variableName)
# RData_obs <- convert(RData_obs, toUnit = variableInfo[[variableName]]$units)
}
RData_obs <- Netcdf2R(obsFile, variableName)
RData_obs <- convert(RData_obs, toUnit = variableInfo[[variableName]]$units)
# print(sprintf("Open: %s", obsFile))
# load(obsFile)
# RData_obs<-RData
# rm(RData)
## Make uniform and match the selections
dates1<-as.character(as.POSIXct(RData_obs$Dates$start, tz = "GMT"))
......@@ -87,7 +86,10 @@ for (variableName in variables) {
if (variableName == "pr") {
## Correction: PRECIP
print(sprintf("Bias correction..."))
# print(sprintf("Convert precip first to [mm day-1]..."))
# RData_noBC <- convert(RData_noBC, toUnit = "mm day-1")
RData <- biasCorrect(RData_obs, RData_noBC, nbin = 100, epsilon = 0.00001)
# RData <- convert(RData, toUnit = variableInfo[[variableName]]$units)
} else {
## Correction: other variables
print(sprintf("Bias correction..."))
......
#!/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"
......
......@@ -10,30 +10,27 @@ source(file = "./functions/infoGeneral.R")
submitscript <- FALSE
if (submitscript) {
members <- c(1:15)
initYears <-c(1981:2010)
initMonths <- c(X:X)
locName <- 'X'
resolution<-"0.50"
# bcInfo<-"BC"
bcInfo<-"noBC"
inPath<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_%s_modelFormat_perVariable", resolution, locName, bcInfo)
outPath<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_%s_modelFormat_complete", resolution, locName, bcInfo)
members <- c(1:15)
initYears <- c(1981:2010)
initMonths <- c(X:X)
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)
} else {
members <-c(1:15)
initYears <-c(1981:2010)
initMonths<-c(1:12)
#locName<-"GHA"
locName<-"EU"
resolution<-"0.50"
# bcInfo<-"BC"
bcInfo<-"noBC"
inPath<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_%s_modelFormat_perVariable", resolution, locName, bcInfo)
outPath<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_%s_modelFormat_complete", resolution, locName, bcInfo)
members <- c(1:15)
initYears <- c(1981:2010)
initMonths <- c(1:12)
locName <- "GHA"
#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)
}
variables<-c( "pr", "psl", "rsds", "rlds", "tas", "tasmin", "tasmax", "huss", "sfcWind")
variables<-c( "pr", "rsds", "rlds", "tas", "tasmin", "tasmax", "huss", "sfcWind")
variables<-names(variableInfo)
dir.create(outPath, recursive = TRUE, showWarnings = FALSE)
for (iMember in members) {
......@@ -42,9 +39,10 @@ for (iMember in members) {
firstVar<-TRUE
for (variableName in variables) {
## OPEN NCin-Data
nameFileNCin <- sprintf("%s/%s_forcing_seas15_%s_%s_E%02d_%4d_%02d.nc4",
nameFileNCin <- sprintf("%s/%s/%s_forcing_seas15_%s_%s_E%02d_%4d_%02d.nc4",
inPath,
variableName,
variableName,
locName,
bcInfo,
iMember,
......@@ -113,7 +111,6 @@ for (iMember in members) {
ncatt_put( ncid_out, variableName, "_FillValue", FillValue)
firstVar<-FALSE
}
nc_close(ncid_out)
} ## end initMonth
......
......@@ -3,7 +3,7 @@
#SBATCH --time=5000
#SBATCH --mem=4024
#SBATCH --ntasks=1
#SBATCH --output=./log/log_doNetcdfCombine_<location>_initMonth<initMonth>_%j.txt
#SBATCH --output=./log/log_5_doNetcdfCombine_<location>_<bcInfo>_<resolution>deg_initMonth<initMonth>_%j.txt
#SBATCH --job-name=Combine
#SBATCH --partition=ESG_Std
#SBATCH --mail-type=FAIL
......@@ -17,6 +17,6 @@ module load R/3.2.0
#
# run current job
echo '******** start Rscript...'
Rscript ./tmpScripts/doNetcdfCombine_<location>_initMonth<initMonth>.R
Rscript ./tmpScripts/5_doNetcdfCombine_<location>_<bcInfo>_<resolution>deg_initMonth<initMonth>.R
date
#!/bin/bash
tmpScripts="./tmpScripts"
#location="GHA"
location="EU"
location="EU"; resolution="0.50"
#location="GHA"; resolution="0.50"
#location="GHA"; resolution="0.75"
#bcInfo="noBC"
bcInfo="BC"
mkdir -p $tmpScripts
for iInitMonth in $(seq -f "%02g" 1 12); do
echo "leadMonth: $iInitMonth"
sed -e "s|<initMonth>|$iInitMonth|g" \
-e "s|<location>|$location|g" \
jobScriptNetcdfCombine > $tmpScripts"/jobScriptNetcdfCombine_"$location"_initMonth"$iInitMonth
-e "s|<resolution>|$resolution|g" \
-e "s|<bcInfo>|$bcInfo|g" \
5_jobScriptNetcdfCombine > $tmpScripts"/5_jobScriptNetcdfCombine_"$location"_"$bcInfo"_"$resolution"deg_initMonth"$iInitMonth
sed -e "s|submitscript <- FALSE|submitscript <- TRUE|g" \
-e "s|initMonths <- c(X:X)|initMonths <- c($iInitMonth:$iInitMonth)|g" \
-e "s|locName <- 'X'|locName <- '$location'|g" \
doNetcdfCombine.R > $tmpScripts"/doNetcdfCombine_"$location"_initMonth"$iInitMonth".R"
sbatch "$tmpScripts/jobScriptNetcdfCombine_"$location"_initMonth"$iInitMonth
-e "s|initMonths <- c(X:X)|initMonths <- c($iInitMonth:$iInitMonth)|g" \
-e "s|locName <- 'X'|locName <- '$location'|g" \
-e "s|resolution <- 'X'|resolution <- '$resolution'|g" \
-e "s|bcInfo <- 'X'|bcInfo <- '$bcInfo'|g" \
5_doNetcdfCombine.R > $tmpScripts"/5_doNetcdfCombine_"$location"_"$bcInfo"_"$resolution"deg_initMonth"$iInitMonth".R"
sbatch "$tmpScripts/5_jobScriptNetcdfCombine_"$location"_"$bcInfo"_"$resolution"deg_initMonth"$iInitMonth
done
rm(list=ls())
library(WFRTools)
source(file = "./functions/infoGeneral.R")
source(file = "./functions/functionsGeneral.R")
source(file = "./functions/functionNetcdf2R.R")
source(file = "./functions/functionConvert.R")
source(file = "./functions/functionMakeSelection.R")
submitscript <- FALSE
if (submitscript) {
members <- c(1:15)
initYears <-c(1981:2010)
targetMonths <- c(X:X)
leadMonths<-c(0:6)
locName <- 'X'
resolution<-"0.50"
inPathNoBC<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_noBC", resolution, locName)
inPathBC<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_BC", resolution, locName)
outPath<-"../Analysis_output/pics/checkBias_rev1.1_otherVars"
members <- c(1:15)
initYears <- c(1981:2010)
targetMonths <- c(X:X)
leadMonths <- c(0:6)
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")
} else {
members <-c(1:15)
initYears <-c(1981:2010)
targetMonths<-c(1:12)
leadMonths<-c(0:6)
#locName<-"GHA"
locName<-"EU"
resolution<-"0.50"
inPathNoBC<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_noBC", resolution, locName)
inPathBC<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_BC", resolution, locName)
outPath<-"../Analysis_output/pics/checkBias_rev1.1_otherVars"
members <- c(1:15)
initYears <- c(1981:2010)
targetMonths <- c(1:12)
leadMonths <- c(0:6)
locName <- "GHA"
#locName <- "EU"
resolution <- "0.75"
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")
}
variables<-names(variableInfo)
variables<-c( "pr" , "psl" , "rsds" , "rlds" , "tasmin","tasmax", "huss" , "sfcWind")
variables<-c("sfcWind")
#variables<-c("pr")
dir.create(outPath, recursive = TRUE, showWarnings = FALSE)
......@@ -42,94 +44,95 @@ for (variableName in variables) {
for (leadMonth in leadMonths) {
targetSYear <- getInitTargetInfo( initYear = initYears[1], targetMonth = targetMonth, leadMonth = leadMonth )$targetYear
targetEYear <- getInitTargetInfo( initYear = initYears[length(initYears)], targetMonth = targetMonth, leadMonth = leadMonth )$targetYear
######## OPEN FILES #####################
noBCFile <- sprintf("%s/%s_forcing_seas15_%s_noBC_E%02d-%02d_TAR%4d-%4d_%02d_LM%d.RData",
noBCFile <- sprintf("%s/%s_forcing_seas15_%s_noBC_E%02d-%02d_TAR%4d-%4d_%02d_LM%d.nc4",
inPathNoBC, variableName, locName,
members[1], members[length(members)],
targetSYear, targetEYear,
targetMonth, leadMonth)
RData_noBC <- Netcdf2R(noBCFile, variableName)
print(sprintf("Open: %s", noBCFile))
load(noBCFile)
RData_noBC<-RData
rm(RData)
BCFile <- sprintf("%s/%s_forcing_seas15_%s_BC_E%02d-%02d_TAR%4d-%4d_%02d_LM%d.RData",
BCFile <- sprintf("%s/%s_forcing_seas15_%s_BC_E%02d-%02d_TAR%4d-%4d_%02d_LM%d.nc4",
inPathBC, variableName, locName,
members[1], members[length(members)],
targetSYear, targetEYear,
targetMonth, leadMonth)
print(sprintf("Open: %s", BCFile))
load(BCFile)
RData_BC<-RData
rm(RData)
if (variableName == "pr" ) {
obsFile <- sprintf("/home/WUR/frans004/L_BACKUP/PROJECTS/EUPORIAS/biascorrection/DATA/wfdei_rev3.0/0.50deg/%s/%s_wfdei_GPCC_EU_%4d-%4d_%02d.RData",
locName, variableName,
initYears[1], initYears[length(initYears)],
targetMonth)
RData_BC <- Netcdf2R(BCFile, variableName)
if (variableName == "pr") {
obsFile <- sprintf("%s/%s_wfdei_GPCC_%s_%4d-%4d_%02d.nc4",
obsPath, variableName, locName,
initYears[1], initYears[length(initYears)],
targetMonth)
} else {
obsFile <- sprintf("/home/WUR/frans004/L_BACKUP/PROJECTS/EUPORIAS/biascorrection/DATA/wfdei_rev3.0/0.50deg/%s/%s_wfdei_EU_%4d-%4d_%02d.RData",
locName, variableName,
initYears[1], initYears[length(initYears)],
targetMonth)
obsFile <- sprintf("%s/%s_wfdei_%s_%4d-%4d_%02d.nc4",
obsPath, variableName, locName,
initYears[1], initYears[length(initYears)],
targetMonth)
}
print(sprintf("Open: %s", obsFile))
load(obsFile)
obs<-RData
rm(RData)
RData_obs <- Netcdf2R(obsFile, variableName)
#############################
## Make uniform and match the selections
print("making subset of overlapping data...")
dates1<-as.character(as.POSIXct(RData_obs$Dates$start, tz = "GMT"))
dates2<-as.character(as.POSIXct(RData_noBC$Dates$start, tz = "GMT"))
overlapping_dates<-as.Date(intersect(dates1, dates2))
rm(dates2,dates1)
RData_obs <- subsetRData(RData_obs, dates = overlapping_dates)
RData_noBC <- subsetRData(RData_noBC, dates = overlapping_dates)
RData_BC <- subsetRData(RData_BC, dates = overlapping_dates)
## Convert to right unit
RData_obs <- convert(RData_obs, toUnit = variableInfo[[variableName]]$unitsEasy)
RData_noBC <- convert(RData_noBC, toUnit = variableInfo[[variableName]]$unitsEasy)
RData_BC <- convert(RData_BC, toUnit = variableInfo[[variableName]]$unitsEasy)
## Check-Correction:
barLimits<-c(colorbarLimits[[variableName]]$minValue,colorbarLimits[[variableName]]$maxValue)
barLimitsDiff<-c(colorbarLimits[[variableName]]$diffMin,colorbarLimits[[variableName]]$diffMax)
print("obs_mean...")
obs_mean<-obs;obs_mean$Data<-apply(obs$Data, c(2,3), mean)
p_obs<-ggplotje(obs_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nWFDEI (", month.name[targetMonth], ")"),barLimits = barLimits)
# p_obs<-ggplotje(obs_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nWFDEI (", month.name[targetMonth], ")"))
RData_obs_mean <-RData_obs;RData_obs_mean$Data<-apply(RData_obs$Data, c(2,3), mean)
p_obs<-ggplotje(RData_obs_mean, title = paste0(variableInfo[[variableName]]$longName, " [", variableInfo[[variableName]]$unitsEasy, "]\nWFDEI (", month.name[targetMonth], ")"),barLimits = barLimits)
# p_obs<-ggplotje(RData_obs_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$unitsEasy, "\nWFDEI (", month.name[targetMonth], ")"))
print("BC_mean...")
RData_BC_mean<-RData_BC;RData_BC_mean$Data<-apply(RData_BC$Data, c(1,3,4), mean)
p_BC<-ggplotje(RData_BC_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nseas15_BC (", month.name[targetMonth], ", leadMonth:", leadMonth, ")"),barLimits = barLimits)
# p_BC<-ggplotje(RData_BC_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nseas15_BC (", month.name[targetMonth], ", LM:", leadMonth, "/SM:", iStartMonth, "/S:", iSeason, ")"))
p_BC<-ggplotje(RData_BC_mean, title = paste0(variableInfo[[variableName]]$longName, " [", variableInfo[[variableName]]$unitsEasy, "]\nseas15_BC (", month.name[targetMonth], ", leadMonth:", leadMonth, ")"),barLimits = barLimits)
# p_BC<-ggplotje(RData_BC_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$unitsEasy, "\nseas15_BC (", month.name[targetMonth], ", LM:", leadMonth, "/SM:", iStartMonth, "/S:", iSeason, ")"))
print("noBC_mean...")
RData_noBC_mean<-RData_noBC;RData_noBC_mean$Data<-apply(RData_noBC$Data, c(1,3,4), mean)
p_noBC<-ggplotje(RData_noBC_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nseas15_noBC (", month.name[targetMonth], ", leadMonth:", leadMonth, ")"),barLimits = barLimits)
# p_noBC<-ggplotje(RData_noBC_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nseas15_noBC (", month.name[targetMonth], ", LM:", leadMonth, "/SM:", iStartMonth, "/S:", iSeason, ")"))
p_noBC<-ggplotje(RData_noBC_mean, title = paste0(variableInfo[[variableName]]$longName, " [", variableInfo[[variableName]]$unitsEasy, "]\nseas15_noBC (", month.name[targetMonth], ", leadMonth:", leadMonth, ")"),barLimits = barLimits)
# p_noBC<-ggplotje(RData_noBC_mean, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$unitsEasy, "\nseas15_noBC (", month.name[targetMonth], ", LM:", leadMonth, "/SM:", iStartMonth, "/S:", iSeason, ")"))
RData_BC_mean2<-RData_BC
RData_BC_mean2$Data<-apply(RData_BC_mean$Data, c(2,3), mean)
obsdiff<-obs_mean
obsdiff$Data<-obs_mean$Data-RData_BC_mean2$Data
obsdiff<-RData_obs_mean
obsdiff$Data<-RData_obs_mean$Data-RData_BC_mean2$Data
barmin<-min(obsdiff$Data, na.rm = TRUE)
barmax<-max(obsdiff$Data, na.rm = TRUE)
# p_obsVsBC<-ggplotje(obsdiff, title = "Observed vs BC")
# p_obsVsBC<-ggplotje(obsdiff, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nWFDEI - seas15_BC"),barLimits = barLimitsDiff,barDiff=TRUE,backgroudColor = "grey85")
p_obsVsBC<-ggplotje(obsdiff, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nWFDEI - seas15_BC"),backgroudColor = "grey85")
# p_obsVsBC<-ggplotje(obsdiff, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nWFDEI - seas15_BC"),barDiff=TRUE,backgroudColor = "grey85")
# p_obsVsBC<-ggplotje(obsdiff, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$unitsEasy, "\nWFDEI - seas15_BC"),backgroudColor = "grey85")
p_obsVsBC <-ggplotje(obsdiff, title = paste0(variableInfo[[variableName]]$longName, " [", variableInfo[[variableName]]$unitsEasy, "]\nWFDEI - seas15_BC"),barLimits = c(barmin,barmax),barDiff=TRUE,backgroudColor = "grey85")
p_obsVsBCbars <-ggplotje(obsdiff, title = paste0(variableInfo[[variableName]]$longName, " [", variableInfo[[variableName]]$unitsEasy, "]\nWFDEI - seas15_BC"),barLimits = barLimitsDiff,barDiff=TRUE,backgroudColor = "grey85")
RData_noBC_mean2<-RData_BC
RData_noBC_mean2$Data<-apply(RData_noBC_mean$Data, c(2,3), mean)
obsdiffnoBC<-obs_mean
obsdiffnoBC$Data<-obs_mean$Data-RData_noBC_mean2$Data
obsdiffnoBC<-RData_obs_mean
obsdiffnoBC$Data<-RData_obs_mean$Data-RData_noBC_mean2$Data
# p_obsVsnoBC<-ggplotje(obsdiffnoBC, title = "Observed vs noBC")
# p_obsVsnoBC<-ggplotje(obsdiffnoBC, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nWFDEI - seas15_noBC"),barLimits = barLimitsDiff,barDiff=TRUE,backgroudColor = "grey85")
p_obsVsnoBC<-ggplotje(obsdiffnoBC, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nWFDEI - seas15_noBC"),backgroudColor = "grey85")
# p_obsVsnoBC<-ggplotje(obsdiffnoBC, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$units, "\nWFDEI - seas15_noBC"),barDiff=TRUE,backgroudColor = "grey85")
#p_obsVsnoBC<-ggplotje(obsdiffnoBC, title = paste0(variableInfo[[variableName]]$longName, " ", variableInfo[[variableName]]$unitsEasy, "\nWFDEI - seas15_noBC"),backgroudColor = "grey85")
barmin<-min(obsdiffnoBC$Data, na.rm = TRUE)
barmax<-max(obsdiffnoBC$Data, na.rm = TRUE)
p_obsVsnoBC <-ggplotje(obsdiffnoBC, title = paste0(variableInfo[[variableName]]$longName, " [", variableInfo[[variableName]]$unitsEasy, "]\nWFDEI - seas15_noBC"),barLimits = c(barmin,barmax),barDiff=TRUE,backgroudColor = "grey85")
p_obsVsnoBCbars <-ggplotje(obsdiffnoBC, title = paste0(variableInfo[[variableName]]$longName, " [", variableInfo[[variableName]]$unitsEasy, "]\nWFDEI - seas15_noBC"),barLimits = barLimitsDiff,barDiff=TRUE,backgroudColor = "grey85")
print("densPlots...")
print(dim(obs$Data))
print(dim(RData_BC$Data))
print(dim(RData_noBC$Data))
print(dim(RData_noBC$Data))
densPlot <-function(lon = NULL, lat = NULL) {
data_obs<-obs$Data[,lat==obs$xyCoords$y,lon==obs$xyCoords$x]
data_BC<-RData_BC$Data[members[1]:members[length(members)],,lat==obs$xyCoords$y,lon==obs$xyCoords$x]
data_noBC<-RData_noBC$Data[members[1]:members[length(members)],,lat==obs$xyCoords$y,lon==obs$xyCoords$x]
data_obs<-RData_obs$Data[,lat==RData_obs$xyCoords$y,lon==RData_obs$xyCoords$x]
data_BC<-RData_BC$Data[members[1]:members[length(members)],,lat==RData_obs$xyCoords$y,lon==RData_obs$xyCoords$x]
data_noBC<-RData_noBC$Data[members[1]:members[length(members)],,lat==RData_obs$xyCoords$y,lon==RData_obs$xyCoords$x]
dat <- data.frame(legend = factor(c(rep("1: OBS",length(as.vector(data_obs))),
rep("3: noBC",length(as.vector(data_noBC))),
rep("2: BC",length(as.vector(data_BC))))),
......@@ -149,28 +152,26 @@ for (variableName in variables) {
}
if (locName == "GHA") {
p4<-densPlot(30.25,-2.75)
p5<-densPlot(37.25,-2.75)
p6<-densPlot(37.25,10.75)
p4<-densPlot(30.75,-2.25)
p5<-densPlot(36.75,-2.25)
#p6<-densPlot(36.75,11.25)
} else {
# p4<-densPlot(-5.25,40.75)
# p5<-densPlot(30.25,50.75)
# p6<-densPlot(10.25,46.25)
p4<-densPlot(19.25,54.25)
p5<-densPlot(27.25,43.75)
p6<-densPlot(10.25,46.25)
#p6<-densPlot(10.25,46.25)
}
nameFilePicture <- sprintf("%s/%s_%s_E%02d-%02d_TAR%4d-%4d_%02d_LM%d",
outPath, variableName, locName,
members[1], members[length(members)],
initYears[1], initYears[length(initYears)],
targetMonth, leadMonth)
nameFilePicture <- sprintf("%s/%s_%s_%s_E%02d-%02d_TAR%4d-%4d_%02d_LM%d",
outPath, variableName, locName, resolution,
members[1], members[length(members)],
initYears[1], initYears[length(initYears)],
targetMonth, leadMonth)
print(paste0("Saving picture : ", nameFilePicture))
png(paste0(nameFilePicture,'.png'), width = 1920, height = 1080)
multiplot(p_obs, p_noBC, p_BC, p_obs, p_obsVsnoBC, p_obsVsBC, p4 ,p5, p6, cols=3)
# multiplot(p_obs, p_noBC, p_BC, p_obs, p_obsVsnoBC, p_obsVsBC, p4 ,p5, p6, cols=3)
multiplot(p_obs, p4, p5, p_noBC, p_obsVsnoBC, p_obsVsnoBCbars, p_BC, p_obsVsBC, p_obsVsBCbars, cols=3)
dev.off()
}
......
#!/bin/bash
#SBATCH --account=5120867-01
#SBATCH --time=5000
#SBATCH --mem=16024
#SBATCH --ntasks=1
#SBATCH --output=./log/log_6_biasCheck_<location>_<resolution>deg_targetMonth<targetMonth>_%j.txt
#SBATCH --job-name=check
#SBATCH --partition=ESG_Std
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=wietse.franssen@wur.nl
# print date and time
date
#
# print the working directory
pwd
module load R/3.2.0
#
# run targetent job
echo '******** R-data Download...'
Rscript ./tmpScripts/6_doBiasCheck_<location>_<resolution>deg_targetMonth<targetMonth>.R
date
#!/bin/bash
tmpScripts="./tmpScripts"
#location="EU"; resolution="0.50"
#location="GHA"; resolution="0.50"
location="GHA"; resolution="0.75"
mkdir -p $tmpScripts
for iTargetMonth in $(seq -f "%02g" 1 12); do
echo "leadMonth: $iTargetMonth"
sed -e "s|<targetMonth>|$iTargetMonth|g" \
-e "s|<location>|$location|g" \
-e "s|<resolution>|$resolution|g" \
6_jobScriptBiasCheck > $tmpScripts"/6_jobScriptBiasCheck_"$location"_"$resolution"deg_targetMonth"$iTargetMonth
sed -e "s|submitscript <- FALSE|submitscript <- TRUE|g" \
-e "s|targetMonths <- c(X:X)|targetMonths <- c($iTargetMonth:$iTargetMonth)|g" \
-e "s|locName <- 'X'|locName <- '$location'|g" \
-e "s|resolution <- 'X'|resolution <- '$resolution'|g" \
6_doBiasCheck.R > $tmpScripts"/6_doBiasCheck_"$location"_"$resolution"deg_targetMonth"$iTargetMonth".R"
sbatch "$tmpScripts/6_jobScriptBiasCheck_"$location"_"$resolution"deg_targetMonth"$iTargetMonth
done
......@@ -20,7 +20,6 @@ FixRDataDimensionorder<-function(RData) {
dims_old<-dim(RData$Data)
RData$Data<-aperm(RData$Data, c(to))
attr(RData$Data,"dimensions")<-order_new
print(dim(RData$Data))
cat("old order: ");print(sprintf("%s (%s)",order_old,dims_old ))
cat("new order: ");print(sprintf("%s (%s)",order_new,dim(RData$Data) ))
return(RData)
......
......@@ -10,25 +10,25 @@ locationInfo <- list(
)
variableInfo <- list(
tas = list(standardName = "air_temperature", longName = "Near-Surface Air Temperature", unitsEcoms = "Celsius", units = "K"),
tasmin = list(standardName = "air_min_temperature", longName = "Daily Minimum Near-Surface Air Temperature", unitsEcoms = "Celsius", units = "K"),
tasmax = list(standardName = "air_max_temperature", longName = "Daily Maximum Near-Surface Air Temperature", unitsEcoms = "Celsius", units = "K"),
pr = list(standardName = "precipitation_flux", longName = "Precipitation", unitsEcoms = "mm day-1", units = "kg m-2 s-1", ecomsName = "tp"),
# psl = list(standardName = "air_pressure_at_sea_level", longName = "Sea level pressure", unitsEcoms = "Pa", units = "Pa"),
rsds = list(standardName = "surface_downwelling_shortwave_flux_in_air", longName = "Surface Downwelling Shortwave Radiation", unitsEcoms = "1/86400^2 W m-2", units = "W m-2"),
rlds = list(standardName = "surface_downwelling_longwave_flux_in_air", longName = "Surface Downwelling Longwave Radiation", unitsEcoms = "1/86400^2 W m-2", units = "W m-2"),
huss = list(standardName = "specific_humidity", longName = "Near-Surface Specific Humidity", unitsEcoms = "1", units = "1"),
sfcWind = list(standardName = "wind_speed", longName = "Near-Surface Wind Speed", unitsEcoms = "m s-1", units = "m s-1", ecomsName = "wss")
tas = list(standardName = "air_temperature", longName = "Near-Surface Air Temperature", unitsEcoms = "Celsius", unitsEasy = "Celsius", units = "K"),
tasmin = list(standardName = "air_min_temperature", longName = "Daily Minimum Near-Surface Air Temperature", unitsEcoms = "Celsius", unitsEasy = "Celsius", units = "K"),
tasmax = list(standardName = "air_max_temperature", longName = "Daily Maximum Near-Surface Air Temperature", unitsEcoms = "Celsius", unitsEasy = "Celsius", units = "K"),
pr = list(standardName = "precipitation_flux", longName = "Precipitation", unitsEcoms = "mm day-1", unitsEasy = "mm day-1", units = "kg m-2 s-1", ecomsName = "tp"),
# psl = list(standardName = "air_pressure_at_sea_level", longName = "Sea level pressure", unitsEcoms = "Pa", unitsEasy = "Pa", units = "Pa"),
rsds = list(standardName = "surface_downwelling_shortwave_flux_in_air", longName = "Surface Downwelling Shortwave Radiation", unitsEcoms = "1/86400^2 W m-2", unitsEasy = "W m-2", units = "W m-2"),
rlds = list(standardName = "surface_downwelling_longwave_flux_in_air", longName = "Surface Downwelling Longwave Radiation", unitsEcoms = "1/86400^2 W m-2", unitsEasy = "W m-2", units = "W m-2"),
huss = list(standardName = "specific_humidity", longName = "Near-Surface Specific Humidity", unitsEcoms = "kg kg-1", unitsEasy = "kg kg-1", units = "kg kg-1"),
sfcWind = list(standardName = "wind_speed", longName = "Near-Surface Wind Speed", unitsEcoms = "m s-1", unitsEasy = "m s-1", units = "m s-1", ecomsName = "wss")
)
colorbarLimits <- list(
tas = list(minValue = -20, maxValue = 35, diffMin = -0.5, diffMax = 0.5),
tasmin = list(minValue = -20, maxValue = 35, diffMin = -0.5, diffMax = 0.5),
tasmax = list(minValue = -20, maxValue = 35, diffMin = -0.5, diffMax = 0.5),
pr = list(minValue = 0, maxValue = 10, diffMin = -0.2, diffMax = 0.2),
# psl = list(minValue = 0, maxValue = 10, diffMin = -0.2, diffMax = 0.2),
rsds = list(minValue = -200, maxValue = 500, diffMin = -0.2, diffMax = 0.2),
rlds = list(minValue = -200, maxValue = 500, diffMin = -0.2, diffMax = 0.2),
huss = list(minValue = 0, maxValue = 10, diffMin = -0.2, diffMax = 0.2),
sfcWind = list(minValue = 0, maxValue = 10, diffMin = -0.2, diffMax = 0.2)
tas = list(minValue = -20, maxValue = 40, diffMin = -0.5, diffMax = 0.5),
tasmin = list(minValue = -20, maxValue = 40, diffMin = -0.5, diffMax = 0.5),
tasmax = list(minValue = -20, maxValue = 40, diffMin = -0.5, diffMax = 0.5),
pr = list(minValue = 0, maxValue = 10, diffMin = -0.2, diffMax = 0.2),
# psl = list(minValue = 0, maxValue = 10, diffMin = -0.2, diffMax = 0.2),
rsds = list(minValue = -200, maxValue = 500, diffMin = -0.5, diffMax = 0.5),
rlds = list(minValue = -200, maxValue = 500, diffMin = -0.5, diffMax = 0.5),
huss = list(minValue = 0, maxValue = 0.02, diffMin = -0.5, diffMax = 0.5),
sfcWind = list(minValue = 0, maxValue = 10, diffMin = -0.2, diffMax = 0.2)
)
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