Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Directory Structure details #4

Open
Tracked by #1
rburghol opened this issue Sep 23, 2022 · 0 comments
Open
Tracked by #1

Plugin Directory Structure details #4

rburghol opened this issue Sep 23, 2022 · 0 comments

Comments

@rburghol
Copy link
Contributor

rburghol commented Sep 23, 2022

  • Each model must have 2 modules defined
    • land: land surface simulation
    • river: riverine simulation
    • TBD: later we can add more modules if needed, like "atmosphere"
  • Each module must have 4 sub-directory steps: prep, run, post, analyze
    • models/[model name]/river/
      • models/[model name]/river/prep/
      • models/[model name]/river/run/
      • models/[model name]/river/post/
      • models/[model name]/river/analyze/
    • models/[model name]/land/
      • models/[model name]/land/prep/
      • models/[model name]/land/run/
      • models/[model name]/land/post/
      • models/[model name]/land/analyze/
  • Each step can have 0 to N sub-module scripts.
    • Each script will get 3 arguments: scenario, segment, and tempdir
      • tempdir is the runtime directory
      • global runtime vars are:
        • MODEL_ROOT
        • MODEL_BIN
        • META_MODEL_ROOT
        • SCRIPT_DIR
        • MODEL
        • START_YEAR
        • END_YEAR
      • all plugins written in csh can access detailed model configuration info by doing this: source $META_MODEL_ROOT/models/$MODEL/model_config
    • Ex: the run step of the river module of the model hsp2_cbp6, i.e. implementation of the CBP6 model in hsp2:
      • models/hsp2_cbp6/river/run/00_init
      • models/hsp2_cbp6/river/run/02_confluence
      • models/hsp2_cbp6/river/run/03_upstream
      • models/hsp2_cbp6/river/run/04_ps_sep_div
      • models/hsp2_cbp6/river/run/05_compare
      • models/hsp2_cbp6/river/run/07_get_uci
      • models/hsp2_cbp6/river/run/08_run_river
      • models/hsp2_cbp6/river/run/09_synch_wdm
      • models/hsp2_cbp6/river/run/10_res_typeII
      • models/hsp2_cbp6/river/run/11_scour_org

Example analyze module script

From https://github.com/HARPgroup/meta_model/blob/main/models/hsp2_cbp6/river/analyze/01_hydr

#!/bin/csh
# Run post-process extract routine
set scenario=$1
set segment=$2
set seg=$segment # this is for backwards compatibility with scripts source
set tempdir=$3
# Load configuration, includes such things as CBP_EXPORT_DIR and MODEL_VERSION_CODE
source $META_MODEL_ROOT/models/$MODEL/model_config
cd $tempdir

if (! $?MODEL_VERSION_CODE) then
  echo "Variable MODEL_VERSION_CODE is not defined. Cannot push results to REST" >> problem
  exit
endif

# todo: add the call to run the river hsp2 summary script here
echo "Notice(analyze): Rscript $MODEL_ROOT/run/export/hsp_hydr_analysis.R $seg $scenario $CBP_EXPORT_DIR/river/$scenario/hydr/ $CBP_EXPORT_DIR/river/$scenario/hydr/images/ $MODEL_VERSION_CODE"
Rscript $MODEL_ROOT/run/export/hsp_hydr_analysis.R $seg $scenario $CBP_EXPORT_DIR/river/$scenario/hydr/ $CBP_EXPORT_DIR/river/$scenario/hydr/images/ $MODEL_VERSION_CODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant