Update src/seismic_hazard_forecasting.py
This commit is contained in:
		@@ -112,14 +112,6 @@ verbose: {verbose}")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    dask.config.set(scheduler='processes')
 | 
					    dask.config.set(scheduler='processes')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # validate m_max against the grond motion model if forecasting was selected
 | 
					 | 
				
			||||||
    models_anthro_limited = ['Lasocki2013', 'Atkinson2015', 'ConvertitoEtAl2012Geysers'] # these models require that m_max<=4.5
 | 
					 | 
				
			||||||
    if forecast_select:
 | 
					 | 
				
			||||||
        if m_max > 4.5 and model in models_anthro_limited: 
 | 
					 | 
				
			||||||
            msg = "Selected ground motion model only valid up to a maximum magnitude of 4.5. Please try again with a lower maximum magnitude."
 | 
					 | 
				
			||||||
            logger.error(msg)
 | 
					 | 
				
			||||||
            raise Exception(msg)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # run magnitude distribution modeling if selected by user and no magnitude pdf file provided
 | 
					    # run magnitude distribution modeling if selected by user and no magnitude pdf file provided
 | 
				
			||||||
    if m_select and m_range[0] == None and m_pdf[0] == None:
 | 
					    if m_select and m_range[0] == None and m_pdf[0] == None:
 | 
				
			||||||
        logger.info("Magnitude distribution modeling selected")
 | 
					        logger.info("Magnitude distribution modeling selected")
 | 
				
			||||||
@@ -169,6 +161,7 @@ verbose: {verbose}")
 | 
				
			|||||||
        if m_max == None:
 | 
					        if m_max == None:
 | 
				
			||||||
            m_max = mag.max() + 1.0
 | 
					            m_max = mag.max() + 1.0
 | 
				
			||||||
            logger.info(f"No m_max was given. Therefore m_max is automatically set to: {m_max}")
 | 
					            logger.info(f"No m_max was given. Therefore m_max is automatically set to: {m_max}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        start = timer()
 | 
					        start = timer()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        t_windowed, r_windowed = win_CNE(time, [lon, lat, mag], win_size=len(mag), win_overlap=0, min_events=1)
 | 
					        t_windowed, r_windowed = win_CNE(time, [lon, lat, mag], win_size=len(mag), win_overlap=0, min_events=1)
 | 
				
			||||||
@@ -374,18 +367,26 @@ verbose: {verbose}")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if forecast_select:
 | 
					    if forecast_select:
 | 
				
			||||||
        products = products_string.split()
 | 
					        products = products_string.split()
 | 
				
			||||||
        logger.info(
 | 
					        logger.info(f"Ground motion forecasting selected with ground motion model {model} and IMT products {products_string}")
 | 
				
			||||||
            f"Ground motion forecasting selected with ground motion model {model} and IMT products {products_string}")
 | 
					
 | 
				
			||||||
 | 
					        # validate m_max against the grond motion model
 | 
				
			||||||
 | 
					        models_anthro_limited = ['Lasocki2013', 'Atkinson2015', 'ConvertitoEtAl2012Geysers'] # these models require that m_max<=4.5
 | 
				
			||||||
 | 
					        if m_max > 4.5 and model in models_anthro_limited: 
 | 
				
			||||||
 | 
					            msg = f"Selected ground motion model {model} is only valid up to a maximum magnitude of 4.5. Please try again with a lower maximum magnitude."
 | 
				
			||||||
 | 
					            logger.error(msg)
 | 
				
			||||||
 | 
					            raise Exception(msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if not xy_select:
 | 
					        if not xy_select:
 | 
				
			||||||
            msg = "Event location distribution modeling was not selected; cannot continue..."
 | 
					            msg = "Event location distribution modeling was not selected; cannot continue..."
 | 
				
			||||||
            logger.error(msg)
 | 
					            logger.error(msg)
 | 
				
			||||||
            raise Exception(msg)
 | 
					            raise Exception(msg)
 | 
				
			||||||
        elif m_pdf[0] == None:
 | 
					
 | 
				
			||||||
 | 
					        if m_pdf[0] == None:
 | 
				
			||||||
            msg = "Magnitude distribution modeling was not selected and magnitude PDF file was not provided; cannot continue..."
 | 
					            msg = "Magnitude distribution modeling was not selected and magnitude PDF file was not provided; cannot continue..."
 | 
				
			||||||
            logger.error(msg)
 | 
					            logger.error(msg)
 | 
				
			||||||
            raise Exception(msg)
 | 
					            raise Exception(msg)
 | 
				
			||||||
        elif lambdas[0] == None:
 | 
					        
 | 
				
			||||||
 | 
					        if lambdas[0] == None:
 | 
				
			||||||
            msg = "Activity rate modeling was not selected and custom activity rate was not provided; cannot continue..."
 | 
					            msg = "Activity rate modeling was not selected and custom activity rate was not provided; cannot continue..."
 | 
				
			||||||
            logger.error(msg)
 | 
					            logger.error(msg)
 | 
				
			||||||
            raise Exception(msg)
 | 
					            raise Exception(msg)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user