Skip to content

Sources

Sources read data for the data interfaces. Those with a coordinate reference system (CRS) extend rompy's sources, which are listed in the rompy reference.

XBEACH Rompy sources.

logger module-attribute

logger = logging.getLogger(__name__)

HERE module-attribute

HERE = Path(__file__).parent

SourceGeotiff pydantic-model

SourceGeotiff(**data: Any)

Bases: SourceBase

Geotiff source class.

Fields:

Validators:

model_type pydantic-field

model_type: Literal['geotiff'] = 'geotiff'

Model type discriminator

filename pydantic-field

filename: str | Path

Path to the geotiff dataset

band pydantic-field

band: int = 1

Band to read from the dataset after opening it with rasterio

kwargs pydantic-field

kwargs: dict = {}

Keyword arguments to pass to rioxarray.open_rasterio

coordinates cached property

coordinates: Dataset

Return the coordinates of the datasource.

validate_rasterio_kwargs pydantic-validator

validate_rasterio_kwargs(v) -> dict

Validate the rasterio keyword arguments.

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.

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

SourceXYZ pydantic-model

SourceXYZ(**data: Any)

Bases: SourceBase

XYZ source class.

Fields:

model_type pydantic-field

model_type: Literal['xyz'] = 'xyz'

Model type discriminator

filename pydantic-field

filename: str | Path

Path to the xyz dataset

crs pydantic-field

crs: Union[int, str]

Coordinate reference system of the source data

res pydantic-field

res: float

Resolution of the regular grid to interpolate onto

xcol pydantic-field

xcol: str = 'x'

Name of the column containing the x data

ycol pydantic-field

ycol: str = 'y'

Name of the column containing the y data

zcol pydantic-field

zcol: str = 'z'

Name of the column containing the z data

read_csv_kwargs pydantic-field

read_csv_kwargs: dict = {}

Keyword arguments to pass to pandas.read_csv

griddata_kwargs pydantic-field

griddata_kwargs: dict = {'method': 'linear'}

Keyword arguments to pass to scipy.interpolate.griddata

coordinates cached property

coordinates: Dataset

Return the coordinates of the datasource.

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.

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

SourceMixin

Mixin class for crs aware source objects.

crs pydantic-field

crs: CRS_TYPES

Coordinate reference system of the source data

x_dim pydantic-field

x_dim: str = 'x'

Name of the x dimension

y_dim pydantic-field

y_dim: str = 'y'

Name of the y dimension

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

SourceCRSDataset

Bases: SourceMixin, SourceDataset

Source dataset with CRS support from an existing xarray Dataset object.

crs pydantic-field

crs: CRS_TYPES

Coordinate reference system of the source data

x_dim pydantic-field

x_dim: str = 'x'

Name of the x dimension

y_dim pydantic-field

y_dim: str = 'y'

Name of the y dimension

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

SourceCRSFile pydantic-model

SourceCRSFile(**data: Any)

Bases: SourceMixin, SourceFile

Source dataset with CRS support from file to open with xarray.open_dataset.

Config:

  • arbitrary_types_allowed: True

Fields:

model_type pydantic-field

model_type: Literal['file'] = 'file'

Model type discriminator

coordinates cached property

coordinates: Dataset

Return the coordinates of the datasource.

uri pydantic-field

uri: Union[str, Path]

Path to the dataset

kwargs pydantic-field

kwargs: dict = {}

Keyword arguments to pass to xarray.open_dataset

variable pydantic-field

variable: Optional[str] = None

Variable to select from the dataset

crs pydantic-field

crs: CRS_TYPES

Coordinate reference system of the source data

x_dim pydantic-field

x_dim: str = 'x'

Name of the x dimension

y_dim pydantic-field

y_dim: str = 'y'

Name of the y dimension

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.

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

SourceCRSIntake pydantic-model

SourceCRSIntake(**data: Any)

Bases: SourceMixin, SourceIntake

Source dataset with CRS support from intake catalog.

Fields:

Validators:

model_type pydantic-field

model_type: Literal['intake'] = 'intake'

Model type discriminator

coordinates cached property

coordinates: Dataset

Return the coordinates of the datasource.

dataset_id pydantic-field

dataset_id: str

The id of the dataset to read in the catalog

catalog_uri pydantic-field

catalog_uri: Optional[str | Path] = None

The URI of the catalog to read from

catalog_yaml pydantic-field

catalog_yaml: Optional[str] = None

The YAML string of the catalog to read from

kwargs pydantic-field

kwargs: dict = {}

Keyword arguments to define intake dataset parameters

catalog property

catalog: Catalog

The intake catalog instance.

crs pydantic-field

crs: CRS_TYPES

Coordinate reference system of the source data

x_dim pydantic-field

x_dim: str = 'x'

Name of the x dimension

y_dim pydantic-field

y_dim: str = 'y'

Name of the y dimension

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.

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

check_catalog pydantic-validator

check_catalog() -> SourceIntake

SourceCRSWavespectra pydantic-model

SourceCRSWavespectra(**data: Any)

Bases: SourceMixin, SourceWavespectra

Source dataset with CRS support from wavespectra reader.

Note

Default values are provided for crs, x_dim and y_dim fields as they are common to most wavespectra datasets.

Fields:

Validators:

model_type pydantic-field

model_type: Literal['wavespectra'] = 'wavespectra'

Model type discriminator

coordinates cached property

coordinates: Dataset

Return the coordinates of the datasource.

uri pydantic-field

uri: str | Path

Path to the dataset

reader pydantic-field

reader: str

Name of the wavespectra reader to use, e.g., read_swan

kwargs pydantic-field

kwargs: dict = {}

Keyword arguments to pass to the wavespectra reader

crs pydantic-field

crs: CRS_TYPES

Coordinate reference system of the source data

x_dim pydantic-field

x_dim: str = 'x'

Name of the x dimension

y_dim pydantic-field

y_dim: str = 'y'

Name of the y dimension

set_defaults pydantic-validator

set_defaults(values)

Set default values for wavespectra-specific 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.

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

SourceOceantide pydantic-model

SourceOceantide(**data: Any)

Bases: SourceBase

Geotiff source class.

Fields:

model_type pydantic-field

model_type: Literal['oceantide'] = 'oceantide'

Model type discriminator

reader pydantic-field

reader: str

Name of the oceantide reader to use, e.g., read_swan

kwargs pydantic-field

kwargs: dict = {}

Keyword arguments to pass to the oceantide reader

coordinates cached property

coordinates: Dataset

Return the coordinates of the datasource.

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.

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

SourceCRSOceantide pydantic-model

SourceCRSOceantide(**data: Any)

Bases: SourceMixin, SourceOceantide

Source dataset with CRS support from intake catalog.

Fields:

Validators:

model_type pydantic-field

model_type: Literal['oceantide'] = 'oceantide'

Model type discriminator

coordinates cached property

coordinates: Dataset

Return the coordinates of the datasource.

reader pydantic-field

reader: str

Name of the oceantide reader to use, e.g., read_swan

kwargs pydantic-field

kwargs: dict = {}

Keyword arguments to pass to the oceantide reader

crs pydantic-field

crs: CRS_TYPES

Coordinate reference system of the source data

x_dim pydantic-field

x_dim: str = 'x'

Name of the x dimension

y_dim pydantic-field

y_dim: str = 'y'

Name of the y dimension

set_defaults pydantic-validator

set_defaults(values)

Set default values for oceantide-specific 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.

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.

SourceTideConsPointCSV pydantic-model

SourceTideConsPointCSV(**data: Any)

Bases: SourceBase

Tide point source class.

Fields:

Validators:

model_type pydantic-field

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

Model type discriminator

filename pydantic-field

filename: str | Path

Path to the csv stations file

acol pydantic-field

acol: str = 'amplitude'

Name of the column containing the amplitude data

pcol pydantic-field

pcol: str = 'phase'

Name of the column containing the phase data

ccol pydantic-field

ccol: str = 'constituent'

Name of the column containing the constituent data

read_csv_kwargs pydantic-field

read_csv_kwargs: dict = {}

Keyword arguments to pass to pandas.read_csv

coordinates cached property

coordinates: Dataset

Return the coordinates of the datasource.

validate_kwargs pydantic-validator

validate_kwargs() -> SourceTideConsPointCSV

Validate the keyword arguments.

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.

open

open(
    variables: list = [], filters: Filter = {}, **kwargs
) -> Dataset

Return the filtered dataset object.

Parameters:

Name Type Description Default
variables list

List of variables to select from the dataset.

[]
filters Filter

Filters to apply to the dataset.

{}
Notes

The kwargs are only a placeholder in case a subclass needs to pass additional arguments to the open method.