Helper methods#
Primary functions for poly-to-poly area-weighted mapping.
- gdptools.helpers.build_subset(bounds: ndarray[Any, dtype[float64]], xname: str, yname: str, tname: str, toptobottom: bool, date_min: str, date_max: Optional[str] = None) Dict[str, object] #
Create a dictionary to use with xarray .sel() method to subset by time and space.
- Parameters
bounds (
np.ndarray
) – _description_xname (
str
) – _description_yname (
str
) – _description_tname (
str
) – _description_toptobottom (
bool
) – _description_date_min (
str
) – _description_date_max (
Optional[str], optional
) – _description_. Defaults to None.
- Returns
_description_
- Return type
dict
- gdptools.helpers.build_subset_tiff(bounds: ndarray[Any, dtype[float64]], xname: str, yname: str, toptobottom: bool, bname: str, band: int) Mapping[Any, Any] #
Create a dictionary to use with xarray .sel() method to subset by time and space.
- Parameters
bounds (
npt.NDArray[np.double]
) – _description_xname (
str
) – _description_yname (
str
) – _description_toptobottom (
bool
) – _description_bname (
str
) – _description_band (
int
) – _description_
- Returns
_description_
- Return type
Dict[str, object]
- gdptools.helpers.build_subset_tiff_da(bounds: ndarray[Any, dtype[float64]], xname: str, yname: str, toptobottom: Union[int, bool]) Mapping[Any, Any] #
Create a dictionary to use with xarray .sel() method to subset by time and space.
- Parameters
bounds (
npt.NDArray[np.double]
) – _description_xname (
str
) – _description_yname (
str
) – _description_toptobottom (
bool
) – _description_
- Returns
_description_
- Return type
Dict[str, object]
- gdptools.helpers.get_data_subset_climr_catalog(cat_dict: dict[str, dict[str, Any]], key: str, shp_file: Union[str, GeoDataFrame], begin_date: str, end_date: str) DataArray #
get_data_subset_climr_catalog Get xarray subset data.
_extended_summary_
- Parameters
cat_dict (
dict[str, dict[str, Any]]
) – _description_key (
str
) – _description_shp_file (
Union[str, gpd.GeoDataFrame]
) – _description_begin_date (
str
) – _description_end_date (
str
) – _description_
- Returns
_description_
- Return type
xr.DataArray
- gdptools.helpers.get_data_subset_odap_catalog(param_dict: dict[str, dict[str, Any]], grid_dict: dict[str, dict[str, Any]], key: str, shp_file: Union[str, GeoDataFrame], begin_date: str, end_date: str) DataArray #
get_data_subset_odap_catalog Get xarray subset data.
_extended_summary_
- Parameters
param_dict (
dict[str, dict[str, Any]]
) – _description_grid_dict (
dict[str, dict[str, Any]]
) – _description_key (
str
) – _description_shp_file (
Union[str, gpd.GeoDataFrame]
) – _description_begin_date (
str
) – _description_end_date (
str
) – _description_
- Returns
_description_
- Return type
xr.DataArray
- gdptools.helpers.get_data_subset_user_catalog(cat_dict: dict[str, dict[str, Any]], key: str, shp_file: Union[str, GeoDataFrame], begin_date: str, end_date: str) DataArray #
get_data_subset_climr_catalog Get xarray subset data.
_extended_summary_
- Parameters
cat_dict (
dict[str, dict[str, Any]]
) – _description_key (
str
) – _description_shp_file (
Union[str, gpd.GeoDataFrame]
) – _description_begin_date (
str
) – _description_end_date (
str
) – _description_
- Returns
_description_
- Return type
xr.DataArray