""" Program: CS115 Project 3 Author: Your name here. Description: TBD """ def get_concentration(m): """Prompts the user for the reading from monitor m, then returns the concentration as an integer or float, transforming it according to the following conventions: PM-2.5: truncate to 1 decimal place (ug/m3) PM-10: truncate to integer (ug/m3) NO2: truncate to integer (ppb) SO2: truncate to integer (ppb) CO: truncate to 1 decimal place (ppm) O3: truncate to integer (ppb) Args: m (str): The type of monitor. Returns: int or float: The concentration. """ pass def get_per_pollutant_index(breakpoints, monitors, m, c): """Generates the per-pollutant index using the AQI formula for the concentration 'c' associated with pollutant monitor 'm'. The calculation makes use of the EPA breakpoint table. If the concentration is out of range or should be ignored, returns -1; otherwise, returns the index that was calculated. Each row of 'breakpoints' has the following format: [category, [index_low, index_high], p_bounds_list] Where p_bounds_list is a 2D list of pollution concentration bounds; each row holds the bounds [c_low, c_high] for a particular monitor. Args: breakpoints (list): A list of rows comprising the EPA breakpoint table. monitors (list): A list of monitors in the same order as p_bounds_list. m (str): The monitor originating the concentration. c (float or int): The concentration. Returns: int: The per-pollutant index or -1 """ return -1 def main(): # The monitors that measure different pollutant concentrations monitors = ['PM-2.5 [ug/m3, 24-hr avg]', 'PM-10 [ug/m3, 24-hr avg]', 'NO2 [ppb, 1-hr avg]', 'SO2 [ppb, 1-hr avg]', 'CO [ppm, 8-hr avg]', 'O3 [ppb, 8-hr avg]', 'O3 [ppb, 1-hr avg]'] ignore = [float('inf'), float('-inf')] # EPA breakpoint table. # Every row looks like: # ['Condition', AQI-bound, [ # PM-2.5-bound, PM-10-bound, NO2-bound, # SO2-bound, CO-bound, O3-8-hr-bound, O3-1-hr-bound # ]] epa_table = [ ['Good', [0, 50], [ [0, 12.0], [0, 54], [0, 53], [0, 35], [0, 4.4], [0, 54], ignore ]], ['Moderate', [51, 100], [ [12.1, 35.4], [55, 154], [54, 100], [36, 75], [4.5, 9.4], [55, 70], ignore ]], ['Unhealthy for Sensitive Groups', [101, 150], [ [35.5, 55.4], [155, 254], [101, 360], [76, 185], [9.5, 12.4], [71, 85], [125, 164] ]], ['Unhealthy', [151, 200], [ [55.5, 150.4], [255, 354], [361, 649], [186, 304], [12.5, 15.4], [86, 105], [165, 204] ]], ['Very Unhealthy', [201, 300], [ [150.5, 250.4], [355, 424], [650, 1249], [305, 604], [15.5, 30.4], [106, 200], [205, 404] ]], ['Hazardous', [301, 500], [ [250.5, 500.4], [425, 604], [1250, 2049], [605, 1004], [30.5, 50.4], ignore, [405, 604] ]] ] locations = [] # all locations aqi_indices = [] # the AQI reading for each location pm25_readings = [] # all PM-2.5 readings print('=== Air Quality Index (AQI) Calculator ===') loc = input('\nEnter name of ** Location **: ') while loc != '': locations.append(loc) concentrations = [] # monitor readings for loc ppi = [] # per-pollutant indices for loc for m in monitors: c = get_concentration(m) concentrations.append(c) index = get_per_pollutant_index(epa_table, monitors, m, c) ppi.append(index) # TODO (Final Code): print the per-pollutant concentration (write a new function) if 'PM-2.5' in m: pm25_readings.append(c) aqi = -1 # TODO (Part A): calculate AQI aqi_indices.append(aqi) # Print values for Part A (remove for final code) print('\t', concentrations) print('\t', ppi) print(locations) print(aqi_indices) print(pm25_readings) # TODO (Final Code): print both the aqi and condition loc = input('\nEnter name of ** Location **: ') # TODO (Final Code): print the summary report (write a new function) main()