@@ 16,6 16,7 @@ import pandas as pd
import pint
import pint_pandas
+from geopandas import GeoDataFrame
from orgmatt.nutrients import nutrient_from_population as nfp
from .units import *
@@ 38,7 39,7 @@ Nutrients = Literal["N", "P", "K"] | Sequence[Literal["N", "P", "K"]]
def local_deposits(
country: str,
- area: str | Iterable | gpd.GeoDataFrame,
+ area: GeoDataFrame,
days: dict[str, int],
admin_level: int | None = None,
ci: int = 0,
@@ 100,21 101,20 @@ def local_deposits(
# iterative calls if multiple areas
multiarea = True
- if isinstance(area, str):
- multiarea = False
- elif isinstance(area, gpd.GeoDataFrame):
+ print(area)
+
+ if isinstance(area, gpd.GeoDataFrame):
multiarea = (len(area) > 1)
- if multiarea:
- # order biggest cities first
- order = list(range(len(area)))
+ if multiarea:
+ # order biggest cities first
+ order = list(range(len(area)))
- if "population" in area:
- order = np.argsort(area.population)[::-1]
+ if "population" in area:
+ order = np.argsort(area.population)[::-1]
- area = [area.iloc[[i]].reset_index(drop=True) for i in order]
+ area = [area.iloc[[i]].reset_index(drop=True) for i in order]
- if multiarea:
# configure progress bar
pbar_name = "Computing deposits"
@@ 377,7 377,7 @@ def plot_map_deposits(
pstr = translate("population", lang)
- subtitle = area_name + ", " if area_name else "" \
+ subtitle = (area_name + ", " if area_name else "") \
+ f"{pstr}: {int(res_pop):_d}"
# add thousand separator