pvdeg.geospatial.analysis#

pvdeg.geospatial.analysis(weather_ds: Dataset, meta_df: DataFrame, func: Callable, template: Dataset = None, preserve_gid_dim: bool = False, compute: bool = True, **func_kwargs) Dataset | Delayed[source]#

Applies a function to each gid of a weather dataset. analysis will attempt to create a template using geospatial.auto_template. If this process fails you will have to provide a geospatial template to the template argument.

analysis will attempt to create a template using geospatial.auto_template. If this process fails you will have to provide a geospatial template to the template argument.

ValueError: <function-name> cannot be autotemplated. create a template manually with geospatial.output_template

Parameters:
  • weather_ds (xarray.Dataset) – Dataset containing weather data for a block of gids.

  • meta_df (pandas.DataFrame) – DataFrame containing meta data for a block of gids.

  • func (function) – Function to apply to weather data.

  • template (xarray.Dataset) – Template for output data.

  • preserve_gid_dim (bool, optional) – Expert setting. If True, preserves the ‘gid’ dimension and prevents expansion to latitude/longitude coordinates. Other dimensions such as time and distance are unaffected. Default is False.

  • compute (bool, optional) – Expert setting. If False, builds lazy computation graph without execution. This is useful for building into larger dask pipelines. Default is True: Values will be computed when this function is called.

  • func_kwargs (dict) – Keyword arguments to pass to func.

Returns:

ds_res (xarray.Dataset | dask.delayed.Delayed) – Dataset with results for a block of gids.