Skip to content

Base types

RompyBaseModel is the base class of all rompy models. This page also lists the small types used across rompy.

Rompy types.

RompyBaseModel pydantic-model

RompyBaseModel(**data: Any)

Bases: BaseModel

Base class of all rompy models.

Unknown fields are rejected, and a misspelled field name gets a suggestion of the closest field. The inputs a model was created with are kept (dump_inputs_dict, dump_inputs_json), and models print as a hierarchical summary of their fields.

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.

Latitude pydantic-model

Bases: BaseModel

Latitude

Fields:

Validators:

lat pydantic-field

lat: float

Latitude

validate_lat pydantic-validator

validate_lat(v: float) -> float

Longitude pydantic-model

Bases: BaseModel

Longitude

Fields:

Validators:

lon pydantic-field

lon: float

Longitude

validate_lon pydantic-validator

validate_lon(v: float) -> float

Coordinate pydantic-model

Bases: BaseModel

Coordinate

Fields:

Validators:

lon pydantic-field

lon: float

Longitude

lat pydantic-field

lat: float

Latitude

validate_lon pydantic-validator

validate_lon(v: float) -> float

validate_lat pydantic-validator

validate_lat(v: float) -> float

Bbox pydantic-model

Bases: BaseModel

Bounding box

Fields:

Validators:

minlon pydantic-field

minlon: Longitude

Minimum longitude

minlat pydantic-field

minlat: Latitude

Minimum latitude

maxlon pydantic-field

maxlon: Longitude

Maximum longitude

maxlat pydantic-field

maxlat: Latitude

Maximum latitude

width property

width

height property

height

center property

center

area property

area

validate_coords pydantic-validator

validate_coords() -> Bbox

contains

contains(other)

intersects

intersects(other)

union

union(other)

intersection

intersection(other)

expand

expand(amount)

shrink

shrink(amount)

scale

scale(amount)

translate

translate(amount)

to_geojson

to_geojson()

to_wkt

to_wkt()

to_wkb

to_wkb()

from_geojson classmethod

from_geojson(geojson)

from_wkt classmethod

from_wkt(wkt)

from_wkb classmethod

from_wkb(wkb)

from_polygon classmethod

from_polygon(polygon)

Spectrum pydantic-model

Spectrum(**data: Any)

Bases: RompyBaseModel

A class to represent a wave spectrum.

Fields:

fmin pydantic-field

fmin: float = 0.0464

Minimum frequency in Hz

fmax pydantic-field

fmax: float = 1.0

Maximum frequency in Hz

nfreqs pydantic-field

nfreqs: int = 31

Number of frequency components

ndirs pydantic-field

ndirs: int = 36

Number of directional components

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.

DatasetCoords pydantic-model

DatasetCoords(**data: Any)

Bases: RompyBaseModel

Coordinates representation.

Fields:

t pydantic-field

t: Optional[str] = 'time'

Name of the time coordinate

x pydantic-field

x: Optional[str] = 'longitude'

Name of the x coordinate

y pydantic-field

y: Optional[str] = 'latitude'

Name of the y coordinate

z pydantic-field

z: Optional[str | None] = None

Name of the z coordinate

s pydantic-field

s: Optional[str | None] = None

Name of the site coordinate

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.

Slice pydantic-model

Bases: BaseModel

Basic float or datetime slice representation

Fields:

start pydantic-field

start: Optional[Union[float, datetime, str]] = None

Slice start

stop pydantic-field

stop: Optional[Union[float, datetime, str]] = None

Slice stop

from_dict classmethod

from_dict(d: dict)

from_slice classmethod

from_slice(s: slice)

to_slice

to_slice() -> slice

validate classmethod

validate(v)