Quick-start Guide for Adding an External Module in FEWS

This quick-start guide serves as an example processes for setting up an external module to run in FEWS. It includes the main tasks required to successfully implement any external module, but is in no way fully comprehensive for all modules. As every module is unique, more specific aspects may be required. There are wiki pages for Delft-FEWS Model adapters by Deltares supported by Deltares and there is an overview of  Models linked to Delft-FEWS.
These steps do not necessarily need to be performed in the order presented.

Assumptions

1. You are using a FEWS-compliant module adapter
2. Data pre and post-processing is not included here.

Steps

1. Use the generalAdapter configuration file to organize the overall structure of your module run. :

General questions to ask are:

  1. What input data is required?
    1. What, if any, of this input data must be provided by FEWS?
      This includes time series data, gridded data, restart files, and additional parameters required by the module.
  2. What is the desired output?
    1. What, if any, of this data must be viewable/used by FEWS?
      This includes time series data, gridded data, and restart files.
  3. Over what period should the model run?
    1. As a hindcast, as a forecast, from a warm state and from a cold state?
      This is specified in the relativeViewPeriod.
  4. How does the model software work and what model definition files are required as input?
  5. How is the model grid defined?

Examples of the generalAdapter for several module adapters can be found here: Delft-FEWS Model adapters by Deltares

2. Add the generalAdapter to the moduleInstanceDescriptors.xml file

Note: as of FEWS version 2014.01 specification of the <moduleId> is no longer required.

More information can be found here: ModuleInstanceDescriptors

3. Create an IdMapFile for the generalAdapterRun

In the IdMapFile all parameters and locations must be mapped between the internal FEWS name and external module name.  If both FEWS and the module use the same parameter and location names (case sensitive) then the EnableOneToOneMapping function can be used instead.

4. Define the file structure of the module in FEWS

External modules in FEWS are structured in the following way:

%REGION_HOME%/Modules/ bin
                     / adapter_bin
                     / module_directory	Note: The module directory should be defined in with a moduleInstanceId

The module_directory/ may be configured in a variety of ways depending on the module structure. Here is an example:

module_directory / toModel      Data from FEWS as input to the module
                 / toFews       Data from the module as export to FEWS
                 / states	States to be passed between FEWS and the module
                 / diagnostics  Directory in which diagnostic files from the FEWS pre-and post adapters are written
                 / workDir	Directory in which module is run, including
                                  - static input files not passed by FEWS, such as bathymetry, observation points, etc.
                                  - model definition template file
5. Create a moduleDataSet file

Copy the module directory to a zipped directory named the same as the moduleInstanceId. Place the zipped directory in the %REGION_HOME%/config/moduleDataSets directory.

6. Add the moduleDataSet file to the moduleInstanceDescriptors.xml file

Note: as of FEWS version 2014.01 specification of the <moduleId> is no longer required.

More information can be found here: ModuleInstanceDescriptors\

7. Create a cold state file if necessary

Copy this file to the %REGION_HOME%/conifg/ColdStates directory

8. Define the module grid in the grids.xml file

More information can be found here: Grids

9. Define the module locations using the locationSets.xml and locations.xml files

More information about locations and locationSets can be found here: Regional Configuration

10. Create a workflow to run the module

More information can be found here: Configuring WorkFlows

11. Add the workflow to the workflowDescriptors.xml file

More information can be found here: WorkflowDescriptors

12. Refresh your configuration and run the module workflow using the Manual Forecast function in the FEWS Explorer

Hit F5 in FEWS to refresh the configuration.

13. Troubleshooting tips

It is likely that a module will not run correctly on the first try. The first step in troubleshooting is to make sure the model runs  without errors outside of the FEWS environment.

If the model runs without error outside of Delft-FEWS, the cause is likely in your configuration. Here are some general tips on de-bugging the configuration.