bucky.data.adm_mapping#

Classes to handle the mappings between ADM levels, their names, etc

Module Contents#

Classes#

AdminLevel

Wrapper for data for one admin level

AdminLevelMapping

Wrapper for the stack of admin levels and their info

class bucky.data.adm_mapping.AdminLevel(ids, level=0, abbrs=None, names=None)[source]#

Wrapper for data for one admin level

abbrs :bucky._typing.ArrayLike#
ids :bucky._typing.ArrayLike#
idx :bucky._typing.ArrayLike#
level :int#
names :bucky._typing.ArrayLike#
__len__(self)[source]#

len(AdminLevel) is the number of unique locations

__repr__(self)[source]#

Pretty print the admin level obj

class bucky.data.adm_mapping.AdminLevelMapping(adm2: AdminLevel, adm1: Optional[AdminLevel] = None, adm0: Optional[AdminLevel] = None, levels: dict = field(init=False))[source]#

Wrapper for the stack of admin levels and their info

adm0 :AdminLevel#
adm1 :AdminLevel#
adm2 :AdminLevel#
__repr__(self) str[source]#

Pretty print the mapping obj

actual_adm1_ids(self)[source]#

DEPRECATED

static from_csv(filename: bucky._typing.PathLike)[source]#

Read the admin mapping from a csv file

mapping(self, from_: str, to: str, level: int)[source]#

Return dict mappings between attributes of the admin level (for use with pandas.Series.map)

property n_adm1(self)#

DEPRECATED: return the number of adm1 regions

to_csv(self, filename: bucky._typing.PathLike)[source]#

Save the admin mapping to a csv file