hydromt.data_catalog.sources.DataFrameSource#

pydantic model hydromt.data_catalog.sources.DataFrameSource[source]#

DataSource for DataFrames.

Reads and validates DataCatalog entries.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

data_type: ClassVar[Literal['DataFrame']] = 'DataFrame'#
field driver: DataFrameDriver [Required]#
field data_adapter: DataFrameAdapter [Optional]#
read_data(*, variables: List[str] | None = None, time_range: TimeRange | None = None, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE) DataFrame | None[source]#

Use the resolver, driver, and data adapter to read and harmonize the data.

to_file(file_path: Path | str, *, driver_override: DataFrameDriver | None = None, variables: list[str] | None = None, time_range: TimeRange | None = None, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, write_kwargs: dict[str, Any] | None = None) DataFrameSource | None[source]#

Write the DataFrameSource to a local file.

args:

to_stac_catalog(handle_nodata: NoDataStrategy = NoDataStrategy.IGNORE) Catalog | None[source]#

Convert a dataframe into a STAC Catalog representation.

The collection will contain an asset for each of the associated files.

Parameters:
  • (str (- handle_nodata) – Options are: “raise” to raise an error on failure, “skip” to skip the dataframe on failure, and “coerce” (default) to set default values on failure.

  • optional) (The error handling strategy.) – Options are: “raise” to raise an error on failure, “skip” to skip the dataframe on failure, and “coerce” (default) to set default values on failure.

Returns:

- Optional[StacCatalog] – None if the dataset was skipped.

Return type:

The STAC Catalog representation of the dataframe, or

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.