Skip to content

Observation cross section files

Observation cross section files come in two flavours:

Observation cross section .ini files

The obscrosssection module provides the specific logic for accessing observation cross section .ini files. for a D-Flow FM model.

Generic parsing and serializing functionality comes from the generic hydrolib.core.dflowfm.ini modules.

An observation cross section .ini file is described by the classes below.

Model

ObservationCrossSection (INIBasedModel) pydantic-model

The observation cross section that is included in the observation cross section file.

All lowercased attributes match with the observation cross section output as described in [UM Sec.F2.4.1] (https://content.oss.deltares.nl/delft3dfm1d2d/D-Flow_FM_User_Manual_1D2D.pdf#subsubsection.F.2.4.1)

validate_that_location_specification_is_correct(values: Dict) -> Dict classmethod

Validates that the correct location specification is given.

Source code in hydrolib/core/dflowfm/obscrosssection/models.py
@root_validator(allow_reuse=True)
def validate_that_location_specification_is_correct(cls, values: Dict) -> Dict:
    """Validates that the correct location specification is given."""
    return validate_location_specification(
        values,
        config=LocationValidationConfiguration(
            validate_node=False, minimum_num_coordinates=2
        ),
    )

ObservationCrossSectionGeneral (INIGeneral) pydantic-model

The observation cross section file's [General] section with file meta data.

ObservationCrossSectionModel (INIModel) pydantic-model

The overall observation cross section model that contains the contents of one observation cross section file.

Legacy observation cross section .pli files

Legacy .pli files for observation points are supported via the generic polyfile module.

A polyfile (hence also an observation cross section .pli file) is described by the classes below.

Model

models.py defines all classes and functions related to representing pol/pli(z) files.

Description (BaseModel) pydantic-model

Description of a single PolyObject.

The Description will be prepended to a block. Each line will start with a '*'.

Attributes:

Name Type Description
content str

The content of this Description.

Metadata (BaseModel) pydantic-model

Metadata of a single PolyObject.

Attributes:

Name Type Description
name str

The name of the PolyObject

n_rows int

The number of rows (i.e. Point instances) of the PolyObject

n_columns int

The total number of values in a Point, including x, y, and z.

Point (BaseModel) pydantic-model

Point consisting of a x and y coordinate, an optional z coordinate and data.

Attributes:

Name Type Description
x float

The x-coordinate of this Point

y float

The y-coordinate of this Point

z Optional[float]

An optional z-coordinate of this Point.

data Sequence[float]

The additional data variables of this Point.

PolyFile (ParsableFileModel) pydantic-model

Poly-file (.pol/.pli/.pliz) representation.

PolyObject (BaseModel) pydantic-model

PolyObject describing a single block in a poly file.

The metadata should be consistent with the points: - The number of points should be equal to number of rows defined in the metadata - The data of each point should be equal to the number of columns defined in the metadata.

Attributes:

Name Type Description
description Optional[Description]

An optional description of this PolyObject

metadata Metadata

The Metadata of this PolObject, describing the structure

points List[Point]

The points describing this PolyObject, structured according to the Metadata

Back to top