Commit 283d0567 authored by Franssen, Wietse's avatar Franssen, Wietse
Browse files

set negative precip values to zero in 'reformat' and 'regrid'

parent 4daff33f
......@@ -31,7 +31,6 @@ if (submitscript) {
variables<-names(variableInfo)
#variables<-c( "pr" , "psl" , "rsds" , "rlds" , "tasmin","tasmax", "huss" , "sfcWind")
#variables<-c( "pr", "sfcWind")
dir.create(outPath, recursive = TRUE, showWarnings = FALSE)
leadMonths<-c(0:6)
......@@ -58,13 +57,16 @@ for (initMonth in initMonths) {
initYears[1], initYears[length(initYears)],
currMonth, leadMonth)
print(oPrefix)
#####################
RData<-RDataAllLeadMonths[[paste0("LeadMonth_",leadMonth)]]
# print(RData$InitializationDates)
# print(RData$Dates$start)
####################
## set all negative precipitation values 0
if (variableName == "pr") {
RData$Data[RData$Data < 0] <- 0
}
RData$xyCoords$x[]<-round(RData$xyCoords$x[],2)
RData$xyCoords$y[]<-round(RData$xyCoords$y[],2)
......
......@@ -55,6 +55,11 @@ for (variableName in variables) {
print(sprintf("Regridding..."))
RData <- interpGridData(RData, new.grid = newGrid, method = "bilinear");
## 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_%4d-%4d_%02d_LM%d.RData",
outPath, variableName, locName,
members[1], members[length(members)],
......
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