### Write AERMOD Meteorological Data (Python) Source: https://context7.com/maxnyf/aermod_framework/llms.txt Configures the meteorological data pathway in the AERMOD input file. This function requires filenames for surface and upper air data, station numbers, the start year, and the base elevation. It appends ME STARTING, ME FINISHED, and relevant met data records. ```python from input_script_functions import write_met_data_lines with open('aermod.inp', 'a') as input_file: write_met_data_lines( surface_observations_file='DEN_2016.SFC', upper_air_data_file='DEN_2016.PFL', met_data_start_year='2016', uairdata_station_number='72469', # Denver radiosonde station surfdata_station_number='725650', # Denver ASOS base_elevation='1655', # meters MSL input_file=input_file ) ``` -------------------------------- ### Setup Discrete Receptor Spreadsheet - Python Source: https://context7.com/maxnyf/aermod_framework/llms.txt Initializes an Excel spreadsheet with headers and formatting required for discrete receptor results from AERMOD. This function sets up columns for Hour, Day, and Year, and then creates paired columns for each specified receptor's coordinates. It also adds a unit notation cell. ```python from output_processing_functions import spreadsheet_setup_discrete from openpyxl import Workbook workbook = Workbook() worksheet = workbook.active # Setup for 4 monitoring stations spreadsheet_setup_discrete( number_receptors=4, output_spreadsheet=worksheet, receptor_coordinate_list_x=[1000, 2000, 0, -1000], receptor_coordinate_list_y=[0, 500, 2000, -500] ) # Creates headers: # Column A: Hour # Column B: Day # Column C: Year # Columns D-E: Receptor at [1000, 0] # Columns F-G: Receptor at [2000, 500] # Columns H-I: Receptor at [0, 2000] # Columns J-K: Receptor at [-1000, -500] # Yellow cell with unit notation: "concentrations in micrograms/meters^3" ``` -------------------------------- ### Write AERMOD Output Options (Python) Source: https://context7.com/maxnyf/aermod_framework/llms.txt Defines output formats and plotting options for the AERMOD simulation. This function allows enabling AERPLOT visualization by setting 'run_aerplot' to 'yes'. It appends OU STARTING, OU FINISHED, and related output configuration records to the input file. ```python from input_script_functions import write_output_option_lines with open('aermod.inp', 'a') as input_file: write_output_option_lines(run_aerplot='yes', input_file=input_file) ``` -------------------------------- ### Write AERMOD Receptor Pathway for Grid Network Source: https://context7.com/maxnyf/aermod_framework/llms.txt Creates a rectangular grid receptor network for spatial concentration mapping in AERMOD. This function requires the starting point coordinates, number of receptors in each direction, and the spacing between them. The output is appended to the AERMOD input file. ```python from input_script_functions import write_receptor_lines_grid # 5km x 5km grid centered on facility with 250m resolution with open('aermod.inp', 'a') as input_file: write_receptor_lines_grid( receptor_grid_starting_point_x=-2500, receptor_grid_starting_point_y=-2500, receptor_grid_number_receptors_x=21, # 21 points * 250m = 5000m receptor_grid_number_receptors_y=21, receptor_grid_spacing_x=250, receptor_grid_spacing_y=250, input_file=input_file ) ``` -------------------------------- ### Run AERMOD Framework Workflow - Python Source: https://context7.com/maxnyf/aermod_framework/llms.txt Represents the entry point for executing the complete AERMOD framework simulation. This function orchestrates the various modules to perform a full air dispersion analysis, such as simulating a power plant with multiple stacks near residential areas. ```python from mainframe import run_aermod_framework ``` -------------------------------- ### Generate AERMOD Input File for Point Source Source: https://context7.com/maxnyf/aermod_framework/llms.txt Writes a comprehensive AERMOD input file for a point source simulation. It requires surface and upper-air meteorological data files, source parameters (location, release height, emission rate, stack parameters), and receptor grid definitions. The output is a single '.inp' file ready for AERMOD execution. ```python write_aermod_input_file( surface_observations_file='temp.SFC', upper_air_data_file='temp.PFL', source_x_points=[100, 200, 300], source_y_points=[50, 100, 150], source_release_height_list=[25, 30, 25], # stack heights in meters source_emission_rate_list=[5.0, 7.5, 6.0], # g/s for point sources source_type='point', # Point source stack parameters source_point_stack_gas_exit_temperature_list=[400, 450, 425], # Kelvin source_point_stack_gas_exit_velocity_list=[15, 20, 18], # m/s source_point_stack_inside_diameter_list=[2.5, 3.0, 2.8], # meters # Area source parameters (not used) source_area_x_direction_length_list=None, source_area_y_direction_length_list=None, met_data_start_year='2016', receptor_style='grid', receptor_coordinate_list_x=None, receptor_coordinate_list_y=None, # 10km x 10km grid with 100m spacing receptor_grid_starting_point_x=-5000, receptor_grid_starting_point_y=-5000, receptor_grid_number_receptors_x=101, receptor_grid_number_receptors_y=101, receptor_grid_spacing_x=100, receptor_grid_spacing_y=100, base_elevation='100', uair_data_station_number='72469', surfdata_station_number='725650', aermap_receptor_output=None, aermap_source_output=None, run_aerplot='yes' ) ``` -------------------------------- ### Run AERMOD Framework Simulation (Python) Source: https://context7.com/maxnyf/aermod_framework/llms.txt Orchestrates the complete AERMOD simulation pipeline, including input validation, file generation (AERMOD, AERPLOT), model execution, and output processing. It takes meteorological data, source configurations, receptor locations, and site characteristics as input and produces an Excel file with concentration data. ```python from mainframe import run_aermod_framework # Complete simulation for area sources with discrete receptors run_aermod_framework( # Meteorological input files (processed by AERMET) surface_observations_file='DEN_2016.SFC', upper_air_data_file='DEN_2016.PFL', met_data_start_year='2016', # Area source configuration (e.g., industrial facility) source_coordinate_list_x=[0, 500, -500], source_coordinate_list_y=[0, 300, -300], source_release_height_list=[1.5], # meters - applies to all sources source_emission_rate_list=[0.001, 0.002, 0.0015], # g/s/m² for area sources source_type='area', source_area_x_direction_length_list=[100, 150, 100], # meters source_area_y_direction_length_list=[100, 150, 100], # meters # Point source parameters (not used for area sources) source_point_stack_gas_exit_temperature_list=None, source_point_stack_gas_exit_velocity_list=None, source_point_stack_inside_diameter_list=None, # Discrete receptor locations (air quality monitoring stations) receptor_style='discrete', receptor_coordinate_list_x=[1000, 2000, 0, -1000], receptor_coordinate_list_y=[0, 500, 2000, -500], receptor_grid_starting_point_x=None, receptor_grid_starting_point_y=None, receptor_grid_number_receptors_x=None, receptor_grid_number_receptors_y=None, receptor_grid_spacing_x=None, receptor_grid_spacing_y=None, # Site characteristics base_elevation='1655', # meters (Denver elevation) uair_data_station_number='72469', # Denver upper air station surf_data_station_number='725650', # Denver surface station # Optional terrain data from AERMAP receptor_aermap_output_file_name=None, source_aermap_output_file_name=None, # Optional visualization with AERPLOT run_aerplot='no', aerplot_northing=None, aerplot_easting=None, aerplot_UTM_zone=None, aerplot_northern_hemisphere=None ) # Output: Creates 'AERMOD concentration outputs.xlsx' with hourly concentration data # Console output: "Program runtime: 2 minutes 15 seconds" # Concentrations in micrograms per cubic meter (µg/m³) ``` -------------------------------- ### Run AERMOD for Power Plant with Point Sources Source: https://context7.com/maxnyf/aermod_framework/llms.txt Configures and runs the AERMOD model for a power plant scenario with two exhaust stacks. It specifies meteorological data, source coordinates, emission rates, stack parameters, receptor grid, terrain data, and enables Google Earth visualization. ```python run_aermod_framework( # Meteorological data for site surface_observations_file='site_2022.SFC', upper_air_data_file='site_2022.PFL', met_data_start_year='2022', # Two exhaust stacks source_coordinate_list_x=[0, 100], # meters source_coordinate_list_y=[0, 50], source_type='point', source_emission_rate_list=[25.0, 30.0], # g/s of SO2 source_release_height_list=[100, 120], # stack heights in meters # Stack characteristics source_point_stack_gas_exit_temperature_list=[450, 475], # Kelvin source_point_stack_gas_exit_velocity_list=[22, 25], # m/s source_point_stack_inside_diameter_list=[3.5, 4.0], # meters # Area source parameters not used source_area_x_direction_length_list=None, source_area_y_direction_length_list=None, # Monitor residential areas on 2km x 2km grid at 100m resolution receptor_style='grid', receptor_coordinate_list_x=None, receptor_coordinate_list_y=None, receptor_grid_starting_point_x=-1000, receptor_grid_starting_point_y=-1000, receptor_grid_number_receptors_x=21, receptor_grid_number_receptors_y=21, receptor_grid_spacing_x=100, receptor_grid_spacing_y=100, # Site elevation and weather stations base_elevation='250', # meters uair_data_station_number='12345', surf_data_station_number='54321', # Use AERMAP terrain data receptor_aermap_output_file_name=('receptors_terrain.txt',), source_aermap_output_file_name=('sources_terrain.txt',), # Generate Google Earth visualization run_aerplot='yes', aerplot_northing=4500000, aerplot_easting=650000, aerplot_UTM_zone=17, aerplot_northern_hemisphere='True' ) ``` -------------------------------- ### Write AERMOD Point Source Data (Python) Source: https://context7.com/maxnyf/aermod_framework/llms.txt Defines emission parameters for point sources (stacks) and appends them to the AERMOD input file. It takes lists for coordinates, emission rates, release heights, and stack parameters like exit temperature, velocity, and diameter. Output includes SRCPARAM and SRCGROUP ALL records. ```python from input_script_functions import write_source_data_point_lines with open('aermod.inp', 'a') as input_file: write_source_data_point_lines( source_x_coordinates_for_naming=[100, 500], source_y_coordinates_for_naming=[200, -100], source_emission_rate_list=[10.0, 15.0], # g/s source_height_list=[50, 75], # stack height in meters stack_gas_exit_temperature_list=[450, 500], # Kelvin stack_gas_exit_velocity_list=[20, 25], # m/s stack_inside_diameter_list=[2.0, 3.0], # meters input_file=input_file ) ``` -------------------------------- ### Write AERMOD Area Source Data (Python) Source: https://context7.com/maxnyf/aermod_framework/llms.txt Specifies emission parameters for multiple area sources and appends them to the AERMOD input file. It requires lists for coordinates, emission rates, release heights, and area dimensions. The output includes SRCPARAM records and an SRCGROUP ALL statement. ```python from input_script_functions import write_source_data_area_lines with open('aermod.inp', 'a') as input_file: write_source_data_area_lines( source_x_coordinates_for_naming=[100, 500, -300], source_y_coordinates_for_naming=[200, -100, 400], source_emission_rate_list=[0.002, 0.005, 0.003], # g/s/m² source_release_height_list=[0.5, 1.0, 0.5], # meters above ground source_area_x_direction_length_list=[50, 100, 75], # meters source_area_y_direction_length_list=[50, 100, 75], # meters input_file=input_file ) ``` -------------------------------- ### Generate AERMOD Input File (Python) Source: https://context7.com/maxnyf/aermod_framework/llms.txt Creates the complete AERMOD input file ('aermod.inp') by specifying all required pathway options based on user-defined parameters for sources, receptors, and meteorology. This function is part of the input file generation capabilities. ```python from input_script_functions import write_aermod_input_file # Example usage (assuming parameters are defined elsewhere) # write_aermod_input_file(...) ``` -------------------------------- ### Create AERPLOT Input File for Google Earth Visualization Source: https://context7.com/maxnyf/aermod_framework/llms.txt Generates the AERPLOT input file used to create Google Earth visualizations from AERMOD concentration data. It requires geographical coordinates (Easting, Northing, UTM zone), display names, and output file names. The output is an '.inp' file that, when processed by AERPLOT, generates a '.kmz' file for Google Earth. ```python from input_script_functions import write_aerplot_input_file # Generate AERPLOT configuration for Denver site write_aerplot_input_file( easting=500000, # UTM coordinates northing=4400000, utm_zone=13, # Denver is UTM Zone 13N northern_hemisphere='True', google_earth_display_name='Denver_Air_Quality_2016', plot_file_name='aerplot_data.PLT', # Generated by AERMOD output_file_name='Denver_Contours' ) ``` -------------------------------- ### Write AERMOD Source Locations (Python) Source: https://context7.com/maxnyf/aermod_framework/llms.txt Appends source location data for area sources to the AERMOD input file. It takes lists of source x and y coordinates and a source type. The output file will contain LOCATION records with concatenated integer coordinates as source names. ```python from input_script_functions import write_source_location_lines source_x = [100, 500, -300] source_y = [200, -100, 400] with open('aermod.inp', 'a') as input_file: write_source_location_lines( source_x_points=source_x, source_y_points=source_y, source_x_coordinates_for_naming=[100, 500, -300], # Integer names source_y_coordinates_for_naming=[200, -100, 400], source_type='area', aermap_source_output=None, input_file=input_file ) ``` -------------------------------- ### Extract Discrete Receptor Concentrations - Python Source: https://context7.com/maxnyf/aermod_framework/llms.txt Extracts hourly and average concentration data for discrete receptors from an AERMOD output file and populates an active Excel worksheet. It requires the output file name, the number of receptors, and the worksheet object. The output includes headers, annual averages, and detailed hourly data. ```python from output_processing_functions import find_concentration_lines_discrete from openpyxl import Workbook # Process AERMOD output for 3 receptors workbook = Workbook() worksheet = workbook.active find_concentration_lines_discrete( output_file_name='aermod.out', number_receptors=3, output_spreadsheet=worksheet ) workbook.save('concentrations.xlsx') # Excel structure: # Row 1: Headers with receptor coordinates # Row 2-3: Annual averages (excluding zeros) # Row 5-6: Annual averages (including zeros) # Row 10+: Hourly concentration data (µg/m³) # Format: Hour | Day | Year | Receptor1 | Receptor2 | Receptor3 | ... ``` -------------------------------- ### Write AERMOD Control Pathway Lines Source: https://context7.com/maxnyf/aermod_framework/llms.txt Writes the Control Pathway section of the AERMOD input file. This function defines essential run parameters such as title, model options, averaging periods, pollutant ID, error file, and run status. The output is appended to the AERMOD input file. ```python from input_script_functions import write_control_lines # Generate control pathway section with open('aermod.inp', 'w') as input_file: write_control_lines(input_file) ``` -------------------------------- ### Write AERMOD Source Pathway for Source Locations Source: https://context7.com/maxnyf/aermod_framework/llms.txt Defines source locations and types within the Source Pathway of the AERMOD input file. This function is a prerequisite for specifying emission rates and other source-specific parameters. The exact parameters and output format depend on the specific implementation of `write_source_location_lines`. ```python from input_script_functions import write_source_location_lines ``` -------------------------------- ### Run AERMOD for Area Sources Fugitive Emissions Study Source: https://context7.com/maxnyf/aermod_framework/llms.txt Configures and runs the AERMOD model to study fugitive emissions from multiple industrial storage areas. It specifies meteorological data, area source parameters, discrete receptor locations, facility elevation, and disables visualization. ```python run_aermod_framework( # Annual meteorological data surface_observations_file='facility.SFC', upper_air_data_file='facility.PFL', met_data_start_year='2023', # Five storage/handling areas source_coordinate_list_x=[0, 200, -200, 100, -100], source_coordinate_list_y=[0, 150, 150, -200, -200], source_type='area', source_emission_rate_list=[0.0005, 0.0008, 0.0006, 0.0012, 0.0010], # g/s/m² source_release_height_list=1.5, # Single value applied to all source_area_x_direction_length_list=[80, 100, 90, 120, 110], # meters source_area_y_direction_length_list=[60, 80, 70, 100, 90], # meters # Point source parameters not needed source_point_stack_gas_exit_temperature_list=None, source_point_stack_gas_exit_velocity_list=None, source_point_stack_inside_diameter_list=None, # Monitoring at fence line and nearby sensitive receptors receptor_style='discrete', receptor_coordinate_list_x=[500, 800, 1200, -600, -900, 0, 200], receptor_coordinate_list_y=[0, 400, 800, 300, 600, 1500, -1000], receptor_grid_starting_point_x=None, receptor_grid_starting_point_y=None, receptor_grid_number_receptors_x=None, receptor_grid_number_receptors_y=None, receptor_grid_spacing_x=None, receptor_grid_spacing_y=None, # Facility location parameters base_elevation='180', uair_data_station_number='72345', surf_data_station_number='723450', # Flat terrain - no AERMAP receptor_aermap_output_file_name=None, source_aermap_output_file_name=None, # No visualization needed run_aerplot='no', aerplot_northing=None, aerplot_easting=None, aerplot_UTM_zone=None, aerplot_northern_hemisphere=None ) ``` -------------------------------- ### Write AERMOD Receptor Pathway for Discrete Locations Source: https://context7.com/maxnyf/aermod_framework/llms.txt Generates the Receptor Pathway for discrete, non-gridded monitoring locations in AERMOD. It takes lists of X and Y coordinates for the receptors and writes them to the specified input file. Optionally, it can handle AERMAP receptor output if terrain data is used. ```python from input_script_functions import write_receptor_lines_discrete # Define receptor locations around a facility receptor_x = [1000, 2000, 3000, 1500, 2500] receptor_y = [500, 1000, 500, 1500, 1500] with open('aermod.inp', 'a') as input_file: write_receptor_lines_discrete( disccart_coordinate_list_x=receptor_x, disccart_coordinate_list_y=receptor_y, aermap_receptor_output=None, # or 'aermap_receptors.txt' if using terrain input_file=input_file ) ``` -------------------------------- ### Validate AERMOD Input Configurations (Python) Source: https://context7.com/maxnyf/aermod_framework/llms.txt Validates user-provided inputs for AERMOD simulations to prevent common errors. This function checks consistency between source and receptor data, emission rates, and other parameters. It returns a boolean indicating validity and prints specific error messages if issues are found. ```python from input_script_functions import check_for_valid_inputs is_valid = check_for_valid_inputs( source_x_points=[100, 200, 300], source_y_points=[50, 100, 150], source_type='area', source_emission_rate_list=[0.001, 0.002, 0.0015], source_release_height_list=[1.0, 1.0, 1.0], source_area_x_direction_length_list=[50, 50, 50], source_area_y_direction_length_list=[50, 50, 50], source_point_stack_gas_exit_temperature_list=None, source_point_stack_gas_exit_velocity_list=None, source_point_stack_inside_diameter_list=None, receptor_coordinate_list_x=[1000, 2000, 3000], receptor_coordinate_list_y=[0, 500, 1000], receptor_style='discrete' ) ``` -------------------------------- ### Extract Grid Receptor Concentrations - Python Source: https://context7.com/maxnyf/aermod_framework/llms.txt Processes AERMOD output for grid receptors to extract annual average concentrations into a matrix format suitable for visualization. It requires the output file name and an active Excel worksheet to populate. The output spreadsheet includes receptor X-coordinates as column headers and Y-coordinates as row headers, with concentration values in the data cells. ```python from output_processing_functions import find_grid_concentration_average from openpyxl import Workbook # Process 21x21 grid output workbook = Workbook() worksheet = workbook.active find_grid_concentration_average( output_spreadsheet=worksheet, output_file_name='aermod.out' ) workbook.save('grid_concentrations.xlsx') # Excel structure: # Row 1: X-coordinates of receptors (columns) # Column 1: Y-coordinates of receptors (rows) # Data cells: Annual average concentrations (µg/m³) # Creates heatmap-ready matrix for visualization ``` -------------------------------- ### Validate Source Data Length - Python Source: https://context7.com/maxnyf/aermod_framework/llms.txt Ensures that lists of source parameters (like emission rates or heights) match the number of sources. It automatically expands single values to match the required length. Returns 'error' if lengths do not match and expansion is not possible. ```python from input_script_functions import check_source_data_for_length # Single value expanded to all sources emission_rates = check_source_data_for_length([0.005], 10) # Returns: [0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005] # Matching length validated heights = check_source_data_for_length([1.0, 1.5, 2.0], 3) # Returns: [1.0, 1.5, 2.0] # Incorrect length returns error bad_data = check_source_data_for_length([1.0, 2.0], 5) # Returns: 'error' # Single numeric value also expands single_val = check_source_data_for_length(2.5, 4) # Returns: [2.5, 2.5, 2.5, 2.5] ``` -------------------------------- ### Extract Temporal Data Lines - Python Source: https://context7.com/maxnyf/aermod_framework/llms.txt Extracts temporal information (Hour, Day, Year) from specific lines in the AERMOD output file and populates the first three columns (A-C) of a given Excel worksheet. Each row in the spreadsheet corresponds to a calculated time step in the model run. ```python from output_processing_functions import find_time_lines from openpyxl import Workbook workbook = Workbook() worksheet = workbook.active find_time_lines( output_file_name='aermod.out', output_spreadsheet=worksheet ) # Populates columns A-C with time data from lines like: # "*** CONCURRENT 1-HR AVERAGE CONCENTRATION VALUES ENDING WITH HOUR 5 FOR DAY 1 OF 2016 ***" # Column A: Hour (1-24) # Column B: Day (1-365) # Column C: Year (e.g., 2016) # Creates row for each hour in the meteorological dataset ``` -------------------------------- ### Parse AERMOD Time Data Line - Python Source: https://context7.com/maxnyf/aermod_framework/llms.txt Parses a single line from an AERMOD output file to extract the hour, day, and year of the concentration calculation. This function is useful for processing specific header lines that indicate the time step. It handles variable spacing within the AERMOD output format. ```python from output_processing_functions import find_time_data_from_line # Parse AERMOD time header line = "*** CONCURRENT 1-HR AVERAGE CONCENTRATION VALUES ENDING WITH HOUR 5 FOR DAY 1 OF 2016 ***" time_data = find_time_data_from_line(line) # Returns: ['5', '1', '2016'] # Index 0: Hour (5) # Index 1: Day (1) # Index 2: Year (2016) # Handles variable spacing in AERMOD output line2 = "*** CONCURRENT 1-HR AVERAGE CONCENTRATION VALUES ENDING WITH HOUR 23 FOR DAY 365 OF 2016 ***" time_data2 = find_time_data_from_line(line2) # Returns: ['23', '365', '2016'] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.