Skip to content
Snippets Groups Projects
Commit 61ac420c authored by Franssen, Wietse's avatar Franssen, Wietse
Browse files

added download jobscripts

parent 0234748a
No related branches found
No related tags found
No related merge requests found
rm(list=ls())
#setwd("/home/wietse/TODO/SCRIPTS")
source(file = "./functionDownload.R")
source(file = "./functionConvert.R")
submitscript <- FALSE
if (submitscript) {
members <- c(X:X)
initMonths <- c(1:12)
initYears <- c(1981:2010)
locName <- 'X'
outPath <- "./downloaded/noBC/"
} else {
members <-c(1:15)
members <-c(1)
initMonths <-c(1:12)
#initMonths <-c(1)
initYears <-c(1981:2010)
#initYears <-c(1981)
locName<-"GHA"
# locName<-"EU"
outPath <- "./testData/noBC/"
}
variables<-names(variableInfo)
variables<-c("pr")
#variables<-c("tas")
variables<-c("rsds", "rlds")
#variables<-c( "rsds" )
dir.create(outPath, recursive = TRUE, showWarnings = FALSE)
for (varName in variables) {
for (iMember in members) {
for (initYear in initYears) {
for (initMonth in initMonths) {
RData<- downloadSeas15(variableInfo[varName], locationInfo[locName], iMember, initYear, initMonth)
RData<-convert(RData = RData, toUnit = variableInfo[[varName]]$units)
## Solve ECOMS stuff!
## Precip issue:
# if (varName == "pr") {
# ntime<-length(RData$Data[,1,1])
# dataTmp<-RData$Data[]
# dataTmp[1:ntime-1,,]<-RData$Data[2:ntime,,]
# dataTmp[ntime,,]<-RData$Data[ntime,,]
# RData$Data[]<-dataTmp[]
# }
## Radiation issue 1: (86400*86400)
## This is solved in the conversion with the help of infoGeneral.R
## Radiation issue 2:
## The downloaded radiation of leadmonth 0 has one extra day (firstday-1).
## This is solved in functionDownload.R because it affects only leadmonth 0
## NOTE!!! Is is not right in the current dataset!!!!
oFile <- sprintf(paste0(outPath,"/%s_forcing_seas15_%s_noBC_E%02d_%4d_%02d.nc4"), varName, locName, iMember, initYear, initMonth)
R2Netcdf(oFile,RData)
}
}
}
}
#TDOD: pr + 1day
#!/bin/bash
#SBATCH --account=5120867-01
#SBATCH --time=5000
#SBATCH --mem=4024
#SBATCH --ntasks=1
#SBATCH --output=./log/log_<location>_member<member>_%j.txt
#SBATCH --job-name=DL
#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 '******** R-data Download...'
Rscript ./tmpScripts/download_<location>_member<member>.R
date
#!/bin/bash
tmpScripts="./tmpScripts"
location="GHA"
mkdir -p $tmpScripts
for iMember in $(seq -f "%02g" 1 15); do
echo "member: $iMember"
sed -e "s|<member>|$iMember|g" \
-e "s|<location>|$location|g" \
jobScript > $tmpScripts"/jobScript_"$location"_member"$iMember
sed -e "s|<member>|$iMember|g" \
-e "s|submitscript <- FALSE|submitscript <- TRUE|g" \
-e "s|members <- c(X:X)|members <- c($iMember:$iMember)|g" \
-e "s|locName <- 'X'|locName <- '$location'|g" \
download.R > $tmpScripts"/download_"$location"_member"$iMember".R"
sbatch "$tmpScripts/jobScript_"$location"_member"$iMember
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment