ecoscope.io.earthranger_utils#

Module Contents#

ecoscope.io.earthranger_utils.clean_kwargs(addl_kwargs=None, **kwargs)[source]#
Parameters:

addl_kwargs (dict | None)

Return type:

dict

ecoscope.io.earthranger_utils.normalize_column(df, col, sort_columns=False)[source]#
Parameters:
  • df (pandas.DataFrame)

  • col (str)

  • sort_columns (bool)

Return type:

None

ecoscope.io.earthranger_utils.dataframe_to_dict_or_list(events)[source]#
Parameters:

events (geopandas.GeoDataFrame | pandas.DataFrame | dict | list[dict])

Return type:

dict | list[dict]

ecoscope.io.earthranger_utils.to_gdf(df)[source]#
Parameters:

df (pandas.DataFrame)

Return type:

geopandas.GeoDataFrame

ecoscope.io.earthranger_utils.format_iso_time(date_string)[source]#
Parameters:

date_string (str)

Return type:

str

ecoscope.io.earthranger_utils.to_hex(val, default='#ff0000')[source]#
Parameters:
  • val (str | None)

  • default (str)

Return type:

str

ecoscope.io.earthranger_utils.pack_columns(dataframe, columns)[source]#

This method would add all extra columns to single column

Parameters:
  • dataframe (pandas.DataFrame)

  • columns (list)

Return type:

pandas.DataFrame

ecoscope.io.earthranger_utils.geometry_from_event_geojson(df, geojson_column='geojson', force_point_geometry=True, drop_null_geometry=True)[source]#
Parameters:
  • df (pandas.DataFrame)

  • geojson_column (str)

  • force_point_geometry (bool)

  • drop_null_geometry (bool)

Return type:

geopandas.GeoDataFrame

ecoscope.io.earthranger_utils.unpack_events_from_patrols_df(patrols_df, event_type=None, force_point_geometry=True, drop_null_geometry=True)[source]#
Parameters:
  • patrols_df (pandas.DataFrame)

  • event_type (list[str] | None)

  • force_point_geometry (bool)

  • drop_null_geometry (bool)

Return type:

geopandas.GeoDataFrame