Wind¶
Wind forcing, written as the XBeach windfile.
XBeach wind forcing.
WindVector
pydantic-model
¶
WindVector(**data: Any)
Bases: RompyBaseModel
Wind vector variables.
Fields:
WindScalar
pydantic-model
¶
WindScalar(**data: Any)
Bases: RompyBaseModel
Wind scalar variables.
Fields:
WindMixin
¶
Wind specific functionality.
spddir
¶
get
¶
Generate the wind 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
|
Optional[TimeRange]
|
The times to filter the data to, only used if |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
outfile |
Path
|
Path to the boundary bcfile data. |
WindGrid
pydantic-model
¶
WindGrid(**data: Any)
Bases: WindMixin, BaseDataGrid
Wind forcing from gridded data.
Namelist¶
- windfile : str Name of file with non-stationary wind data.
Fields:
-
id(Literal['wind']) -
source(SOURCES) -
filter(Optional[Filter]) -
variables(Optional[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) -
wind_vars(Union[WindVector, WindScalar]) -
model_type(Literal['wind_grid'])
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
variables
pydantic-field
¶
Subset of variables to extract from 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
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
¶
Generate the wind 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
|
Optional[TimeRange]
|
The times to filter the data to, only used if |
None
|
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.
WindStation
pydantic-model
¶
WindStation(**data: Any)
Bases: WindMixin, BaseDataStation
Wind forcing from station data.
Namelist¶
- windfile : str Name of file with non-stationary wind data.
Fields:
-
id(Literal['wind']) -
source(SOURCES) -
filter(Optional[Filter]) -
variables(Optional[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) -
wind_vars(Union[WindVector, WindScalar]) -
model_type(Literal['wind_station'])
model_type
pydantic-field
¶
model_type: Literal['wind_station'] = 'wind_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
variables
pydantic-field
¶
Subset of variables to extract from 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
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
¶
Generate the wind 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
|
Optional[TimeRange]
|
The times to filter the data to, only used if |
None
|
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.
WindPoint
pydantic-model
¶
WindPoint(**data: Any)
Bases: WindMixin, BaseDataPoint
Wind forcing from point timeseries data.
Namelist¶
- windfile : str Name of file with non-stationary wind data.
Fields:
-
id(Literal['wind']) -
source(SOURCES_TS) -
filter(Optional[Filter]) -
variables(Optional[list[str]]) -
coords(Optional[DatasetCoords]) -
crop_data(bool) -
buffer(float) -
time_buffer(list[int]) -
location(Literal['centre', 'offshore', 'grid']) -
wind_vars(Union[WindVector, WindScalar]) -
model_type(Literal['wind_point'])
model_type
pydantic-field
¶
model_type: Literal['wind_point'] = 'wind_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
variables
pydantic-field
¶
Subset of variables to extract from 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
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
¶
Generate the wind 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
|
Optional[TimeRange]
|
The times to filter the data to, only used if |
None
|
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.