Water levels¶
Tide and water level forcing, written as the XBeach zs0file.
XBeach water level and tide forcing.
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.
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
¶
Only tideloc=1 is currently implemented.
WaterLevelBase
¶
Bases: ZS0Mixin
Mixin class for Water level forcing from timeseries data.
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 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
outfile |
Path
|
Path to the boundary bcfile data. |
raise_non_implemented
classmethod
¶
Only tideloc=1 is currently implemented.
WaterLevelGrid
pydantic-model
¶
WaterLevelGrid(**data: Any)
Bases: WaterLevelBase, BaseDataGrid
Water level forcing from gridded timeseries.
Fields:
-
id(Literal['tide']) -
source(SOURCES) -
filter(Optional[Filter]) -
variables(list[str]) -
coords(Optional[DatasetCoords]) -
crop_data(bool) -
buffer(float) -
time_buffer(list[int]) -
location(Literal['centre', 'offshore', 'grid']) -
sel_method(Literal['interp', 'sel']) -
sel_method_kwargs(dict) -
tideloc(Literal[0, 1, 2, 4]) -
freq(str) -
model_type(Literal['water_level_grid'])
model_type
pydantic-field
¶
model_type: Literal["water_level_grid"] = "water_level_grid"
Model type discriminator
source
pydantic-field
¶
source: SOURCES
Source reader, must return a dataset with the rioxarray accessor in the open method
filter
pydantic-field
¶
Optional filter specification to apply to the dataset
coords
pydantic-field
¶
coords: Optional[DatasetCoords] = DatasetCoords()
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
¶
Number of source data timesteps to buffer the time range if filter_time is True
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
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
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
¶
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.
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 |
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
¶
Only tideloc=1 is currently implemented.
WaterLevelStation
pydantic-model
¶
WaterLevelStation(**data: Any)
Bases: WaterLevelBase, BaseDataStation
Water level forcing from station data.
Fields:
-
id(Literal['tide']) -
source(SOURCES) -
filter(Optional[Filter]) -
variables(list[str]) -
coords(Optional[DatasetCoords]) -
crop_data(bool) -
buffer(float) -
time_buffer(list[int]) -
location(Literal['centre', 'offshore', 'grid']) -
sel_method(Literal['idw', 'nearest']) -
sel_method_kwargs(dict) -
tideloc(Literal[0, 1, 2, 4]) -
freq(str) -
model_type(Literal['water_level_station'])
model_type
pydantic-field
¶
model_type: Literal["water_level_station"] = (
"water_level_station"
)
Model type discriminator
source
pydantic-field
¶
source: SOURCES
Source reader, must return a dataset with the rioxarray accessor in the open method
filter
pydantic-field
¶
Optional filter specification to apply to the dataset
coords
pydantic-field
¶
coords: Optional[DatasetCoords] = DatasetCoords()
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
¶
Number of source data timesteps to buffer the time range if filter_time is True
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
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
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
¶
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.
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 |
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
¶
Only tideloc=1 is currently implemented.
WaterLevelPoint
pydantic-model
¶
WaterLevelPoint(**data: Any)
Bases: WaterLevelBase, BaseDataPoint
Water level forcing from point timeseries data.
Fields:
-
id(Literal['tide']) -
source(SOURCES_TS) -
filter(Optional[Filter]) -
variables(list[str]) -
coords(Optional[DatasetCoords]) -
crop_data(bool) -
buffer(float) -
time_buffer(list[int]) -
location(Literal['centre', 'offshore', 'grid']) -
tideloc(Literal[0, 1, 2, 4]) -
freq(str) -
model_type(Literal['water_level_point'])
model_type
pydantic-field
¶
model_type: Literal["water_level_point"] = (
"water_level_point"
)
Model type discriminator
source
pydantic-field
¶
source: SOURCES_TS
Source reader, must return an xarray timeseries dataset in the open method
filter
pydantic-field
¶
Optional filter specification to apply to the dataset
coords
pydantic-field
¶
coords: Optional[DatasetCoords] = DatasetCoords()
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
¶
Number of source data timesteps to buffer the time range if filter_time is True
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
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
¶
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.
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 |
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
¶
Only tideloc=1 is currently implemented.
TideConsBase
¶
Bases: ZS0Mixin
Mixin class to generate timeseries from cons using oceantide.
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 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
outfile |
Path
|
Path to the boundary bcfile data. |
raise_non_implemented
classmethod
¶
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:
-
id(Literal['tide']) -
filter(Optional[Filter]) -
variables(list[str]) -
coords(Optional[DatasetCoords]) -
crop_data(bool) -
buffer(float) -
time_buffer(list[int]) -
location(Literal['centre', 'offshore', 'grid']) -
sel_method(Literal['interp', 'sel']) -
sel_method_kwargs(dict) -
tideloc(Literal[0, 1, 2, 4]) -
freq(str) -
model_type(Literal['tide_cons_grid']) -
source(SourceCRSOceantide)
model_type
pydantic-field
¶
model_type: Literal['tide_cons_grid'] = 'tide_cons_grid'
Model type discriminator
filter
pydantic-field
¶
Optional filter specification to apply to the dataset
coords
pydantic-field
¶
coords: Optional[DatasetCoords] = DatasetCoords()
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
¶
Number of source data timesteps to buffer the time range if filter_time is True
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
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
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
¶
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.
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 |
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
¶
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:
-
id(Literal['tide']) -
filter(Optional[Filter]) -
variables(list[str]) -
coords(Optional[DatasetCoords]) -
crop_data(bool) -
buffer(float) -
time_buffer(list[int]) -
location(Literal['centre', 'offshore', 'grid']) -
tideloc(Literal[0, 1, 2, 4]) -
freq(str) -
model_type(Literal['tide_cons_point']) -
source(SourceTideConsPointCSV)
model_type
pydantic-field
¶
model_type: Literal['tide_cons_point'] = 'tide_cons_point'
Model type discriminator
filter
pydantic-field
¶
Optional filter specification to apply to the dataset
coords
pydantic-field
¶
coords: Optional[DatasetCoords] = DatasetCoords()
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
¶
Number of source data timesteps to buffer the time range if filter_time is True
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
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
¶
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.
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 |
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
¶
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:
-
id(Literal['tide']) -
tideloc(Literal[0, 1, 2, 4]) -
freq(str) -
model_type(Literal['combined_water_level']) -
waterlevel(Union[WaterLevelGrid, WaterLevelStation, WaterLevelPoint]) -
tide(Union[TideConsGrid, TideConsPoint])
model_type
pydantic-field
¶
model_type: Literal["combined_water_level"] = (
"combined_water_level"
)
Model type discriminator
waterlevel
pydantic-field
¶
waterlevel: Union[
WaterLevelGrid, WaterLevelStation, WaterLevelPoint
]
Water level forcing (e.g., surge/SSH from hindcast)
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
¶
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.
raise_non_implemented
classmethod
¶
Only tideloc=1 is currently implemented.