concentration.py
The concentration object runs ISRM-based calculations for each of the vertical layer’s of the ISRM grid by processing individual concentration_layer objects. The object inputs an emissions object (from emissions.py) and the ISRM object (from isrm.py). The object then estimates total concentrations at ground-level resulting from emissions.
Inputs
emis_obj: the emissions object, as defined byemissions.pyisrm_obj: the ISRM object, as defined byisrm.pydetailed_conc_flag: a Boolean indicating whether concentrations should be output at a detailed level or notrun_parallel: a Boolean indicating whether or not to run in paralleloutput_dir: a string pointing to the output directoryoutput_emis_flag: a Boolean indicating whether ISRM-allocated emissions should be outputdebug_mode: a Boolean indicating whether or not to output debug statementsshp_path: data variable file path for the borderoutput_region: a geodataframe containing only the region of interestoutput_geometry_fps: a dictionary containing a mapping betweenregion_categoryand the filepathsoutput_resolution: a geodataframe containing only the region of interestrun_calcs: a Boolean indicating whether the program should run, or if it should just check the inputs (useful for debugging)verbose: a Boolean indicating whether the user wants to run in verbose mode
Attributes
isrm_id: a Series of all ISRM grid cell IDsisrm_geom: the geometry (geographic attributes) of the ISRM gridcrs: the coordinate reference system associated with the ISRM gridname: a string representing the run name preferred by the user
Calculated Attributes
detailed_conc: geodataframe of the detailed concentrations at ground-level combined from all three vertical layersdetailed_conc_clean: simplified geodataframe of the detailed concentrations at ground-level combined from all three vertical layerstotal_conc: geodataframe with total ground-level PM2.5 concentrations across the ISRM gridsummary_conc: a geodataframe with the total ground-level PM2.5 concentrations at the coarsest spatial resolution requested by the usercrosswalk: a pandas dataframe connecting theISRM_IDwith theNAMEof the geographic sub-area (if relevant)
Internal Functions
run_layer: estimates concentrations for a single layer by creating aconcentration_layerobject for that layercombine_concentrations: checks for each of the layer flags in theemissionsobject, and then calls therun_layerfunction for each layer that is flagged. Then, combines the concentrations from each layer flagged into the three concentration geodataframes described aboveget_summary_conc: creates the summary concentration object if the output resolution is coarser than the ISRM grid
External Functions
visualize_concentrations: draws a map of concentrations for a variable (var) and exports it as a PNG into an output directory (output_dir) of choiceexport_concentrations: exports concentrations as a shapefile into an output directory (output_dir) of choiceoutput_concentrations: function for outputting concentration data by calling thevisualize_concentrationsandexport_concentrationsfunctions