hydromt.data_catalog.adapters.DataFrameAdapter.transform#

DataFrameAdapter.transform(df: DataFrame, metadata: SourceMetadata | None = None, *, variables: str | List[str] | None = None, time_range: Annotated[Tuple[datetime, datetime], BeforeValidator(func=_time_range_from_str), AfterValidator(func=_time_range_validate)] | None = None, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE) DataFrame[source]#

Transform data to HydroMT standards.

Parameters:
  • df (pd.DataFrame) – input DataFrame

  • metadata (Optional[SourceMetadata], optional) – MetaData of the source, by default None

  • variables (Optional[Variables], optional) – filter for variables, by default None

  • time_range (Optional[TimeRange], optional) – filter for start and end times, by default None

  • handle_nodata (NoDataStrategy, optional) – how to handle no data being present in the result, by default NoDataStrategy.RAISE

Returns:

filtered and harmonized DataFrame

Return type:

pd.DataFrame

Raises:
  • ValueError – if not all variables are found in the data

  • NoDataException – if no data in left after slicing and handle_nodata is NoDataStrategy.RAISE