pt_12_co2_dir = r"E:\Matriisiajot2015\RESULTS\MassaAjot2015_PT_klo12_CARBON" car_08_co2_dir = r"E:\Matriisiajot2015\RESULTS\MassaAjot2015_Car_Rushhour_CARBON" car_12_co2_dir = r"E:\Matriisiajot2015\RESULTS\MassaAjot2015_Car_Midday_CARBON" # Final output path for "Helsinki Region Travel CO2 Matrix 2015" co2_matrix_2015 = r"E:\Matriisiajot2015\RESULTS\HelsinkiRegion_TravelCO2Matrix2015" # Path to RouteCarbonCalculator co2_calculator = r"C:\HY-Data\HENTENKA\KOODIT\HelsinkiRegionTravelCO2\codes\CarbonCalculator\RouteCarbonCalculator2015.jar" # ========================================================= # Initialize function library # ========================================================= fl = funclib.matrixMethods(pt_r_dir=pt_08_dir, pt_m_dir=pt_12_dir, pt_r_co2_dir=pt_08_co2_dir, pt_m_co2_dir=pt_12_co2_dir, car_r_dir=car_08_dir, car_m_dir=car_12_dir, car_r_co2_dir=car_08_co2_dir, car_m_co2_dir=car_12_co2_dir, co2_calculator_path=co2_calculator) # ============================================================= # Create Process objects ==> Enable multiprocessing in parallel # ============================================================= # NOTICE! # You should take care that there is sufficiently memory (RAM) in your computer. # Creating too many processes may exceed your memory limit and produce a memory error. # 3 processes is the maximum that can be used without problems with computer that has 16GB of RAM. # Process1 # ======== # Set up start-end indices
fl.calculateFuelConsumptionDB(input_col=input_col, target_col=target_col, fuel_consumption_factor=fuel_consumption) # Create PostGIS Indices for 'to_id' and 'from_id' to enable fast lookups fl.createMatrixIndexes() if __name__ == '__main__': # -------------------------- # File paths and Parameters # -------------------------- ykr_fp = r"C:\HY-Data\HENTENKA\Python\MassaAjoNiputus\ShapeFileet\MetropAccess_YKR_grid\MetropAccess_YKR_grid_EurefFIN.shp" outDir = r"E:\Matriisiajot2015\RESULTS\HelsinkiRegion_TravelCO2Matrix2015_Matrix" # Initialize matrix methods fl = funclib.matrixMethods(matrix_dir=outDir, ykr_grid_fp=ykr_fp) # Flag for creating columns and indices to table and calculating fuel consumption # ==> Set True if you want to do those processes process_table = False # Direction of the results: either 'to' or 'from' direction = 'to' # 'from' # ========================================================= # Do PostGIS stuff first # ========================================================= # Connect to DB fl.connect_to_DB()