diff --git a/.gitignore b/.gitignore index 455eb6dfaacf61d0e5799bccbbc29888396acbe7..bcf2d225b3ab94a56033c8cf5158bb7c1ee479f6 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ testData *.log tmpScripts *.RData +DATA/ \ No newline at end of file diff --git a/SCRIPTS/README.txt b/SCRIPTS/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..d17be7d0e0bcc5dc819db6dee7238ce9ded86001 --- /dev/null +++ b/SCRIPTS/README.txt @@ -0,0 +1,11 @@ +# If using old data +## Step 1 +reformat the old 0.75 degree data (seperate years, seperate members, combined leadmonths) to new data (combined years, combined members, seperate leadmonths) + +## Step 2 +regrid the 0.75 degree data into 0.50 degree data +both datasets are: combined years, combined members, seperate leadmonths + +# If downloading new data +## Step 1 + diff --git a/SCRIPTS/doBiascorrection.R b/SCRIPTS/doBiascorrection.R index 391d790944153772ec085455d1b960421f757aaf..902251710488de4717c15f6ec496a6d7c9cd734d 100644 --- a/SCRIPTS/doBiascorrection.R +++ b/SCRIPTS/doBiascorrection.R @@ -11,9 +11,12 @@ if (submitscript) { currMonths <- c(X:X) leadMonths<-c(0:6) locName <- 'X' - inPath<-"./testData/reFormatted_noBC" - outPath<-"./testData/reFormatted_BC" resolution<-"0.50" +# inPath<-"./testData/reFormatted_noBC" + obsPath<-sprintf("../DATA/wfdei_rev3.0/%sdeg/%s/", resolution, locName) + inPath<-sprintf("../DATA/System4_seasonal_15_rev2.0/%sdeg/%s_noBC", resolution, locName) + outPath<-sprintf("../DATA/System4_seasonal_15_rev2.0/%sdeg/%s_BC", resolution, locName) +# outPath<-"./testData/reFormatted_BC" } else { members <-c(1:15) initYears <-c(1981:2010) @@ -21,6 +24,7 @@ if (submitscript) { leadMonths<-c(0:6) #locName<-"GHA" locName<-"EU" + obsPath<-sprintf("../DATA/wfdei_rev3.0/%sdeg/%s/", resolution, locName) inPath<-"./testData/reFormatted_noBC" outPath<-"./testData/reFormatted_BC" resolution<-"0.50" @@ -29,6 +33,7 @@ if (submitscript) { variables<-names(variableInfo) variables<-c( "rsds" , "rlds" , "tasmin","tasmax", "huss" , "sfcWind","pr" , "psl") variables<-c( "tasmin","tasmax", "huss" , "sfcWind","pr" , "psl") +variables<-c( "pr", "sfcWind", "rsds", "rlds", "huss", "tas", "tasmin", "tasmax") #variables<-c("tas") dir.create(outPath, recursive = TRUE, showWarnings = FALSE) @@ -48,25 +53,31 @@ for (variableName in variables) { RData_noBC<-RData rm(RData) - obsFile <- sprintf("/home/WUR/frans004/L_BACKUP/PROJECTS/EUPORIAS/DATA_BIAS/DATA/DATA_RAW_R/%s_WFD/%s_wfdei_%4d-%4d_%02d.RData", - locName, variableName, +# obsFile <- sprintf("/home/WUR/frans004/L_BACKUP/PROJECTS/EUPORIAS/DATA_BIAS/DATA/DATA_RAW_R/%s_WFD/%s_wfdei_%4d-%4d_%02d.RData", +# locName, variableName, +# initYears[1], initYears[length(initYears)], +# currMonth) + obsFile <- sprintf("%s/%s_wfdei_%s_%4d-%4d_%02d.RData", + obsPath, variableName, locName, initYears[1], initYears[length(initYears)], currMonth) print(sprintf("Open: %s", obsFile)) load(obsFile) - obs_new<-obs - newGrid<-getGrid(RData_noBC) - indexesLat<-c(which(obs$xyCoords$y==newGrid$y[1]):which(obs$xyCoords$y==newGrid$y[2])) - indexesLon<-c(which(obs$xyCoords$x==newGrid$x[1]):which(obs$xyCoords$x==newGrid$x[2])) - obs_new$xyCoords<-RData_noBC$xyCoords - obs_new$Data<-obs$Data[,indexesLat,indexesLon] - attr(obs_new$Data,"dimensions") <- c("time","lat","lon") - obs<-obs_new - rm(obs_new) + + RData_obs<-RData + rm(RData) +# newGrid<-getGrid(RData_noBC) +# indexesLat<-c(which(RData$xyCoords$y==newGrid$y[1]):which(RData$xyCoords$y==newGrid$y[2])) +# indexesLon<-c(which(RData$xyCoords$x==newGrid$x[1]):which(RData$xyCoords$x==newGrid$x[2])) +# RData_new$xyCoords<-RData_noBC$xyCoords +# RData_new$Data<-RData$Data[,indexesLat,indexesLon] +# attr(RData_new$Data,"dimensions") <- c("time","lat","lon") +# RData<-RData_new +# rm(RData_new) print(sprintf("Bais correction...")) - RData <- biasCorrection (obs, RData_noBC, RData_noBC, method = "qqmap", multi.member = FALSE, pr.threshold = 0.1)# bias + RData <- biasCorrection (RData_obs, RData_noBC, RData_noBC, method = "qqmap", multi.member = FALSE, pr.threshold = 0.1)# bias oFile <- sprintf("%s/%s_forcing_seas15_%s_BC_E%02d-%02d_%4d-%4d_%02d_LM%d.RData", outPath, variableName, locName, diff --git a/SCRIPTS/doDownloadSeas15.R b/SCRIPTS/doDownloadSeas15.R index a74804d70dd57f9fad7aeac553410516f4885f64..640364d2aa0b1a43bf9ec12ffed4ddffa2ebdd34 100644 --- a/SCRIPTS/doDownloadSeas15.R +++ b/SCRIPTS/doDownloadSeas15.R @@ -17,11 +17,11 @@ if (submitscript) { targetMonths <- c(1:12) # targetMonths <- c(1) targetYears <- c(1981:2011) - targetYears <- c(1981:1982) +# targetYears <- c(1981:1982) leadMonths <- c(X:X) locName <- 'X' # outPath<-"../DATA/System4_seasonal_15/0.75deg/EU_noBC" - outPath<-sprintf("../DATA/System4_seasonal_15/0.75deg/%s_noBC", locName) + outPath<-sprintf("../DATA/System4_seasonal_15_rev3.0/0.75deg/%s_noBC", locName) } else { members <-c(1,2) targetMonths <-c(1:2) @@ -35,9 +35,9 @@ if (submitscript) { } variables<-names(variableInfo) -variables<-c("pr", "rsds", "rlds") -variables<-c( "sfcWind", "psl" , "huss", "tas", "tasmin", "tasmax") -variables<-c("tas", "rsds", "rlds", "pr") +#variables<-c("pr", "rsds", "rlds") +#variables<-c( "sfcWind", "psl" , "huss", "tas", "tasmin", "tasmax") +#variables<-c("tas", "rsds", "rlds", "pr") dir.create(outPath, recursive = TRUE, showWarnings = FALSE) diff --git a/SCRIPTS/doDownloadWfdei.R b/SCRIPTS/doDownloadWfdei.R new file mode 100644 index 0000000000000000000000000000000000000000..c6c9de7156d64b4061e8c9b1c1cacc134867ad44 --- /dev/null +++ b/SCRIPTS/doDownloadWfdei.R @@ -0,0 +1,96 @@ +rm(list=ls()) +library(fields) # e.g: using the fields library +library(abind) +library(ncdf4) +library(ecomsUDG.Raccess) +library(ecomsUDG.Raccess) +source(file = "./functions/infoGeneral.R") +source(file = "./functions/functionsGeneral.R") +source(file = "./functions/functionR2Netcdf.R") + +loginECOMS_UDG(username = "wietsefranssen", password = "ECOMS") + +submitscript <- FALSE + +if (submitscript) { + targetMonths <- c(1:12) + targetYears <- c(1981:2011) + locName <- 'X' + resolution<-"0.50" + outPath<-sprintf("../DATA/wfdei_rev3.0/%sdeg/%s", resolution, locName) + +} else { + targetMonths <-c(1:12) + targetYears <-c(1981:2010) + # targetYears <-c(1981:1982) + locName<-"GHA" + locName<-"EU" + resolution<-"0.75" + outPath<-sprintf("../DATA/wfdei_rev3.0/%sdeg/%s", resolution, locName) +} + +variables<-names(variableInfo) +variables<-c( "pr", "sfcWind", "rsds", "rlds", "huss", "tas", "tasmin", "tasmax") + +dir.create(outPath, recursive = TRUE, showWarnings = FALSE) + +for (variableName in variables) { + for (targetMonth in targetMonths) { + if ('ecomsName' %in% names(variableInfo[[variableName]])) { + variableNameECOMS<-variableInfo[[variableName]]$ecomsName + } else { + variableNameECOMS<-variableName + } + + print(sprintf("targetMonth: %s, years: %d-%d",month.name[targetMonth], targetYears[1], targetYears[length(targetYears)])) + + oPrefix <- sprintf("%s/%s_wfdei_%s_%4d-%4d_%02d", + outPath, variableName, locName, + targetYears[1], targetYears[length(targetYears)], + targetMonth) + print(oPrefix) + + if (resolution == "0.50") { + lonLim = c(locationInfo$res0.50[[locName]]$lonmin, locationInfo$res0.50[[locName]]$lonmax) + latLim = c(locationInfo$res0.50[[locName]]$latmin, locationInfo$res0.50[[locName]]$latmax) + } else { + # lonLim = c(locationInfo$res0.75[[locName]]$lonmin-1.5, locationInfo$res0.75[[locName]]$lonmax+1.5) + # latLim = c(locationInfo$res0.75[[locName]]$latmin-1.5, locationInfo$res0.75[[locName]]$latmax+1.5) + lonLim = c(locationInfo$res0.75[[locName]]$lonmin, locationInfo$res0.75[[locName]]$lonmax) + latLim = c(locationInfo$res0.75[[locName]]$latmin, locationInfo$res0.75[[locName]]$latmax) + } + + RData<-loadECOMS(dataset = "WFDEI", + var = variableNameECOMS, + lonLim = lonLim, + latLim = latLim, + season = targetMonth, + years = targetYears, + time = "DD") + + RData$xyCoords$x[]<-round(RData$xyCoords$x[],2) + RData$xyCoords$y[]<-round(RData$xyCoords$y[],2) + + if (resolution == "0.75") { + newGrid<-getGrid(RData) + newGrid$x <- c(locationInfo$res0.75[[locName]]$lonmin, locationInfo$res0.75[[locName]]$lonmax) + newGrid$y <- c(locationInfo$res0.75[[locName]]$latmin, locationInfo$res0.75[[locName]]$latmax) + attr(newGrid,"resX")<-0.75 + attr(newGrid,"resY")<-0.75 + print("Regridding") + RData <- interpGridData(RData, new.grid = newGrid, method = "bilinear"); + } + + # Check units + RData$Variable$varName<-variableName + attr(RData$Variable,"standard_name")<-variableInfo[[variableName]]$standardName + attr(RData$Variable,"long_name")<-variableInfo[[variableName]]$longName + attr(RData$Variable,"units")<-variableInfo[[variableName]]$unitsEcoms + + ## add some extra attributes + attr(RData,"contact") <- "Wietse Franssen (wietse.franssen@wur.nl)" + + save(file = sprintf("%s.RData",oPrefix), RData) + # R2Netcdf(sprintf("%s.nc4",oPrefix), RData) + } +} diff --git a/SCRIPTS/doReformat.R b/SCRIPTS/doReformat.R index 703d7d8dcb68afc89a52102908479abe379ef827..642549ebba58cbc02fdf25a385ef02e3fe6a0edd 100644 --- a/SCRIPTS/doReformat.R +++ b/SCRIPTS/doReformat.R @@ -3,10 +3,10 @@ library(fields) # e.g: using the fields library library(abind) library(ncdf4) library(ecomsUDG.Raccess) -source(file = "./functionReformat.R") -source(file = "./functionsGeneral.R") -source(file = "./functionR2Netcdf.R") -source(file = "./infoGeneral.R") +source(file = "./functions/functionReformat.R") +source(file = "./functions/functionsGeneral.R") +source(file = "./functions/functionR2Netcdf.R") +source(file = "./functions/infoGeneral.R") submitscript <- FALSE @@ -15,65 +15,43 @@ if (submitscript) { initYears <-c(1981:2010) initMonths <- c(X:X) locName <- 'X' - inPath <- "/home/WUR/frans004/L_BACKUP/PROJECTS/EUPORIAS/DATA_BIAS/DATA/DATA_RAW_R/EU_0.50/" - outPath<-"./testData/reFormatted" resolution<-"0.75" + inPath<-sprintf("../DATA/System4_seasonal_15_rev1.0/%s_%s", locName, resolution) + outPath<-sprintf("../DATA/System4_seasonal_15_rev1.1/%sdeg/%s_noBC", resolution, locName) } else { - members <-c(1:15) + members <-c(1:2) initYears <-c(1981:1982) initMonths<-1 #locName<-"GHA" locName<-"EU" - inPath <- "./testData/RAW-test/" - outPath<-"./testData/reFormatted" resolution<-"0.75" + inPath<-sprintf("../DATA/System4_seasonal_15_rev1.0/%s_%s", locName, resolution) + outPath<-sprintf("../DATA/System4_seasonal_15_rev1.x/%sdeg/%s_noBC", resolution, locName) } variables<-names(variableInfo) -variables<-c( "pr" , "psl" , "rsds" , "rlds" , "tasmin","tasmax", "huss" , "sfcWind") -variables<-c( "tp" , "psl" , "rsds" , "rlds" , "tasmin","tasmax", "huss" , "sfcWind") -variables<-c( "wss") -#variables<-c("tas") +#variables<-c( "pr" , "psl" , "rsds" , "rlds" , "tasmin","tasmax", "huss" , "sfcWind") +#variables<-c( "pr", "sfcWind") dir.create(outPath, recursive = TRUE, showWarnings = FALSE) -#targetMonth<-1 leadMonths<-c(0:6) - -#initInfo <- getInitInfo(targetYear = 1981, targetMonth = 6, leadMonth = 0) -#availableTargetYears <- getAvailableTargetYears(targetYears = targetYears, targetMonth = targetMonth, leadMonth = 0) -#print(initInfo) print("start") for (initMonth in initMonths) { for (variableName in variables) { -# inFile <- sprintf("%s/%s_forcing_seas15_%s_noBC_E<MEMBERS>_<YEARS>_%02d.RData", inPath, variableName, locName, initMonth) - inFile <- sprintf("%s/%s/%s_forcing_seas15_%s_noBC_E<MEMBERS>_<YEARS>_%02d.RData", inPath, variableName, variableName, locName, initMonth) + if ('ecomsName' %in% names(variableInfo[[variableName]])) { + variableNameECOMS<-variableInfo[[variableName]]$ecomsName + } else { + variableNameECOMS<-variableName + } + inFile <- sprintf("%s/%s/%s_forcing_seas15_%s_noBC_E<MEMBERS>_<YEARS>_%02d.RData", inPath, variableNameECOMS, variableNameECOMS, locName, initMonth) print(inFile) - #RData <- reformat2Bias(members, initYears, initInfo$initMonth, varName, locName, iFile = inFile) - RDataAllLeadMonths <- reformat2Bias(members, initYears, initMonth, variableName, locName, iFile = inFile) - + RDataAllLeadMonths <- reformat2Bias(members, initYears, initMonth, variableNameECOMS, locName, iFile = inFile) for (leadMonth in leadMonths) { currMonth<-indexesOfDaysPerMonth(initMonth,7,0000)[leadMonth+1,"month"] - print(sprintf("currmonth: %s, leadMonth: %s",currMonth,leadMonth)) + print(sprintf("currmonth: %s, leadMonth: %s",currMonth, leadMonth)) - ## get the available target years for the current targetMonth and leadMonth - # availableTargetYears <- getAvailableTargetYears(targetYears = targetYears, targetMonth = targetMonth, leadMonth = leadMonth) - # nYears <- length(availableTargetYears) - # - if ('ecomsName' %in% names(variableInfo[[variableName]])) { - variableNameECOMS<-variableInfo[[variableName]]$ecomsName - } else { - variableNameECOMS<-variableName - } - - # print(sprintf("targetMonth: %s, leadMonth: %s, years: %d-%d",month.name[targetMonth], leadMonth, availableTargetYears[1], availableTargetYears[nYears])) - - # oPrefix <- sprintf("%s/%s_forcing_seas15_%s_noBC_E%02d-%02d_%4d-%4d_%02d_LM%d", - # outPath, variableName, locName, - # members[1], members[length(members)], - # availableTargetYears[1], availableTargetYears[nYears], - # targetMonth, leadMonth) oPrefix <- sprintf("%s/%s_forcing_seas15_%s_noBC_E%02d-%02d_%4d-%4d_%02d_LM%d", outPath, variableName, locName, members[1], members[length(members)], @@ -99,13 +77,10 @@ for (initMonth in initMonths) { ## add some extra attributes attr(RData,"contact") <- "Wietse Franssen (wietse.franssen@wur.nl)" - #print(names(RDataAllLeadMonths)) # print(names(RData)) save(RData, file = paste0(oPrefix, ".RData")) - R2Netcdf(paste0(oPrefix, ".nc4"), RData) + #R2Netcdf(paste0(oPrefix, ".nc4"), RData) } } } - - \ No newline at end of file diff --git a/SCRIPTS/doRegrid.R b/SCRIPTS/doRegrid.R new file mode 100644 index 0000000000000000000000000000000000000000..24106cc0d5583164d3e62384a476b1801ef4a44e --- /dev/null +++ b/SCRIPTS/doRegrid.R @@ -0,0 +1,68 @@ +rm(list=ls()) +library(ecomsUDG.Raccess) + +source(file = "./functions/infoGeneral.R") + +submitscript <- FALSE + +if (submitscript) { + members <- c(1:15) + initYears <-c(1981:2010) + currMonths <- c(X:X) + leadMonths<-c(0:6) + locName <- 'X' + 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) +} else { + members <-c(1:15) + initYears <-c(1981:2010) + currMonths<-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("tas") + +dir.create(outPath, recursive = TRUE, showWarnings = FALSE) + +print("start") +for (variableName in variables) { + for (currMonth in currMonths) { + for (leadMonth in leadMonths) { + iFile <- sprintf("%s/%s_forcing_seas15_%s_noBC_E%02d-%02d_%4d-%4d_%02d_LM%d.RData", + inPath, variableName, locName, + members[1], members[length(members)], + initYears[1], initYears[length(initYears)], + currMonth, 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"); + + oFile <- sprintf("%s/%s_forcing_seas15_%s_BC_E%02d-%02d_%4d-%4d_%02d_LM%d.RData", + outPath, variableName, locName, + members[1], members[length(members)], + initYears[1], initYears[length(initYears)], + currMonth, leadMonth) + + print(sprintf("Saving: %s", oFile)) + save(file= oFile, RData) + } + } +} diff --git a/SCRIPTS/jobScriptBiascorrection b/SCRIPTS/jobScriptBiascorrection index 1d918d7d5e4f460fcbc34db6169ee11373263fec..0e33757ea7b67b18d11dbeeb566ab97f31c8853c 100644 --- a/SCRIPTS/jobScriptBiascorrection +++ b/SCRIPTS/jobScriptBiascorrection @@ -17,6 +17,6 @@ module load R/3.2.0 # # run current job echo '******** R-data Download...' -Rscript ./tmpScripts/biascorrection_<location>_currMonth<currMonth>.R +Rscript ./tmpScripts/doBiascorrection_<location>_currMonth<currMonth>.R date diff --git a/SCRIPTS/jobScriptDownloadSeas15 b/SCRIPTS/jobScriptDownloadSeas15 index 7cf3c59f217dbd9c5b47ad34a2a55038c11e88e5..5dcc8ab5b995acc0d94c087dd1bc095599db0efe 100644 --- a/SCRIPTS/jobScriptDownloadSeas15 +++ b/SCRIPTS/jobScriptDownloadSeas15 @@ -1,6 +1,6 @@ #!/bin/bash #SBATCH --account=5120867-01 -#SBATCH --time=5000 +#SBATCH --time=50000 #SBATCH --mem=16024 #SBATCH --ntasks=1 #SBATCH --output=./log/log_download_<location>_leadMonth<leadMonth>_%j.txt diff --git a/SCRIPTS/jobScriptReformat b/SCRIPTS/jobScriptReformat index ff142fa9ea9f9c7cc8d9f6d77a8b9e8eae93de58..df53a54c6882c12721a6bea7460a99e9ca5d8643 100644 --- a/SCRIPTS/jobScriptReformat +++ b/SCRIPTS/jobScriptReformat @@ -16,7 +16,7 @@ pwd module load R/3.2.0 # # run current job -echo '******** R-data Download...' -Rscript ./tmpScripts/reformat_<location>_initMonth<initMonth>.R +echo '******** start Rscript...' +Rscript ./tmpScripts/doReformat_<location>_initMonth<initMonth>.R date diff --git a/SCRIPTS/jobScriptRegrid b/SCRIPTS/jobScriptRegrid new file mode 100644 index 0000000000000000000000000000000000000000..0b4c042604d58cccda46dab70dc61324d68a40df --- /dev/null +++ b/SCRIPTS/jobScriptRegrid @@ -0,0 +1,22 @@ +#!/bin/bash +#SBATCH --account=5120867-01 +#SBATCH --time=5000 +#SBATCH --mem=16024 +#SBATCH --ntasks=1 +#SBATCH --output=./log/log_regrid_<location>_currMonth<currMonth>_%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>_currMonth<currMonth>.R +date + diff --git a/SCRIPTS/submit_biascorrection.sh b/SCRIPTS/submit_biascorrection.sh index e61a46bf69b376c134a73f68e42afd2d97e70a6a..9dde5be4963aca10a74c45dad4f1b2e00693dd16 100755 --- a/SCRIPTS/submit_biascorrection.sh +++ b/SCRIPTS/submit_biascorrection.sh @@ -4,7 +4,7 @@ tmpScripts="./tmpScripts" location="EU" mkdir -p $tmpScripts -for iCurrMonth in $(seq -f "%1g" 1 12); do +for iCurrMonth in $(seq -f "%1g" 1 1); do echo "leadMonth: $iCurrMonth" sed -e "s|<currMonth>|$iCurrMonth|g" \ -e "s|<location>|$location|g" \ @@ -12,6 +12,6 @@ for iCurrMonth in $(seq -f "%1g" 1 12); do sed -e "s|submitscript <- FALSE|submitscript <- TRUE|g" \ -e "s|currMonths <- c(X:X)|currMonths <- c($iCurrMonth:$iCurrMonth)|g" \ -e "s|locName <- 'X'|locName <- '$location'|g" \ - biascorrection.R > $tmpScripts"/biascorrection_"$location"_currMonth"$iCurrMonth".R" + doBiascorrection.R > $tmpScripts"/doBiascorrection_"$location"_currMonth"$iCurrMonth".R" sbatch "$tmpScripts/jobScriptBiascorrection_"$location"_currMonth"$iCurrMonth done diff --git a/SCRIPTS/submit_reformat.sh b/SCRIPTS/submit_reformat.sh index 65250045377814c3faf2d30c1f856ae4f367b2ad..62bd008a97c3add30d3a2ce150183cebf60b3940 100755 --- a/SCRIPTS/submit_reformat.sh +++ b/SCRIPTS/submit_reformat.sh @@ -12,6 +12,6 @@ for iInitMonth in $(seq -f "%1g" 1 12); do 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" \ - reformat.R > $tmpScripts"/reformat_"$location"_initMonth"$iInitMonth".R" + doReformat.R > $tmpScripts"/doReformat_"$location"_initMonth"$iInitMonth".R" sbatch "$tmpScripts/jobScriptReformat_"$location"_initMonth"$iInitMonth done diff --git a/SCRIPTS/submit_regrid.sh b/SCRIPTS/submit_regrid.sh new file mode 100755 index 0000000000000000000000000000000000000000..096eb1352879fc247163429580937807c5264cd4 --- /dev/null +++ b/SCRIPTS/submit_regrid.sh @@ -0,0 +1,17 @@ +#!/bin/bash +tmpScripts="./tmpScripts" +#location="GHA" +location="EU" +mkdir -p $tmpScripts + +for iCurrMonth in $(seq -f "%1g" 1 12); do + echo "leadMonth: $iCurrMonth" + sed -e "s|<currMonth>|$iCurrMonth|g" \ + -e "s|<location>|$location|g" \ + jobScriptRegrid > $tmpScripts"/jobScriptRegrid_"$location"_currMonth"$iCurrMonth + sed -e "s|submitscript <- FALSE|submitscript <- TRUE|g" \ + -e "s|currMonths <- c(X:X)|currMonths <- c($iCurrMonth:$iCurrMonth)|g" \ + -e "s|locName <- 'X'|locName <- '$location'|g" \ + doRegrid.R > $tmpScripts"/doRegrid_"$location"_currMonth"$iCurrMonth".R" + sbatch "$tmpScripts/jobScriptRegrid_"$location"_currMonth"$iCurrMonth +done diff --git a/SCRIPTS/tryReformat.R b/SCRIPTS/tryReformat.R index 1d9edcbcb2102d1b81c1ea9dcb1005e479918621..1f8051096b5ef6f78c68f70799143577ca15edf7 100644 --- a/SCRIPTS/tryReformat.R +++ b/SCRIPTS/tryReformat.R @@ -53,7 +53,6 @@ for (variableName in variables) { variableNameECOMS<-variableName } - print(sprintf("targetMonth: %s, leadMonth: %s, years: %d-%d",month.name[targetMonth], leadMonth, availableTargetYears[1], availableTargetYears[nYears])) oPrefix <- sprintf("%s/%s_forcing_seas15_%s_noBC_E%02d-%02d_%4d-%4d_%02d_LM%d",