-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
This is the routine to create area weighted usgs gage area weighted flow time series, formatted compatible with om column names to allow as much crossover in analytical routines as possible. This could be a separate model, but we will keep it as a sub-module of om for the time being. See overview here: https://github.com/HARPgroup/vahydro/issues/227
- usgs
- Ex:
run_model om [scenario] [gage id]_[riverseg] auto usgs - Ex:
run_model om 400 01646000_PM7_4581_4580 auto usgs - prep
- Sets up the USGS model to include DA and gage id and scale factor saved to database
- Ex:
run_model om 400 01646000_PM7_4581_4580 auto usgs prep
- run
- **01
- link TBD
- Ex:
- Analysis:
- See
Running Models
- iterate through a list of weighted models (can also add more, and should!)
Potomac River
fgrep PM /opt/model/p6/vadeq/input/calib/allstations.csv > /tmp/potomac_calib.csv
fgrep PU /opt/model/p6/vadeq/input/calib/allstations.csv >> /tmp/potomac_calib.csv
fgrep PS /opt/model/p6/vadeq/input/calib/allstations.csv >> /tmp/potomac_calib.csv
while IFS="," read sta_id riverseg name; do
number=$(echo "$sta_id" | grep -oE '[0-9]+([.][0-9]+)?')
n=${#sta_id}
if [[ $n -lt 7 ]]; then
continue
fi
if [[ "$sta_id" == "$number" ]]; then
gm_hydrocode="0${sta_id}_${riverseg}"
echo "run_model om usgs $gm_hydrocode auto usgs "
sbatch run_model om usgs $gm_hydrocode auto usgs
fi
done < /tmp/potomac_calib.csv
James River Stations
- Find the options for USGS gages in R
basepath='/var/www/R';
source(paste(basepath,'config.R',sep='/'))
library('stringr')
jame_gages <- sqldf(
"select * from dh_feature
where bundle = 'usgsgage'
and (
(hydrocode like 'usgs_0201%')
OR (hydrocode like 'usgs_0202%')
OR (hydrocode like 'usgs_0203%')
)",
connection = ds$connection
)$hydrocode
calib_stations <-data.frame(
gage_id = character,
riverseg = character,
name = character
)
for (gage_hc in (jame_gages)) {
gage_feature <- RomFeature$new(ds,list(hydrocode=gage_hc, bundle='usgsgage'),TRUE)
gage_id = str_remove(gage_hc, 'usgs_')
rsegs <- gage_feature$find_spatial_relations(
inputs=list(
bundle='watershed',ftype='vahydro'
),
operator = 'st_within',
TRUE)
# just take the first if there are multiple
if (nrow(rsegs) > 0) {
riverseg <- str_remove(rsegs[1,]$hydrocode,'vahydrosw_wshed_')
name <- rsegs[1,]$name
calib_stations <- rbind(
calib_stations,
data.frame(
gage_id = gage_id,
riverseg = riverseg,
name = name
)
)
}
}
write.csv(calib_stations, file='/var/www/html/files/cbp/calib_james.csv', row.names=FALSE,quote=FALSE)
- Now process
while IFS="," read sta_id riverseg name; do
number=$(echo "$sta_id" | grep -oE '[0-9]+([.][0-9]+)?')
n=${#sta_id}
if [[ $n -lt 7 ]]; then
continue
fi
if [[ "$sta_id" == "$number" ]]; then
sta_id=`printf %8s $sta_id | tr ' ' 0`
gm_hydrocode="${sta_id}_${riverseg}"
echo "run_model om usgs $gm_hydrocode auto usgs "
sbatch run_model om usgs $gm_hydrocode auto usgs
fi
done < /var/www/html/files/cbp/calib_james.csv
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels