Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Include Page
ContentHeader
ContentHeader

XBeach structure

A few very specific functions in the XBeach Toolbox just return the desired result. If any flexibility of the returned value is needed, the XBeach structure is used. For example, the result of the xb_read_input function, which reads an entire model input, returns such a structure. Several XBeach structures can be nested into each other. The xb_human collection of functions provides low-level interaction functions for the XBeach structure.

Format

An example of a full-formatted XBeach structure is given below. The "data" field contains the actual data. All other fields contain meta-information added by the several toolbox functions.

Code Block
xb = struct(
    'date',     '01-Dec-2010 00:00:00'
    'function', 'xb_read_input',
    'type',     'input',
    'file',     'C:\path_to_model\params.txt',
    'data',     [1x7 struct]
);

The field "data" contains a structure array, which contains the actual data. An example of such structure array is:

Code Block
data = struct(
    'name',  {'nx', 'ny', 'xfile',      'yfile',      'depfile',    'xori', 'yori' },
    'value', {200,  3,    [1x1 struct], [1x1 struct], [1x1 struct], 12345,  67890  },
    'units', {[],   [],   [],           [],           [],           'm',    'm'    }
);

The fields "xfile", "yfile" and "depfile" are nested XBeach structures, which can look like this:

Code Block
bathy = struct(
    'date',     '01-Dec-2010 00:00:00'
    'function', 'xb_read_bathy',
    'type',     'bathymetry',
    'file',     {'C:\path_to_model\x.grd', 'C:\path_to_model\y.grd', 'C:\path_to_model\bed.dep'},
    'data',     [1x3 struct]
);

Again, all fields contain meta-information except the "data" field. The "data" field contains a structure array which can look like this:

Code Block
data = struct(
    'name',  {'xfile',        'yfile',        'depfile'      },
    'value', {[200x3 double], [200x3 double], [200x3 double] },
    'units', {'m',            'm',            'm'            }
);

Usage

The xb_human function collection provides low-level functions to interact with the XBeach structure. The most important functions are described in the following table:

Function

Description

xb_empty

Returns an empty XBeach structure

xb_set

Sets one or more specific fields in a XBeach structure or nested structure

xb_get

Returns one or more specific field values from a XBeach structure or nested structure

xb_meta

Sets meta-information in XBeach structure (date, function, type and filenames)

xb_check

Returns a boolean indicating if the supplied variable is a valid XBeach structure

xb_show

WHOS-like display of XBeach structure or nested structures with regexp-based filtering