Workshop 4 -- Generating Forecast using DHM

**Overview**

This workshop introduces the methods of generating streamflow forecast
using DHM on the basis of RDHM calibration results, and demonstrates
D2D. First we explain how to convert RDHM parameters/states to
RDHM-compatible formats. Then we illustrate how to set up segments via
the html interface. We then run IFP to issue forecast for each segment
and examine the run time mods and the use of xdms for looking at the
outputs. Each group is encouraged to repeat the above steps for a second
event. In the end we demonstrate how to generate and view D2D grids.

4a. Preparing DHM data and Running IFP

**Background:**

> Running DHM requires SAC/routing parameters and state variables
> defined. While an RDHM calibration yields the scalar adjustments (i.e.
> multipliers or constants) for parameters and pet, these scalars can
> not be used directly by DHM. As a result, one needs to apply these
> scalars to the a priori grids to generate a set of grids to be used
> for DHM. Meanwhile, the state variable grids from RDHM cover only the
> upstream of a specified outlet whereas DHM requires the grids to cover
> the entire RFC. A grid editor was developed to perform the conversions
> and create the DHM compatible parameter state, and pet grids.

**Using grid editor to generate DHM parameters and states from RDHM
data**

> 1a) Enter /home/wg?/ws4a; where "?" is to be replaced by the assigned
> group
>
> ID. Under the current path, one can find a shell script "runsetup".
> This script is for setting up the tokens needed for the grid editor
> and later on IFP. To run it, type
>
> . runsetup

1b) From the command line

> load the grid editor by typing
>
> run_dhm_grid_editor
>
> 1c) In the grid editor window, one can find five paths.

-   Modify "Output Directory Path" to /home/wg?/ws4a/testData/ABRFC

-   Modify the "State Grids" to /home/wg?/ws4a/RDHM_STATES

-   Modify "Parameter Grids" and "PET Grids" to /home/wg?/ws4a/RDHM_DATA

-   Modify "Connectivity File" to point to
    /home/wg?/ws4a/RDHM_DATA/Connectivity

> 1d) Change the Initial State Date to 2004-04-22 12Z. This sets the
> date for which initial state grids will be created
>
> 1e) Click on "Load Basin IDs" button
>
> 1f) Click on "File" (upper left), select calib4k.card under
>
> 1g) From the dropdown list of basins labeled "Basin ID", select
> "TALO2".
>
> FYI: In this case we are defining the same set of grids for TALO2 and
> all upstream basins (WTTO2 and KNSO2). The basins upstream of TALO2
> can be viewed by after selecting TALO2 and placing the cursor over
> TALO2 in the basin list. If different scalars were defined for
> interior points, we would repeat the process for those basins;
>
> ![](media/image1.png){width="3.6958333333333333in" height="1.66875in"}
>
> 1h) Select "Load Grid Tables"
>
> The first page, under the title "Create Sac Grids", shows all the
> multipliers read from the RDHM input deck "calib4k.card". Click on
> "Create Grids". Wait till it finishes. This would create
> DHM-compatible grids under the output directory specified in the main
> panel. Then, similarly, go to the second and third pages by clicking
> on "Create Kinematic Grids" and "Create PET Grids". One can also
> change the multipliers, or assign constant values to the variables.
>
> 1i) Use the instructions in workshop 1 to use XDMS to view the
> parameter, state, and pet grids created under the output directory
> path
>
> /home/wg?/ws4a/testData/ABRFC/parameters
>
> /home/wg?/ws4a/testData/ABRFC/states
>
> /home/wg?/ws4a/testData/ABRFC/pet

**Run DHM through IFP for an event on April 22, 2004 12Z**

> We will now run DHM for three basins in the KEYWEBBX forecast group.

1.  cd to the directory /home/wg?/ws4a/ifptests and type the following
    command

> *runIFPwithDHMOP-abrfc rls 200404*
>
> This runs a script to do some segment definitions for WTTO2, KNSO2,
> and TALO2 on a set of fs5files from 4/22/2004 and then starts IFP.

2.  In a separate window go to the
    /home/wg?/ws4a/ifptests/test_run_files/input/fcinit directory and
    look at the files with prefix *dhm.tests.\** . These are the input
    files used to add DHM-OPs and other operations to the existing
    segment definitions.

> For WTTO2X:

-   added a DHM-OP to model basin WTTO2

-   added an ADJUST-Q to create a blended time series from the DHM-OP
    simulation and hourly observed flows

-   added a TULSA-PLOT to view the 6 hour simulation, DHM-OP simulation
    and blended time series

> For KNSOX:

-   added a DHM-OP to model basin KNSO2

-   added a CHANGE-T to convert 6 hour observed flows to 1 hour observed
    flows

-   added an ADJUST-Q to blend the DHM-OP simulation and hourly observed
    flows

-   added a PLOT-TUL to view the 6 hour simulation, DHM-OP simulation
    and blended time series

> For TALO2X:

-   added a DHM-OP to model TALO2 using the blended time series (blend
    of DHM-OP simulations and hourly flows) from WTTO2X and KNSOX as
    inflows

-   added a TULSA-PLOT to view the 6 hour simulation, DHM-OP simulation
    and 6 hour blended time series

3.  From IFP, Select the KEYWEBB forecast group and April 22, 2004 7CDT
    as the carryover date. (This corresponds to the date initial state
    grids were created)

4.  Set the following dates:

    a.  End of Observations = April 24, 2002 7CDT

    b.  End of Run=April 25, 2002 7CDT

5.  Select Begin and navigate through the 3 segments we added DHM-OP to

> WTTO2X, KNSO2X, and TALO2X

6.  Look at the results; Although this run goes 1 day into the future,
    only the first 6 hours use gridded QPF (ABRFC has the FUTPRECP
    technique set to 6) the rest of the period uses zero for precip.

> FYI: in the background window will be two sections summarizing the
> DHM-OP run

-   DHM Operation

-   DHM Timing Stats

7.  Exit IFP

**Run DHM through IFP for an event on July 2, 2004**

1.  Re-do all the steps above except using July 2, 2004 7CDT as the
    start date

    a.  In the DHM Grid Spatial Editor select July 2, 2004 12Z

    b.  Run the test script using *runIFPwithDHMOP-abrfc rls 200407*

    c.  In IFP set, End of Observations = July 4, 2002 7CDT

    d.  In IFP set, End of Run=July 5, 2002 7CDT

> [Specify a DHM Precip Mod]{.underline}

2.  Navigate to the WTTO2X forecast group; you will notice the DHM is
    over simulating (it's also too early). Specify a precip mod by
    scaling the precip back 10% (a precip mod of 0.90)

    a.  Modifications Other ModsMod SelectedDPRECIP

    b.  Leave start date unchanged but set end date to 7/2/2002 12Z

    c.  Multiplier = 0.9

3.  Re-run the segment and view the results

> [Specify a DHM SAC State Mod]{.underline}

4.  Navigate to the KNSOX segment, you'll notice during the first 12
    hours of the simulation DHM is responding to the precip, but the
    observations are not.

5.  Reduce the initial upper zone tension and free water contents using
    a DHM Sac State Mod

    a.  Modifications Other ModsMod SelectedDSACST

    b.  Set the UZTWC multiplier = 0.50

    c.  Set the UZFWC multiplier = 0.50

6.  Re-run the segment and view the results

> [Use the Option to Produce Grid Output]{.underline}

7.  Navigate back to the top of the forecast group (ELMA4X)

8.  From the Options Menu turn on Channel Flow DHM output for every 6
    hours of the run period

    a.  OptionsConfigure DHM Grid Output

    b.  Set "Output Grids For" to All DHM Basins in FGROUP

    c.  Set "Start Date" to 07/02/2004 12z

    d.  Set "End Date" to 07/05/2002 12z

    e.  Time Interval to 6 hours

    f.  Grid Type to Channel Flow

9.  Navigate to WTTO2X and Run through the DHM-OP

10. start XDMS and navigate to /data/dhm/\$LOGNAME/channelflow

11. view the grids

    a.  notice the naming convention first date denotes start time,
        second date denotes time of data.

12. In IFP Navigate to KNSOX and run through the DHM-OP

13. refresh XDMS to view the grids (it now contains KNSO2)

14. In IFP Navigate to TALO2X and run through the DHM-OP

15. refresh XDMS to view the grids (it now contains TALO2)

16. Exit IFP

> **Define DHM-OP for ELMA4X; Run it through the 07/02/2004 event**

1.  The first step is to add ELMA4 to the list of basins in the
    connectivity file

    a.  To determine where the operational connectivity file is located
        type:

> *gad dhm_data_dir*

b.  Edit the file named Connectivity in this directory by adding ELMA4
    to the list of basins; the outlet HRAP can be determined through
    XDMS or you can use the instructions in workshop 2

c.  Because ELMA4 is upstream of WTTO2 we already have all the grid data
    we need to run it for the 07/02/2004 event (No need to re-run
    DHMGSE)

```{=html}
<!-- -->
```
2.  Next, add a DHM-OP to the existing ELMA4X segment*.* We will use a
    utility that can define ofs segments from HTML input*:*

    a.  Open the file /home/wg?/ws4a/ifpTests/ifp-abrfc-test-setup2.html
        in a web browser (Mozilla). In this file after the section
        labeled "Defining Modeling Operations" are two groups of :

-   **Start Defining DHM-OP for ELMA4X --** this one has the existing
    segment definition for ELMA4X

```{=html}
<!-- -->
```
-   **Start Defining DHM-OP for WTTO2X** -- this one has the segment
    definition we used to run DHM for the April Event

    a.  In another window open the HTML file in a text editor and for
        the 1^st^ table edit the existing operations table for ELMA4X to
        add a DHM-OP

    b.  For the second table edit the existing DHM-OP in WTTO2X (hint:
        DHM-OP in WTTO2X now needs an inflow to produce the overall
        hydrograph)

3.  In /home/wg?/ws4a/ifpTtests mv the file *ifp-abrfc-test-setup.html*
    to *ifp-abrfc-test-setup.html.orig* and rename the file you just
    edit *ifp-abrfc-test-setup2.html* to *ifp-abrfc-test-setup.html*

4.  Re-run the script *runIFPwithDHMOP-abrfc rls 200407* and navigate to
    the ELMA4X and WTTO2X segments to view the DHM results

**4b. DEMO: Generate and View D2D Grids**

D2D grids are created during batchmode carrysave runs of OFS/FCST;

For this exercise we will execute a test script that runs the necessary
ofs jobs to create D2D grids

1.  cd to /home/wg?/ws4b/

2.  execute the script *run_abrfc_ofs_batch_tests*

3.  The result should be

> ***running ofs tests\.....***
>
> ***46 right, 0 wrong, 0 ignored, 0 exceptions***

4.  To view the ofs output files generated by the script

    a.  In a web browser open the file

> /home/?/ws4b /results/abrfcTest.html

b.  At the bottom of the file are all the ofs output files generated

```{=html}
<!-- -->
```
5.  Start D2D

6.  From the Hydro Menu select DHM

7.  Look at the SAC-STATES, Routed Flow, and Depth Grids created

8.  Use the animation option to cycle through the grids

9.  Look at the Overlays added as part of the DHM enhancements

    a.  Rivers

    b.  Forecast Groups

    c.  Flow Direction