Commit 0f589a55 authored by Franssen, Wietse's avatar Franssen, Wietse
Browse files

minor updates

parent 4b805713
#!/bin/bash
#SBATCH --account=5120867-01
#SBATCH --time=5000
#SBATCH --mem=16024
#SBATCH --mem=32024
#SBATCH --ntasks=1
#SBATCH --output=./log/log_2_doReorder_combYears_combMembers_sepLeadmonths_<location>_<bcInfo>_<resolution>deg_initMonth<initMonth>_%j.txt
#SBATCH --job-name=Reformat
#SBATCH --partition=ESG_Std
#SBATCH --job-name=Reorder2bias
#SBATCH --partition=ESG_High
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=wietse.franssen@wur.nl
# print date and time
......
#!/bin/bash
tmpScripts="./tmpScripts"
#location="EU"; resolution="0.50"
location="EU"; resolution="0.50"
#location="GHA"; resolution="0.50"
location="GHA"; resolution="0.75"
#location="GHA"; resolution="0.75"
bcInfo="noBC"
#bcInfo="BC"
......
rm(list=ls())
library(downscaleR)
source(file = "./functions/functionsGeneral.R")
source(file = "./functions/infoGeneral.R")
submitscript <- FALSE
if (submitscript) {
members <- c(1:15)
initYears <-c(1981:2010)
targetMonths <- c(X:X)
leadMonths<-c(0:6)
locName <- 'X'
fromResolution <- "0.75"
toResolution <- "0.50"
inPath<-sprintf("../DATA/System4_seasonal_15_rev1.1TAR_old/%sdeg/%s_noBC", fromResolution, locName)
outPath<-sprintf("../DATA/System4_seasonal_15_rev1.1TAR_old/%sdeg/%s_noBC", toResolution, locName)
} else {
members <-c(1:15)
initYears <-c(1981:2010)
targetMonths<-1
leadMonths<-c(0:6)
#locName<-"GHA"
locName<-"EU"
fromResolution <- "0.75"
toResolution <- "0.50"
inPath<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_noBC", fromResolution, locName)
outPath<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_noBC", toResolution, locName)
}
variables<-names(variableInfo)
variables<-c("tasmin", "tasmax", "pr", "psl", "rsds", "rlds", "huss", "sfcWind" )
dir.create(outPath, recursive = TRUE, showWarnings = FALSE)
print("start")
for (variableName in variables) {
for (targetMonth in targetMonths) {
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
iFile <- sprintf("%s/%s_forcing_seas15_%s_noBC_E%02d-%02d_TAR%4d-%4d_%02d_LM%d.RData",
inPath, variableName, locName,
members[1], members[length(members)],
targetSYear, targetEYear,
targetMonth, leadMonth)
print(sprintf("Open: %s", iFile))
load(iFile)
newGrid<-getGrid(RData)
newGrid$x <- c(locationInfo$res0.50[[locName]]$lonmin, locationInfo$res0.50[[locName]]$lonmax)
newGrid$y <- c(locationInfo$res0.50[[locName]]$latmin, locationInfo$res0.50[[locName]]$latmax)
attr(newGrid,"resX") <- 0.50
attr(newGrid,"resY") <- 0.50
print(sprintf("Regridding..."))
RData <- interpGridData(RData, new.grid = newGrid, method = "bilinear");
# RData <- interpGridData(RData, new.grid = newGrid, method = "nearest");
## set all negative precipitation values 0
if (variableName == "pr") {
RData$Data[RData$Data < 0] <- 0
}
oFile <- sprintf("%s/%s_forcing_seas15_%s_noBC_E%02d-%02d_TAR%4d-%4d_%02d_LM%d.RData",
outPath, variableName, locName,
members[1], members[length(members)],
targetSYear, targetEYear,
targetMonth, leadMonth)
print(sprintf("Saving: %s", oFile))
save(file= oFile, RData)
}
}
}
#!/bin/bash
#SBATCH --account=5120867-01
#SBATCH --time=5000
#SBATCH --mem=16024
#SBATCH --ntasks=1
#SBATCH --output=./log/log_regrid_<location>_targetMonth<targetMonth>_%j.txt
#SBATCH --job-name=regr
#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 current job
echo '******** start Rscript...'
Rscript ./tmpScripts/doRegrid_<location>_targetMonth<targetMonth>.R
date
......@@ -4,7 +4,7 @@
#SBATCH --mem=16024
#SBATCH --ntasks=1
#SBATCH --output=./log/log_doReorder_sepYears_sepMembers_combLeadmonths_<location>_<bcInfo>_<resolution>deg_initMonth<initMonth>_%j.txt
#SBATCH --job-name=Reformat2
#SBATCH --job-name=Reorder
#SBATCH --partition=ESG_High
#SBATCH --mail-type=FAIL
#SBATCH --mail-user=wietse.franssen@wur.nl
......
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