monet.util.combinetool
Functions
|
Combine gridded data with point observation data in xarray format. |
|
Combine xarray data array with point observations in a DataFrame. |
|
Combine xarray data array da with spatial information point observations in dataframe df, returning a new dataframe. |
|
Combine vertical profile data and surface observations using xESMF. |
|
This function will combine an xarray.DataArray to a 2d dataset with dimensions (time,z) |
- monet.util.combinetool.combine_da_to_da(source, target, *, merge=True, interp_time=False, **kwargs)
Combine gridded data with point observation data in xarray format.
Interpolates source gridded data to target point locations using nearest neighbor interpolation, with optional time interpolation and merging.
- Parameters:
source (xarray.DataArray or xarray.Dataset) – Gridded data to interpolate from.
target (xarray.DataArray or xarray.Dataset) – Point observation data with target coordinates.
merge (bool, default True) – If True, merge interpolated values with the original target data. If False, return only the interpolated values.
interp_time (bool, default False) – If True, linearly interpolate to the times in target.
**kwargs (dict) – Additional arguments passed to remap_nearest.
- Returns:
Dataset with interpolated source data at target locations, either merged with original target data (if merge=True) or standalone.
- Return type:
- monet.util.combinetool.combine_da_to_df(da, df, *, merge=True, **kwargs)
Combine xarray data array with point observations in a DataFrame.
Interpolates gridded data to observation points using nearest neighbor interpolation, then merges with the original observation data.
- Parameters:
da (xarray.DataArray or xarray.Dataset) – Gridded data to be interpolated to target points. Can be unstructured-grid data (detected by checking
'mio_has_unstructured_grid'attribute).df (pandas.DataFrame) – Point observations with ‘latitude’, ‘longitude’, and ‘siteid’ columns.
merge (bool, default True) – If True, merge interpolated values with the original DataFrame. If False, return only the interpolated values.
**kwargs (dict) – Additional arguments passed to remap_nearest or remap_nearest_unstructured.
- Returns:
DataFrame with interpolated model values at observation locations, either merged with original data (if merge=True) or standalone.
- Return type:
- monet.util.combinetool.combine_da_to_df_xesmf(da, df, *, suffix=None, **kwargs)
Combine xarray data array da with spatial information point observations in dataframe df, returning a new dataframe.
Uses
resample_xesmf().- Parameters:
da (xarray.DataArray or xarray.Dataset) – Data to be interpolated to target grid points.
df (pandas.DataFrame) – Data on target points.
suffix (str, optional) – Added to the
nameof the new variable, defaults to'_new'.kwargs (dict) – Passed on to
resample_xesmf()(and then toxesmf.Regridder).
- Return type:
- monet.util.combinetool.combine_da_to_df_xesmf_strat(da, daz, df, **kwargs)
Combine vertical profile data and surface observations using xESMF.
- Parameters:
da (xarray.DataArray) – Data to interpolate.
daz (xarray.DataArray) – Vertical coordinate data array
df (pandas.DataFrame) – DataFrame containing surface observations with lat/lon coordinates
**kwargs – Additional arguments passed to xesmf regridder
- Returns:
Combined data frame with interpolated model values at observation points
- Return type:
- monet.util.combinetool.combine_da_to_height_profile(da, dset, *, radius_of_influence=12000.0)
This function will combine an xarray.DataArray to a 2d dataset with dimensions (time,z)
- Parameters:
da (xarray.DataArray)
dset (xarray.Dataset) – Dataset containing vertical profile observations
radius_of_influence (float, optional) – Search radius for nearest neighbor interpolation in meters. Default is 12km.
- Returns:
Combined dataset with interpolated model values at observation heights
- Return type: