Commit c0a02971 authored by Asquith, William H.'s avatar Asquith, William H.

enhancement to ylim computations during testing against the needs for the paper

parent 4c8e0ec7
......@@ -106,9 +106,15 @@ for(i in 1:num.sites) { # MASTER LOOP START: Mloop
}
}
if(TOGGLE.restrict.ylim.to.lev) {
yf <- ifelse(length(lev) <= 2, 3, 1)
ylim <- c(-ylim.dn.buffer*yf,ylim.up.buffer*yf)
ylim <- range(c(ylim,range(lev)), na.rm=TRUE)
ybar <- as.integer(mean(lev, na.rm=TRUE)) # this start up for robustness
if(! is.finite(ybar)) ybar <- 0 # if NAs were only present
if(length(lev) <= 2) { # make a special allowance for just a couple of
ylim <- c(ybar - ylim.dn.buffer, # measurements but perhaps 1 should be
ybar + ylim.up.buffer) # the setting, but here we get something useful
} else {
ylim <- range(lev, na.rm=TRUE) # otherwise
}
ylim <- range(c(ylim,range(lev)), na.rm=TRUE) # yes, range called twice
if(TOGGLE.force.ylim.to.alt) ylim <- range(c(ylim,alt,refalt), na.rm=TRUE)
if(TOGGLE.show.aquifer.bottom) ylim <- range(c(ylim,aqfrBttm), na.rm=TRUE)
if(TOGGLE.show.aquifer.top ) ylim <- range(c(ylim,aqfrTop), na.rm=TRUE)
......@@ -119,7 +125,15 @@ for(i in 1:num.sites) { # MASTER LOOP START: Mloop
if(TOGGLE.show.aquifer.bottom) ylim <- range(c(ylim,aqfrBttm), na.rm=TRUE)
if(TOGGLE.show.aquifer.top ) ylim <- range(c(ylim,aqfrTop), na.rm=TRUE)
}
if(length(lev) > 2) { # we make opposite test to that some lines above to
ylim <- c(ylim[1] - ylim.dn.buffer, # avoid some double counting and
ylim[2] + ylim.up.buffer) # double application of the buffers
}
if(length(ylim.lock.to.this.interval) == 2) ylim <- ylim.lock.to.this.interval
if(diff(ylim) == 0 | is.na(ylim)) {
message(" found a zero range ylim for ", site, " resetting to the buffers")
ylim <- c(-ylim.dn.buffer, ylim.up.buffer) # emergency backup setting
}
options(opts) # resetting the warnings to on again
dupWL <- dupWarnWLvar(TMP$LEV_DT, lev) # days of nonzero std dev of LEV_VA
......
Markdown is supported
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