rompy.swan.grid.SwanGrid#

pydantic model rompy.swan.grid.SwanGrid[source]#

Regular SWAN grid in geographic space.

Fields:
Validators:
field dx: float | None = None#

Spacing between grid points in the x direction

Validated by:
field dy: float | None = None#

Spacing between grid points in the y direction

Validated by:
field exc: float | None = None#

Missing value

Validated by:
field grid_type: Literal['REG', 'CURV'] = 'REG'#

Type of grid (REG=regular, CURV=curvilinear)

Validated by:
field gridfile: str | None = None#

Name of grid file to load

Constraints:
  • max_length = 36

Validated by:
field nx: int | None = None#

Number of grid points in the x direction

Validated by:
field ny: int | None = None#

Number of grid points in the y direction

Validated by:
field rot: float | None = 0.0#

Rotation angle of the grid in degrees

Validated by:
field x0: float | None = None#

X coordinate of the grid origin

Validated by:
field y0: float | None = None#

Y coordinate of the grid origin

Validated by:
boundary(*args, **kwargs) tuple[source]#

Returns the grid boundary polygon.

Override the parent method to use the actual points from the regular grid boundary instead of the convex hull which is not always the boundary.

classmethod from_component(component: GRIDREGULAR) SwanGrid[source]#

Swan grid from an existing component.

Parameters:

component (GRIDREGULAR) – A GRIDREGULAR SWAN component.

Returns:

A SwanGrid object.

Return type:

SwanGrid

nearby_spectra(ds_spec, dist_thres=0.05, plot=True)[source]#

Find points nearby and project to the boundary

Parameters:
  • ds_spec (xarray.Dataset) –

    an XArray dataset of wave spectra at a number of points. Dataset variable names standardised using wavespectra.read_* functions.

    See https://wavespectra.readthedocs.io/en/latest/api.html#input-functions

  • dist_thres (float, optional [Default: 0.05]) – Maximum distance to translate the input spectra to the grid boundary

  • plot (boolean, optional [Default: True]) – Generate a plot that shows the applied projections

Returns:

A subset of ds_spec with lat and lon coordinates projected to the boundary

Return type:

xarray.Dataset

validator validate_curvilinear_grid  »  all fields[source]#
validator validate_grid_type  »  grid_type[source]#
property cgrid#
property cgrid_read#
property component#

Return the respective SWAN component for this grid.

property inpgrid#