milton_maps package

Subpackages

Submodules

milton_maps.cli module

Usage: milton_maps CMD …

Arguments:

CMD

Options:

-h –help

milton_maps.cli.main()[source]

Console script command routing for milton_maps.

milton_maps.logging_config module

milton_maps.logging_config.configure_logging(log_file='pipeline.log')[source]
milton_maps.logging_config.log_dataframe(logger: Logger, df: DataFrame, description: str, loglevel: int = 20)[source]

Convenience function to include a short dataframe result and description in logs

milton_maps.milton_maps module

milton_maps.milton_maps.html_legend(cmap_dict)[source]
milton_maps.milton_maps.make_choropleth_style_function(df: DataFrame, attr: str, colormap: str, navalue='None')[source]
milton_maps.milton_maps.plot_map(gdf: GeoDataFrame, column: str, categorical: bool = True, axis_scale: float = 1, legend_shift: float = 1, figsize: Tuple[int, int] = (20, 20), markersize: float = 0.01, legend: bool = True, title: str | None = None, cmap: str = 'gist_earth', fig=None, ax=None, **style_kwds)[source]

Generic function to plot maps from GeoDataFrame.

Args:

gdf (geopandas.GeoDataFrame): the GeoDataFrame we want to plot map from. column (str): column name that we want to use in the plot. categorical (bool): True if the column should be treated as a categorical variable,`False`` if not. Defaults to True. axis_scale (float): the scale to enlarge or shrink the axis. Defaults to 1 (no size adjustments). legend_shift (float): how much to shift the legend box to the right. Defaults to 1. Larger number will shift the legend box further to the right. This parameter is used to prevent overlap of the legend box and the map. figsize (tuple): the size of the figure. Defaults to (20, 20). markersize (float): the size of the marker, only useful for GeoDataFrame that contains point geometries. Defaults to 0.01. title (str): the title of the figure. Defaults to None, in which case no title will be set. cmap (str): the color map to use in the map plot. Defaults to 'gist_earth'. The color maps available in matplotlib can be found here: https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html ax: (matplotlib.axes._subplots.AxesSubplot) matplotlib axis object to add plot to

Returns:

matplotlib.axes._subplots.AxesSubplot: matplotlib plot.

milton_maps.milton_maps.transform_use_codes(use_codes: Series) Series[source]

Standardizes use codes by extracting first three digits and looking up description

USE_CODE – state three-digit use code with optional extension digit to accommodate the four-digit codes commonly used by assessors. If the codes contain a four-digit use code, because the meaning of the fourth digit varies from community-to-community, the standard requires a lookup table. See the end of this Section for more details on this look-up table.

milton_maps.process_assessor_db module

Usage: milton_maps process_assessor_db INPUT LAYER OUTPUT

Arguments:

INPUT path to GDB file containing assessor DB in layer LAYER LAYER layer within GDB file containing asessor DB OUTPUT output path to write processed Assessor DB as a pickled dataframe

milton_maps.process_assessor_db.process_assessor_db(input_path, layer, output_path)[source]

milton_maps.process_crash_data module

milton_maps.process_crash_data.get_crash_data(milton_boundaries=None) GeoDataFrame[source]
milton_maps.process_crash_data.get_milton_boundaries()[source]
milton_maps.process_crash_data.get_randolph_ave_shape()[source]
milton_maps.process_crash_data.randolph_ave_upstream_vs_intersection(crash_geodf=None, randolph_ave=None)[source]

milton_maps.process_openspace module

Usage: milton_maps process_openspace INPUT OUTPUT

Arguments:

INPUT path to SHP file containing assessor DB in layer LAYER OUTPUT output path to write processed Assessor DB as a pickled dataframe

milton_maps.process_openspace.process_openspace(input_path, output_path)[source]

milton_maps.process_tax_parcels module

Usage: milton_maps process_tax_parcels TAX_PARCELS ASSESSOR_DBS OUTPUT

Arguments:

TAX_PARCELS comma separated list of paths to SHP files containing tax parcels for towns ASSESSOR_DBS comma separated list of paths to pkl files containing cleaned assessor DB dataframes for towns OUTPUT output path to write processed Assessor DB as a pickled dataframe

milton_maps.process_tax_parcels.process_tax_parcels(tax_parcel_paths, assessor_db_paths, output)[source]

milton_maps.process_town_boundaries module

Usage: milton_maps process_town_boundaries INPUT OUTPUT

Arguments:

INPUT path to GDB file containing assessor DB OUTPUT output path to write processed Assessor DB as a pickled dataframe

milton_maps.process_town_boundaries.process_town_boundaries(input_path, output_path)[source]

Module contents

Top-level package for milton_maps