HARPgroup / meta_model

0 stars 0 forks source link

Meta-model Runtime Components #1

Open rburghol opened 2 years ago

rburghol commented 2 years ago

Tasks

Plug-in function design

Object class summary scripts

other function naming conventions considered

  1. Directory based with identical plugin names, ie.:
    • ./models/[model name]/export_land
    • ./models/[model name]/summary_river
    • ./models/[model name]/etm
    • Ex: ./models/hsp2/summary_river
  2. Functional description for the Scripts that do CBP model integration steps, exports and data alias translations, and which call summary script. These should be defined with the naming convention to indicate function as well as model domain, i.e.,
    • cbp_etm_hsp2 (currently not used)
    • cbp_land_export_hsp2: will do the post-processing of land export files
    • cbp_river_export_hsp2: will do the post-processing of river export files
    • cbp_river_summary_hsp2: will do the summary stats/REST setting of export files
    • cbp_river_stream_hsp2: will perform the translation of hydro to w
rburghol commented 2 years ago
#/bin/bash
# load environment if not already loaded
if (! $?SCRIPT_DIR) then
  . hspf_config
  source $CBP_ROOT/config/control/script/${scenario}.con
endif

scenario=$1
segment=$2
# set up places to look for plugins
model_plugins=$CBP_ROOT/plugins/$model
module="river"
for steps in "prep run postproc analyze"; do
  if [ -d $model_plugins/$module/$steps ]; then
    for plugin in `ls $model_plugins/$module/$steps/`; do
      $model_plugins/$module/$steps/$plugin $scenario $segment
    done
  fi
done
rburghol commented 2 years ago

Use examples:

Arguments:

rburghol commented 2 years ago

This now works:

/opt/model/meta_model/run_model hsp2_cbp6 vadeq_2021 JL3_7090_7150 test river
rburghol commented 2 years ago

script to insert positional script.


model_bump step 

#!/bin/bash
inpos=$1
nextpos=$((inpos + 1))
# if there are no files in the next slot, we just move this slots files up one
# otherwise, we shuffle everything up 1 slot
i=98
while [ $i -ge $inpos ] ; do
  j=`printf "%02g" $i`
  echo "$j"; 
  movers=`ls ${j}_* 2>/dev/null`
  for onefile in $movers; do
    num=${onefile:0:2}
    newnum=$((10#$num + 1))
    newindex=`printf "%02g" $newnum`
    newfile=${onefile/$num/$newindex}
    echo "Moving: $onefile $newfile"
    mv $onefile $newfile
  done
  i=$((i - 1))
done
rburghol commented 2 years ago

Examples:

rburghol commented 2 years ago

Run only the organic scour routine (not needed for hydro only, but if there are errors, this can be examined):

/opt/model/meta_model/run_model hsp2_cbp6 hsp2_2022 JL1_7080_7190 h2_test river run 11_scour_org
rburghol commented 2 years ago