+

Modifying a VELMA SpatialData Pool Using Grid ASCII Map Data

Overview

The contents of a VELMA simulator spatial data pool can be modified at an arbitrary simulation step, or at multiple steps, by specifying "Modify Spatial Data By Map" (shorthand term: "Modify-By-Map") disturbances as part of a simulator run's simulation configuration. Each spatial data pool (and each layer of that pool for multi-layer pools) that is modified must have a separate disturbance specified and parameterized for it, and its own Grid ASCII (.asc) map file available for the disturbance to use as a data source.

Requirements

Adding a Modify-By-Map Disturbance to a Simulation Configuration

  1. In JVelma, with a simulation configuration created or loaded, click/open the menu item: Edit -> Disturbances -> Add a Disturbance

  2. In the Disturbance Model Selector dialog, scroll down through the drop-down selector items list to ModifySpatialDataByMapDisturbanceModel and click/set it as the Disturbance Type.

  3. In the text box next to the "Disturbance Name" prompt, type a name for this specific disturbance.
    The name must be unique, and must also be an valid Xml identifier (e.g., cannot start with a numeral).
    Best practice when selecting a name: avoid whitespaces (use underscore '_' characters instead) and (apart from hyphen and underscore) eschew non-alphanumeric characters.

  4. Click the dialog's OK button.
    This closes the dialog, and adds a new Modify-By-Map item parameterization to your simulation configuration

Configuring a Modify-By-Map Disturbance's Parameters

Modify-By-Map parameters specify ...

When Parameters

Parameter Name Expected Value Description Can leave blank?
initializeActiveLoops One-based Loop number(s) The disturbance can occur only in listed Loops NO
initializeActiveYears Full-digits Year number(s) The disturbance can occur only in listed Years NO
initializeActiveJdays Julian day(s) The disturbance occurs for every listed Jday NO
occursAtStepStart "true" or "false" (without quotes) determines whether the disturbance occurs at the beginning or the end of simulation steps NO

The following rules apply to values for the Loop, Year, and Jdays parameters.

Source Parameters

Parameter Name Expected Value Description Can leave blank?
spatialDataFileFullName A filename The full or partial path+name of a valid Grid ASCII (.asc) map file NO

Unless the specified filename is a fully-specified path + name, it is assumed to be relative to the directory, location specified by the simulation configuration's inputDataLocationRootName/inputDataLocationDirName pair of parameters.

Use forward slash “/” characters as path separators. Also, be very careful with whitespace; if there is any, it must exactly match whatever whitespace is present in the actual path and filename.

Target Parameters

Parameter Name Expected Value Description Can leave blank?
spatialDataName A SpatialData keynames The name of the spatial data pool to modify NO
spatialDataLayer One-based layer index number The layer of the SpatialData NO

When the spatialDataName value specifies a single-layer spatial data pool, the spatialDataLayer value must be set to 1. Setting spatialDataLayer to a value > the number of layers in a spatial data pool is not caught during simulation initialization, but will cause a runtime error.

VELMA SpatialData pool keynames are listed in a separate document.

How Parameters

Parameter Name Expected Value Description Can leave blank?
setCellOutcome "AUGMENT" or "REPLACE" (without quotes) Determines if target value is augmented or replaced by source value NO
setMapValueMode "VALUE" or "FRACTION" (without quotes) Determines if source value should be treated as a fraction or not NO

Combining the setCellOutcome and setMapValueMode parameter's values determines which of the four possible operations a given Modify-By-Map item performs:

setCellOutcome setMapValueMode Operation Performed
AUGMENT VALUE tfinal = tinitial + s
AUGMENT FRACTION tfinal = tinitial + (tinitial * s)
REPLACE VALUE tfinal = s
REPLACE FRACTION tfinal = tinitial * s

In the above table:

Metadata Parameters (Don't Touch!)

Parameter Name Expected Value Description Can leave blank?
modelClass ModifySpatialDataByMapDisturbanceModel Automatically set when JVelma a the Modify-By-Map item parameterization to a simulation configuration NO

The modelClass parameter is special and should never be changed from its initial value. It is used by the simulator to decide what disturbance code to load and run for this Modify-By-Map item parameterization.

An Example Modify-By-Map Parameterization

Parameter Value
initializeActiveLoops 1
initializeActiveYears 1969
initializeActiveJdays 1
occursAtStepStart false
spatialDataName BIOMASS_LEAF_N
spatialDataLayer 1
setCellOutcome REPLACE
setMapValueMode VALUE
spatialDataFileFullName ./Every_Conifer_Cell_80d5.asc
modelClass ModifySpatialDataByMapDisturbanceModel

This example parameterization creates a ModifySpatialDataByMapDisturbanceModel instance that loads data from Grid ASCII map file inputDataLocationRootName/inputDataLocationDirName/Every_Conifer_Cell_80d5.asc and in the first simulation loop, on January 1, 1969 replaces each value of the BIOMASS_LEAR_N spatial data pool with the corresponding value from file Every_Conifer_Cell_80d5.asc. (BIOMASS_LEAR_N is a single-layer pool, so spatialDataLayer's value must be 1.)

Using Modify-By-Map Instead of Set-By-Map

The ModifySpatialDataByMapDisturbanceModel became available in VELMA version 2.1.0.10. Prior to this version the SpatialData modification capability VELMA provided was the SetSpatialDataByMapDisturbance ("Set-By-Map"). Set-By-Map disturbances are functionally equivalent to Modify-By-Map disturbances parameterized with setCellOutcome=REPLACE and setMapValueMode=VALUE.

VELMA still supports Set-By-Map disturbances (for legacy simulation configuration .xml) but now that Modify-By-Map disturbances are available, there is no reason to use Set-By-Map disturbances.