Test runs in Chowan River, land segment A51800, complete for the full meteorology period.
Need to compare the precipitation and runoff (inputs vs. outputs) for trend analysis
Observations/Threads of investigation:
runoff outputs show periods where 5-10 consecutive hours have identical, non-zero, runoff outputs
does precipitation cause this? i.e., is there some steady state input that leads to a steady state output?
example: 1999/11/23
Note: Gopal's recollection is that his tests showed:
Flow ~5% difference when replacing the rainfall and evap without recalibration.
Sediment was 30-40% different
Code Sample
Examine land segment and grid cell annual values for ET, precip, # of days of rainfall
#Script that runs rolling averages function for one segment, and creates plots
#functions used: get_rolling_avg_df, generate_rolling_avg_plots
#last updated 4/14/2022
#inputs: land segment, startDate, and endDate OR grid and year
# startDate formatted YYYYMMDDHH
# endDate formatted YYYYMMDDHH
#load libraries
library(dplyr)
library(sqldf)
library(ggplot2)
#load vahydro functions
site <- "http://deq1.bse.vt.edu:81/d.dh"
basepath <- '/var/www/R';
source(paste(basepath,'config.R',sep='/'))
#source nldas functions
source("https://raw.githubusercontent.com/HARPgroup/HARParchive/master/HARP-2021-2022/lseg_functions.R")
source("https://raw.githubusercontent.com/HARPgroup/HARParchive/master/HARP-2021-2022/get_lseg_data.R")
###########################################if analyzing land segment run these lines below
#declare inputs
landseg <- 'N51125'
startDate <- "1984010100" #formatted YYYYMMDDHH
endDate <- "2020123123" #formatted YYYYMMDDHH
#reading in precip land segment data sets (run these lines if you want to analyze a land segment)
dfLSEG <- get_lseg_data (landseg)
dfPRC <- as.data.frame(dfLSEG$dfPRC)
dfn <- names(dfPRC)
dfn[which(dfn == 'PRC')] <- "precip"
names(dfPRC) <- dfn
#creating table from function using rolling_avg_df
rolling_avg_df <- get_rolling_avg_df(df = dfPRC, metric = "precip")
#creating plots from generate_rolling_avg_precip_plots (change spatial unit input according to your dataframe
plots <- generate_rolling_avg_precip_plots(rolling_avg_df = rolling_avg_df, spatial_unit = landseg)
plots[1]
plots[2]
##########################################if analyzing grid cell run these lines below
#declare inputs
grid <- 'x393y97'
syear <- substr(startDate,1,4)
eyear <- substr(endDate,1,4)
dfPRCall = FALSE
for (iyr in syear:eyear) {
#reading in precip data from grid cell
#dfPRC <- read.table(paste0("http://deq1.bse.vt.edu:81/met/out/grid_met_csv/",year,"/",grid,"zPP.txt"), header = FALSE)
site <- paste0("http://deq1.bse.vt.edu:81/met/out/grid_met_csv/",iyr,"/")
dfPRC <- data.table::fread(paste0(site,grid,"zPP.txt"))
#formatting columns
colnames(dfPRC) = c("year","month","day","hour","precip")
dfPRC$date <- as.Date(
paste(dfPRC$year,dfPRC$month,dfPRC$day,
sep="-")
)
if (is.logical(dfPRCall)) {
dfPRCall <- dfPRC
} else {
dfPRCall <- sqldf(
"SELECT * from (
SELECT * from dfPRCall
UNION
SELECT * from dfPRC
)
ORDER BY date
"
)
}
}
#creating table from function using rolling_avg_df
rolling_avg_df <- get_rolling_avg_df(df = dfPRCall, metric = "precip")
#creating plots from generate_rolling_avg_precip_plots (change spatial unit input according to your dataframe
plots <- generate_rolling_avg_precip_plots(rolling_avg_df = rolling_avg_df, spatial_unit = grid)
plots[1]
plots[3]
Old Model
cp /opt/model/p53/p532c-sova/tmp/wdm/land/for/p532cal_062211/forA51800.wdm ./forA51800.2005.wdm
wdm2text
program to write hourly ascii output from a wdm
wdm name, start year, end year, dsn
forA51800.2005.wdm,1984,2005,111
hourly average = 2.2856659702960450E-004
annual average = 2.0037394622508020
New Model NLDAS2
cp /opt/model/p53/p532c-sova/tmp/wdm/land/for/p532sova_2021/forA51800.wdm ./
wdm2text
program to write hourly ascii output from a wdm
wdm name, start year, end year, dsn
forA51800.wdm,1984,2019,111
hourly average = 1.3342063813832165E-004
annual average = 1.1695653139205275
Code Sample
Examine land segment and grid cell annual values for ET, precip, # of days of rainfall
Old Model
New Model NLDAS2
River Outflow
cp /opt/model/p53/p532c-sova/tmp/wdm/river/p532cal_062211/stream/MN0_8300_0001.wdm /tmp/
wdm2text
MN0_8300_0001.wdm,1984,2005,111
hourly average = 2.1476840442589005
annual average = 18827.76979599766
hourly average = 1.8698882733605888
cp /opt/model/p53/p532c-sova/tmp/wdm/river/p532sova_2021/stream/MN0_8300_0001.wdm /tmp/
wdm2text
MN0_8300_0001.wdm,1984,2019,111
annual average = 16391.440604278920