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

Add switch to use hsp2 executable #64

Open
6 of 33 tasks
rburghol opened this issue Jul 1, 2022 · 2 comments
Open
6 of 33 tasks

Add switch to use hsp2 executable #64

rburghol opened this issue Jul 1, 2022 · 2 comments
Assignees

Comments

@rburghol
Copy link
Collaborator

rburghol commented Jul 1, 2022

Tasks/Status

  • Make code handle HSP_VERSION variable
    • p5 lug
    • p532 run_land.csh,
      • run hsp2
      • run export script,
      • delete H5
    • p5 rug
    • p532 run_river.csh
      • run hsp2
      • run export script
      • delete H5
    • p6 lug
      • bhatt_run_lug_oneseg.csh
      • bhatt_run_lug_INFEXP_quiet_oneseg.csh
      • dangit, must intercept these scripts with a single function call
    • p6 run_land.csh bhatt_run_land_oneseg.csh
      • run export script
      • delete H5
    • p6 rug -- where is this called? not in bhatt_one_command_wsm.csh??
    • p6 run_river.csh
      • run_river_oneseg.csh
      • run_river_oneseg_calib.csh
      • run export script
      • delete H5
    • bhatt_one_command_wsm.csh
      • Note: the location of bhatt_one_command_wsm.csh is determined by the scenario script ".con" file. As of 7/2022 we are using the following path entries:
        • set PROJECT_HOME = /opt/model/p6/gb604b
        • set MY_HOME = run_bhatt
        • set SCRIPT_DIR = OneCommandWSM_P6_STRLOAD_SCENCF
      • Do we need to pass executable variable to run_all p6?: p6 bhatt_one_command_wsm.csh $SCENARIO $SCENARIO_SLURM $SCENARIO_LOG
  • Make the setting of HSP_VERSION set in environment variables from
    • As exported env variable before running script
    • hspf.config: if we want it globally - does not yet work since this ends up overwriting the exported ENV variable until we get reading into control files
    • config/scripts/[scenario].con
      • P6: verify this is as easy as put it in the script/*.con, and eliminate the directives to look for set_hspf_icprb ...commands
      • P5: Must figure out the best place to load the script/*.con file.
  • Ultimately we want to have the ability to run multiple post-processing routines depending on object class (landseg, riverseg), and also customizable attached post-proceesing sripts in the database.

Code

  • hsp_uci_version: converts a UCI from hspf to hsp2 or vice versa

    • Use: hsp_uci_version [uci file full path] [hsp version]
    • Ex: hsp_uci_version ~/working/modeling/hsp2/test_cbp/forA51800.uci hsp2
    • Used in p532 run/standard/run_lug.csh
  • hspf_config: Looks for a scenario argument(2nd arg, $1), and if it finds it, will look for a config/control/scripts/[scenario].con file to load csh variables. Has code to translate CSH formatted vars to bash (eliminate the set prefix)

    • Should this move to it's own generic function?
    • See: find_scenario_fragment: and migrate code here perhaps?
  • Implementation:

    • cbp script runs hspf_config
    • Create script hspf_to_hsp2 to overhaul the UCI
    • set environment variable "HSP_VERSION=hsp2" or "HSP_VERSION=hspf"
    • export environment variable before running
    • If version = hsp2 then modify UCIs after generating
    • if HSP_VERSION is not set, set default HSP_VERSION=hspf
    • running:
      • p5 Ex: HSP_VERSION="hsp2";export HSP_VERSION;cbp run_land.csh hsp2_2022 OR4_8120_7890

Converting UCI

This is a quick and dirty implementation using sed, since initial testing has only shown a single line being incompatible.

cat ~/working/modeling/hsp2/test_cbp_river/OR1_7700_7980.uci |sed "s/RESUME     0 RUN     1                   UNIT SYSTEM     1/RESUME     0 RUN     1                   UNIT SYSTEM     1/"`

Code: hsp_uci_version

Convert to hsp2 and back to hspf.

hsp_uci_version ~/working/modeling/hsp2/test_cbp/forA51800.uci hsp2
converting /home/rob/working/modeling/hsp2/test_cbp/forA51800.uci to hsp2
head /home/rob/working/modeling/hsp2/test_cbp/forA51800.uci

RUN

GLOBAL
  A51800     for | P5 | p532sova_2 | VA,SUFFOLK
  START       1984/ 1/ 1        END    2019/12/31
  RUN INTERP OUTPUT LEVEL    0    0
  RESUME     0 RUN     1                   UNIT SYSTEM     1
END GLOBAL

FILES

hsp_uci_version ~/working/modeling/hsp2/test_cbp/forA51800.uci hspf
converting /home/rob/working/modeling/hsp2/test_cbp/forA51800.uci to hspf

head /home/rob/working/modeling/hsp2/test_cbp/forA51800.uci
RUN

GLOBAL
  A51800     for | P5 | p532sova_2 | VA,SUFFOLK
  START       1984/ 1/ 1        END    2019/12/31
  RUN INTERP OUTPUT LEVEL    0    0
  RESUME     0 RUN     1 TSSFL    15 WDMSFL   16
END GLOBAL

FILES
@rburghol
Copy link
Collaborator Author

rburghol commented Jul 6, 2022

Find the code that sets the GLOBAL lines: fgrep RESUME ./code/src/* -R| grep RUN|grep line

@rburghol
Copy link
Collaborator Author

rburghol commented Aug 26, 2022

  • run_land.csh works with hsp2: cbp run_land.csh CFBASE30Y20180615_vadeq JL2_6850_6890
  • but cannot run_lug.csh: cbp run_lug.csh CFBASE30Y20180615_vadeq JL2_6850_6890
special action flag I
  not programmed for modules in
  pp/src/lug/lspecact.f

Problem: Cannot run in old mode (run_river.csh) in p6.

  • error:

  • Same error happens when I try to run the p6 scripts manually, so maybe I am missing a path?

  • but this DOES work:

    • cd run_bhatt/OneCommandWSM_P6_STRLOAD_SCENCF
    • ./bhatt_run_lug_INFEXP_quiet_oneseg.csh CFBASE30Y20180615_vadeq H51125 RWB
    • note: RWB is a dummy for the log file
  • This also works:

    • cp run_bhatt/OneCommandWSM_P6_STRLOAD_SCENCF/bhatt_run_lug_INFEXP_quiet_oneseg.csh ./run/standard/
    • ./bhatt_run_lug_INFEXP_quiet_oneseg.csh CFBASE30Y20180615_vadeq H51125 RW
  • model directory is OneCommandWSM_P6_STRLOAD_SCENCF/

  • script is located in https://github.com/HARPgroup/cbp_wsm/blob/p61st/run_bhatt/OneCommandWSM_P6_STRLOAD_SCENCF/bhatt_one_command_wsm.csh

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

2 participants