Skip to content

Water levels

Tide and water level forcing, written as the XBeach zs0file.

XBeach water level and tide forcing.

logger module-attribute

logger = logging.getLogger(__name__)

ZS0Mixin

Mixin class for zs0file parameters.

Namelist

  • zs0file : str Name of tide boundary condition series.
  • tideloc : int Number of corner points on which a tide time series is specified.
  • tidelen : int Number of time steps in the tide time series.

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.

WaterLevelBase

Bases: ZS0Mixin

Mixin class for Water level forcing from timeseries data.

variables pydantic-field

variables: list[str] = ['h']

Variables to extract from the dataset

h property

h

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

get

get(
    destdir: str | Path, grid: RegularGrid, time: TimeRange
) -> dict

Generate the tide file.

Parameters:

Name Type Description Default
destdir str | Path

Destination directory for the netcdf file.

required
grid RegularGrid

Grid instance to use for selecting the boundary points.

required
time TimeRange

The times to filter the data to, only used if self.crop_data is True.

required

Returns:

Name Type Description
outfile Path

Path to the boundary bcfile data.

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.

WaterLevelGrid pydantic-model

WaterLevelGrid(**data: Any)

Bases: WaterLevelBase, BaseDataGrid

Water level forcing from gridded timeseries.

Fields:

model_type pydantic-field

model_type: Literal["water_level_grid"] = "water_level_grid"

Model type discriminator

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

source pydantic-field

source: SOURCES

Source reader, must return a dataset with the rioxarray accessor in the open method

filter pydantic-field

filter: Optional[Filter]

Optional filter specification to apply to the dataset

variables pydantic-field

variables: list[str] = ['h']

Variables to extract from the dataset

coords pydantic-field

Names of the coordinates in the dataset

crop_data pydantic-field

crop_data: bool = True

Update crop filters from Grid and Time objects if passed to get method

buffer pydantic-field

buffer: float = 0.0

Space to buffer the grid bounding box if crop_data is True

time_buffer pydantic-field

time_buffer: list[int] = [1, 1]

Number of source data timesteps to buffer the time range if filter_time is True

ds property

ds

Return the xarray dataset for this data source.

outfile property

outfile: str

location pydantic-field

location: Literal['centre', 'offshore', 'grid'] = 'centre'

Location to extract the data from the source dataset: 'centre' extracts the data at the centre of the grid, 'offshore' extracts the data at the middle of the offshore grid boundary, 'grid' at all grid points

crs cached property

crs

Return the coordinate reference system of the data source.

sel_method pydantic-field

sel_method: Literal['interp', 'sel'] = 'sel'

Defines which function from xarray to use for data selection: 'interp' uses interp() for interpolation, 'sel' uses sel() for selection

sel_method_kwargs pydantic-field

sel_method_kwargs: dict = {'method': 'nearest'}

Keyword arguments for sel_method

x_dim cached property

x_dim

Return the x dimension name.

y_dim cached property

y_dim

Return the y dimension name.

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

h property

h

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, grid: RegularGrid, time: TimeRange
) -> dict

Generate the tide file.

Parameters:

Name Type Description Default
destdir str | Path

Destination directory for the netcdf file.

required
grid RegularGrid

Grid instance to use for selecting the boundary points.

required
time TimeRange

The times to filter the data to, only used if self.crop_data is True.

required

Returns:

Name Type Description
outfile Path

Path to the boundary bcfile data.

plot

plot(
    param,
    isel={},
    model_grid=None,
    cmap="turbo",
    figsize=None,
    fscale=10,
    borders=True,
    land=True,
    coastline=True,
    **kwargs,
)

Plot the grid.

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.

WaterLevelStation pydantic-model

WaterLevelStation(**data: Any)

Bases: WaterLevelBase, BaseDataStation

Water level forcing from station data.

Fields:

model_type pydantic-field

model_type: Literal["water_level_station"] = (
    "water_level_station"
)

Model type discriminator

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

source pydantic-field

source: SOURCES

Source reader, must return a dataset with the rioxarray accessor in the open method

filter pydantic-field

filter: Optional[Filter]

Optional filter specification to apply to the dataset

variables pydantic-field

variables: list[str] = ['h']

Variables to extract from the dataset

coords pydantic-field

Names of the coordinates in the dataset

crop_data pydantic-field

crop_data: bool = True

Update crop filters from Grid and Time objects if passed to get method

buffer pydantic-field

buffer: float = 0.0

Space to buffer the grid bounding box if crop_data is True

time_buffer pydantic-field

time_buffer: list[int] = [1, 1]

Number of source data timesteps to buffer the time range if filter_time is True

ds property

ds

Return the xarray dataset for this data source.

outfile property

outfile: str

location pydantic-field

location: Literal['centre', 'offshore', 'grid'] = 'centre'

Location to extract the data from the source dataset: 'centre' extracts the data at the centre of the grid, 'offshore' extracts the data at the middle of the offshore grid boundary, 'grid' at all grid points

crs cached property

crs

Return the coordinate reference system of the data source.

sel_method pydantic-field

sel_method: Literal['idw', 'nearest'] = 'idw'

Defines which function from wavespectra.core.select to use for data selection: 'idw' uses sel_idw() for inverse distance weighting, 'nearest' uses sel_nearest() for nearest neighbor selection

sel_method_kwargs pydantic-field

sel_method_kwargs: dict = {}

Keyword arguments for sel_method

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

h property

h

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, grid: RegularGrid, time: TimeRange
) -> dict

Generate the tide file.

Parameters:

Name Type Description Default
destdir str | Path

Destination directory for the netcdf file.

required
grid RegularGrid

Grid instance to use for selecting the boundary points.

required
time TimeRange

The times to filter the data to, only used if self.crop_data is True.

required

Returns:

Name Type Description
outfile Path

Path to the boundary bcfile data.

plot

plot(
    param,
    isel={},
    model_grid=None,
    cmap="turbo",
    figsize=None,
    fscale=10,
    borders=True,
    land=True,
    coastline=True,
    **kwargs,
)

Plot the grid.

validate_coords

validate_coords() -> BaseDataStation

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.

WaterLevelPoint pydantic-model

WaterLevelPoint(**data: Any)

Bases: WaterLevelBase, BaseDataPoint

Water level forcing from point timeseries data.

Fields:

model_type pydantic-field

model_type: Literal["water_level_point"] = (
    "water_level_point"
)

Model type discriminator

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

source pydantic-field

source: SOURCES_TS

Source reader, must return an xarray timeseries dataset in the open method

filter pydantic-field

filter: Optional[Filter]

Optional filter specification to apply to the dataset

variables pydantic-field

variables: list[str] = ['h']

Variables to extract from the dataset

coords pydantic-field

Names of the coordinates in the dataset

crop_data pydantic-field

crop_data: bool = True

Update crop filters from Grid and Time objects if passed to get method

buffer pydantic-field

buffer: float = 0.0

Space to buffer the grid bounding box if crop_data is True

time_buffer pydantic-field

time_buffer: list[int] = [1, 1]

Number of source data timesteps to buffer the time range if filter_time is True

ds property

ds

Return the xarray dataset for this data source.

outfile property

outfile: str

location pydantic-field

location: Literal['centre', 'offshore', 'grid'] = 'centre'

Location to extract the data from the source dataset: 'centre' extracts the data at the centre of the grid, 'offshore' extracts the data at the middle of the offshore grid boundary, 'grid' at all grid points

crs cached property

crs

Return the coordinate reference system of the data source.

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

h property

h

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, grid: RegularGrid, time: TimeRange
) -> dict

Generate the tide file.

Parameters:

Name Type Description Default
destdir str | Path

Destination directory for the netcdf file.

required
grid RegularGrid

Grid instance to use for selecting the boundary points.

required
time TimeRange

The times to filter the data to, only used if self.crop_data is True.

required

Returns:

Name Type Description
outfile Path

Path to the boundary bcfile data.

plot

plot(
    param,
    isel={},
    model_grid=None,
    cmap="turbo",
    figsize=None,
    fscale=10,
    borders=True,
    land=True,
    coastline=True,
    **kwargs,
)

Plot the grid.

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.

TideConsBase

Bases: ZS0Mixin

Mixin class to generate timeseries from cons using oceantide.

variables pydantic-field

variables: list[str] = ['h']

Variables to extract from the dataset

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

set_variables

set_variables() -> TideConsBase

Variable names in an Oceantide dataset should be fixed.

get

get(
    destdir: str | Path, grid: RegularGrid, time: TimeRange
) -> dict

Generate the tide file.

Parameters:

Name Type Description Default
destdir str | Path

Destination directory for the netcdf file.

required
grid RegularGrid

Grid instance to use for selecting the boundary points.

required
time TimeRange

The times to filter the data to, only used if self.crop_data is True.

required

Returns:

Name Type Description
outfile Path

Path to the boundary bcfile data.

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.

TideConsGrid pydantic-model

TideConsGrid(**data: Any)

Bases: TideConsBase, BaseDataGrid

Water level forcing from gridded tide cons processed with oceantide.

Fields:

model_type pydantic-field

model_type: Literal['tide_cons_grid'] = 'tide_cons_grid'

Model type discriminator

source pydantic-field

Source of the tide data

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

filter pydantic-field

filter: Optional[Filter]

Optional filter specification to apply to the dataset

variables pydantic-field

variables: list[str] = ['h']

Variables to extract from the dataset

coords pydantic-field

Names of the coordinates in the dataset

crop_data pydantic-field

crop_data: bool = True

Update crop filters from Grid and Time objects if passed to get method

buffer pydantic-field

buffer: float = 0.0

Space to buffer the grid bounding box if crop_data is True

time_buffer pydantic-field

time_buffer: list[int] = [1, 1]

Number of source data timesteps to buffer the time range if filter_time is True

ds property

ds

Return the xarray dataset for this data source.

outfile property

outfile: str

location pydantic-field

location: Literal['centre', 'offshore', 'grid'] = 'centre'

Location to extract the data from the source dataset: 'centre' extracts the data at the centre of the grid, 'offshore' extracts the data at the middle of the offshore grid boundary, 'grid' at all grid points

crs cached property

crs

Return the coordinate reference system of the data source.

sel_method pydantic-field

sel_method: Literal['interp', 'sel'] = 'sel'

Defines which function from xarray to use for data selection: 'interp' uses interp() for interpolation, 'sel' uses sel() for selection

sel_method_kwargs pydantic-field

sel_method_kwargs: dict = {'method': 'nearest'}

Keyword arguments for sel_method

x_dim cached property

x_dim

Return the x dimension name.

y_dim cached property

y_dim

Return the y dimension name.

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

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, grid: RegularGrid, time: TimeRange
) -> dict

Generate the tide file.

Parameters:

Name Type Description Default
destdir str | Path

Destination directory for the netcdf file.

required
grid RegularGrid

Grid instance to use for selecting the boundary points.

required
time TimeRange

The times to filter the data to, only used if self.crop_data is True.

required

Returns:

Name Type Description
outfile Path

Path to the boundary bcfile data.

plot

plot(
    param,
    isel={},
    model_grid=None,
    cmap="turbo",
    figsize=None,
    fscale=10,
    borders=True,
    land=True,
    coastline=True,
    **kwargs,
)

Plot the grid.

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.

set_variables

set_variables() -> TideConsBase

Variable names in an Oceantide dataset should be fixed.

TideConsPoint pydantic-model

TideConsPoint(**data: Any)

Bases: TideConsBase, BaseDataPoint

Water level forcing from single tide cons point processed with oceantide.

Fields:

model_type pydantic-field

model_type: Literal['tide_cons_point'] = 'tide_cons_point'

Model type discriminator

source pydantic-field

Source of the tide data

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

filter pydantic-field

filter: Optional[Filter]

Optional filter specification to apply to the dataset

variables pydantic-field

variables: list[str] = ['h']

Variables to extract from the dataset

coords pydantic-field

Names of the coordinates in the dataset

crop_data pydantic-field

crop_data: bool = True

Update crop filters from Grid and Time objects if passed to get method

buffer pydantic-field

buffer: float = 0.0

Space to buffer the grid bounding box if crop_data is True

time_buffer pydantic-field

time_buffer: list[int] = [1, 1]

Number of source data timesteps to buffer the time range if filter_time is True

ds property

ds

Return the xarray dataset for this data source.

outfile property

outfile: str

location pydantic-field

location: Literal['centre', 'offshore', 'grid'] = 'centre'

Location to extract the data from the source dataset: 'centre' extracts the data at the centre of the grid, 'offshore' extracts the data at the middle of the offshore grid boundary, 'grid' at all grid points

crs cached property

crs

Return the coordinate reference system of the data source.

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

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, grid: RegularGrid, time: TimeRange
) -> dict

Generate the tide file.

Parameters:

Name Type Description Default
destdir str | Path

Destination directory for the netcdf file.

required
grid RegularGrid

Grid instance to use for selecting the boundary points.

required
time TimeRange

The times to filter the data to, only used if self.crop_data is True.

required

Returns:

Name Type Description
outfile Path

Path to the boundary bcfile data.

plot

plot(
    param,
    isel={},
    model_grid=None,
    cmap="turbo",
    figsize=None,
    fscale=10,
    borders=True,
    land=True,
    coastline=True,
    **kwargs,
)

Plot the grid.

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.

set_variables

set_variables() -> TideConsBase

Variable names in an Oceantide dataset should be fixed.

CombinedWaterLevel pydantic-model

CombinedWaterLevel(**data: Any)

Bases: ZS0Mixin, RompyBaseModel

Water level forcing combining a water level timeseries with tide from cons.

The tide is predicted from the constituents at the frequency freq of the tide object, the water level is interpolated onto those times and added to it.

Fields:

model_type pydantic-field

model_type: Literal["combined_water_level"] = (
    "combined_water_level"
)

Model type discriminator

waterlevel pydantic-field

Water level forcing (e.g., surge/SSH from hindcast)

tide pydantic-field

Tide forcing from constituents

id pydantic-field

id: Literal['tide'] = 'tide'

Identifier for the tide forcing

tideloc pydantic-field

tideloc: Literal[0, 1, 2, 4] = 1

Number of corner points on which a tide time series is specified

freq pydantic-field

freq: str = '1h'

Frequency for generating the tide timeseries from constituents

get

get(
    destdir: str | Path, grid: RegularGrid, time: TimeRange
) -> dict

Generate the combined tide + water level file.

Parameters:

Name Type Description Default
destdir str | Path

Destination directory for the output file.

required
grid RegularGrid

Grid instance to use for selecting the boundary points.

required
time TimeRange

The time range for the forcing data.

required

Returns:

Type Description
dict

XBeach namelist parameters for tide forcing.

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.

raise_non_implemented classmethod

raise_non_implemented(v)

Only tideloc=1 is currently implemented.