uscrn.to_xarray

Contents

uscrn.to_xarray#

uscrn.to_xarray(df, which=None, *, title=None, keep='last')#

Convert to xarray representation.

Soil variables will be combined, with a soil depth dimension added, if applicable (hourly, daily).

Parameters:
  • df (DataFrame) – Input dataframe, created using get_data() or get_nrt_data() or one of the readers.

  • which (Literal['subhourly', 'hourly', 'daily', 'monthly'] | None) – Which dataset. Will attempt to guess by default. Specify to override this.

  • title (str | None) – Used to set the dataset’s title attribute. By default, will use df.attrs['title'], if present, otherwise will form using which and min/max time in the dataset.

  • keep (Literal['first', 'last', False] | None) – Passed to pandas.DataFrame.drop_duplicates(). Use None to keep forgo dropping duplicates. Datasets from get_nrt_data() occasionally have duplicates.

Return type:

Dataset