Skip to content

Output

Output variables, locations and times.

XBeach output.

logger module-attribute

logger = logging.getLogger(__name__)

Output pydantic-model

Output(**data: Any)

Bases: XBeachBaseModel

XBeach output configuration.

XBeach supports four different types of output: 1) instantaneous spatial output 2) time-averaged spatial output 3) fixed point output or 4) run-up gauge output. In principle any variable in XBeach can be outputted as long as it is part of the spaceparams structure defined in variables.f90 in the XBeach source code.

This class simplifies output configuration by using list fields (meanvars, globalvars, pointvars, points, rugauges) to define variables and locations. The corresponding count keywords (nmeanvar, nglobalvar, npointvar, npoints, nrugauge) are automatically set based on list lengths when generating params.txt. Empty lists disable that output type.

Instantaneous spatial output

Instantaneous spatial output (globalvars) describes the instantaneous state of variables across the entire model domain at various points in time.

Time-averaged spatial output

Time-averaged spatial output (meanvars)describes the time-averaged state of variables across the entire model domain at various points in time. The user can define the averaging period using the tintm field.

Fixed point output

Fixed point output (pointvars) allows the user to select one or more locations for which a time series of data is stored. This output describes a time-series of one or more variables at one point in the model domain. To make use of this option, the user must specify the output locations using the points field describing the location coordinates given as the x-coordinate and y-coordinate and in world coordinates. XBeach will link the output location to the nearest computational point.

Run-up gauge output

Run-up gauge output describes a time-series of a number of variables at the (moving) waterline. In this case XBeach scans in an x-directional transect defined by the user for the location of the waterline. Output information is recorded for this moving point. This is particularly useful to keep track of run-up levels in cross-shore transects.

The definition of run-up gauges is similar to the definition of fixed point output. The user needs to specify the run-up gauge locations using the rugauges field, describing the coordinates of the initial location of the run-up gauge. XBeach will subsequently link the initial run-up gauge location to the nearest computational cross-shore transect rather than just the nearest computational point.

Run-up gauges share their selection of output variables with regular point output. However, in the case of run-up gauges, XBeach will automatically also include the variables xw, yw and zs to the point output variables, if these variables were not specified using the npointvar keyword in params.txt. Note that the user should refer to the pointvars.idx output file to check order of output variables for points and run-up gauges.

See https://xbeach.readthedocs.io/en/latest/xbeach_manual.html#output-selection for more information.

Fields:

Validators:

model_type pydantic-field

model_type: Literal['output'] = 'output'

Model type discriminator

outputformat pydantic-field

outputformat: Optional[
    Literal["fortran", "netcdf", "debug"]
] = "netcdf"

Output file format (XBeach default: fortran)

outputprecision pydantic-field

outputprecision: Optional[Literal["single", "double"]] = (
    None
)

Netcdf output precision (XBeach default: double)

ncfilename pydantic-field

ncfilename: Optional[str] = None

Xbeach netcdf output file name (XBeach default: xboutput.nc)

meanvars pydantic-field

meanvars: list[OutputVarsEnum] = []

Mean output variables (sets nmeanvar and variable list in params.txt)

globalvars pydantic-field

globalvars: list[OutputVarsEnum] = []

Global output variables (sets nglobalvar and variable list in params.txt)

points pydantic-field

points: list[tuple[float, float]] = []

Point locations as (x, y) coordinate pairs (sets npoints and point coordinates in params.txt)

pointvars pydantic-field

pointvars: list[OutputVarsEnum] = []

Point output variables (sets npointvar and variable list in params.txt)

rugauges pydantic-field

rugauges: list[tuple[float, float]] = []

Runup gauge locations as (x, y) coordinate pairs (sets nrugauge and gauge coordinates in params.txt)

nrugdepth pydantic-field

nrugdepth: Optional[int] = None

Number of depths to compute runup in runup gauge

rugdepth pydantic-field

rugdepth: Optional[float] = None

Minimum depth for determination of last wet point in runup gauge (XBeach default: 0)

timings pydantic-field

timings: Optional[bool] = None

Switch enable progress output to screen (XBeach default: True)

tstart pydantic-field

tstart: Optional[float] = None

Start time (s) of output, in morphological time (XBeach default: 0)

tintc pydantic-field

tintc: Optional[float] = None

Interval time (s) of cross section output (XBeach default: -123)

tintg pydantic-field

tintg: Optional[float] = None

Interval time (s) of global output (XBeach default: tint, 900 s), the first output is given at tstart

tintm pydantic-field

tintm: Optional[float] = None

Interval time (s) of mean, var, max, min output (XBeach default: tstop - tstart), the first output is given at tstart+tintm and represents the average condition over the interval between tstart and tstart+tintm

tintp pydantic-field

tintp: Optional[float] = None

Interval time (s) of point and runup gauge output (XBeach default: 1), the first output is given at tstart

tinth pydantic-field

tinth: Optional[float] = None

Output interval (s) for writing hotstart files (XBeach default: 0). If not specified or 0, hotstart is written only at the end of simulation.

writehotstart pydantic-field

writehotstart: Optional[bool] = None

Write hotstart files during simulation (XBeach default: 0). Hotstart files can be used to initialize a subsequent simulation.

tsglobal pydantic-field

tsglobal: Optional[XBeachDataBlob] = None

File source containing timings of global output

tsmean pydantic-field

tsmean: Optional[XBeachDataBlob] = None

File source containing timings of mean, max, min and var output

tspoints pydantic-field

tspoints: Optional[XBeachDataBlob] = None

File source containing timings of point output

projection pydantic-field

projection: Optional[str] = None

Projection string specifying the coordinate reference system. Stored in netCDF output file as metadata. Does not influence model results.

remdryoutput pydantic-field

remdryoutput: Optional[bool] = None

Switch to remove dry output points from output data of zs etc (XBeach default: 1)

rotate pydantic-field

rotate: Optional[bool] = None

Switch to rotate output as postprocessing with angle specified by grid alfa (XBeach default: 1)

params property

params: dict

Return the XBeach parameters as a flat dictionary.

check_no_duplicate_variables pydantic-validator

check_no_duplicate_variables(v, info)

Validate that variable lists don't contain duplicates.

check_variable_limits pydantic-validator

check_variable_limits(v, info)

Validate that variable lists don't exceed XBeach limits.

validate_point_output_consistency pydantic-validator

validate_point_output_consistency() -> Output

Validate consistency between pointvars and point/rugauge locations.

fixed_or_file_times pydantic-validator

fixed_or_file_times() -> Output

Validate that either fixed times or file times are specified.

serialize_timings

serialize_timings(value: Optional[bool])

Serialise bool to int.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

get

get(destdir: str | Path) -> dict

Return the params dict with file fetching for nested components.

This method handles two types of nested components: 1. Components with explicit parameter fields: Need special handling to extract the field value and merge remaining params 2. Discriminated union components: Already flattened by the serializer

The default implementation: - For components with explicit fields: includes that field in return dict - For discriminated unions or leaf components: returns standard params - For parent components: processes XBeachBaseModel children recursively

XBeachDataBlob fields are fetched into destdir and written as the file name under the field name. Override this method only for other file handling, such as fetching several files from a directory.

Parameters:

Name Type Description Default
destdir str | Path

Directory path for file operations.

required

Returns:

Type Description
Flat dictionary of XBeach parameters.