population.py
The population object stores detailed Census tract-level population data for the environmental justice exposure calculations and the health impact calculations from an input population dataset.
Inputs
file_path: the file path of the raw population dataload_file: a Boolean indicating whether or not the file should be loaded (for debugging)verbose: a Boolean indicating whether or not detailed logging statements should be printeddebug_mode: a Boolean indicating whether or not to output debug statements
Attributes
valid_file: a Boolean indicating whether or not the file provided is validgeometry: geospatial information associated with the emissions inputpop_all: complete, detailed population data from the sourcepop_geo: a geodataframe with population IDs and spatial informationcrs: the inherent coordinate reference system associated with the emissions inputpop_exp: a geodataframe containing the population information with associated spatial information, summarized across age binspop_hia: a geodataframe containing the population information with associated spatial information, broken out by age bin
Internal Functions
check_path: checks to see if the file exists at the path specified and returns whether the file is validload_population: loads the population data based on the file extensionload_shp: loads the population shapefile data using geopandas and post-processesload_feather: loads the population feather data using geopandas and post-processesmake_pop_exp: makes the exposure population data frame by summing across age binsmake_pop_hia: makes the health impact assessment population data frame by retaining key informationcrosswalk: creates a crosswalk of the population cells and ISRM grid cells
External Functions
project_pop: projects the population data to a new coordinate reference systemallocate_pop: reallocates population into new geometry using a spatial intersect calculated bycrosswalk