polartoolkit.region_to_df

Contents

polartoolkit.region_to_df#

region_to_df(region, coord_names=('easting', 'northing'), reverse=False)[source]#

Convert region bounds in format [xmin, xmax, ymin, ymax] to pandas dataframe with coordinates of region corners, or reverse this if reverse is True.

Parameters:
  • region (tuple[float, float, float, float] | pandas.DataFrame) โ€“ bounding region in format [xmin, xmax, ymin, ymax] or, if reverse is True, a DataFrame with coordinate columns with names set by cood_names

  • coord_names (tuple[str, str], optional) โ€“ names of input or output coordinate columns, by default (โ€œeastingโ€, โ€œnorthingโ€)

  • reverse (bool, optional) โ€“ If True, convert from df to region tuple, else, convert from region tuple to df, by default False

Returns:

Dataframe with easting and northing columns, and a row for each corner of the region, or, if reverse is True, an array in the format [xmin, xmax, ymin, ymax].

Return type:

tuple[Any, Any, Any, Any] | pandas.DataFrame