def main(): wtsd_name = get_watershed_name('Specify watershed name to run preprocess.') if wtsd_name not in list(DEMO_MODELS.keys()): print('%s is not one of the available demo watershed: %s' % (wtsd_name, ','.join(list(DEMO_MODELS.keys())))) exit(-1) cur_path = UtilClass.current_path(lambda: 0) SEIMS_path = os.path.abspath(cur_path + '../../..') model_paths = ModelPaths(SEIMS_path, wtsd_name, DEMO_MODELS[wtsd_name]) seims_cfg = write_preprocess_config_file(model_paths, 'preprocess.ini') SpatialDelineation.workflow(seims_cfg) # Spatial delineation by TauDEM ImportMongodbClass.workflow(seims_cfg) # Import to MongoDB database
def main(): wtsd_name = get_watershed_name( 'Specify watershed name to run auto-calibration.') if wtsd_name not in list(DEMO_MODELS.keys()): print('%s is not one of the available demo watershed: %s' % (wtsd_name, ','.join(list(DEMO_MODELS.keys())))) exit(-1) cur_path = UtilClass.current_path(lambda: 0) SEIMS_path = os.path.abspath(cur_path + '../../..') model_paths = ModelPaths(SEIMS_path, wtsd_name, DEMO_MODELS[wtsd_name]) cali_cfg = write_calibration_config_file(model_paths, 'calibration.ini') cali_nsga2.main(cali_cfg)
def main(): wtsd_name = get_watershed_name( 'Specify watershed name to run SEIMS-based model.') if wtsd_name not in list(DEMO_MODELS.keys()): print('%s is not one of the available demo watershed: %s' % (wtsd_name, ','.join(list(DEMO_MODELS.keys())))) exit(-1) cur_path = UtilClass.current_path(lambda: 0) SEIMS_path = os.path.abspath(cur_path + '../../..') model_paths = ModelPaths(SEIMS_path, wtsd_name, DEMO_MODELS[wtsd_name]) scenario_id = 0 seims_obj = MainSEIMS(model_paths.bin_dir, model_paths.model_dir, scenario_id=scenario_id) seims_obj.run()
def main(): wtsd_name = get_watershed_name( 'Specify watershed name to run SEIMS-based model.') if wtsd_name not in list(DEMO_MODELS.keys()): print('%s is not one of the available demo watershed: %s' % (wtsd_name, ','.join(list(DEMO_MODELS.keys())))) exit(-1) cur_path = UtilClass.current_path(lambda: 0) SEIMS_path = os.path.abspath(cur_path + '../../..') model_paths = ModelPaths(SEIMS_path, wtsd_name, DEMO_MODELS[wtsd_name]) runmodel_cfg = write_runmodel_config_file(model_paths, 'runmodel.ini') seims_obj = MainSEIMS(args_dict=runmodel_cfg.ConfigDict) seims_obj.run() for l in seims_obj.runlogs: print(l)
def main(): wtsd_name = get_watershed_name( 'Specify watershed name to run postprocess.') if wtsd_name not in list(DEMO_MODELS.keys()): print('%s is not one of the available demo watershed: %s' % (wtsd_name, ','.join(list(DEMO_MODELS.keys())))) exit(-1) cur_path = UtilClass.current_path(lambda: 0) SEIMS_path = os.path.abspath(cur_path + '../../..') model_paths = ModelPaths(SEIMS_path, wtsd_name, DEMO_MODELS[wtsd_name]) # hydrograph, e.g. discharge scenario_id = 0 calibration_id = -1 post_cfg = write_postprocess_config_file(model_paths, 'postprocess.ini', scenario_id, calibration_id) TimeSeriesPlots(post_cfg).generate_plots()
def main(): wtsd_name = get_watershed_name( 'Specify watershed name to run parameters sensitivity analysis.') if wtsd_name not in list(DEMO_MODELS.keys()): print('%s is not one of the available demo watershed: %s' % (wtsd_name, ','.join(list(DEMO_MODELS.keys())))) exit(-1) cur_path = UtilClass.current_path(lambda: 0) SEIMS_path = os.path.abspath(cur_path + '../../..') model_paths = ModelPaths(SEIMS_path, wtsd_name, DEMO_MODELS[wtsd_name]) psa_cfg = write_sensitivity_config_file(model_paths, 'sensitivity_analysis.ini') print('### START TO PARAMETERS SENSITIVITY ANALYSIS ###') start_t = time.time() saobj = Sensitivity(psa_cfg) saobj.run() saobj.plot() print('### END OF PARAMETERS SENSITIVITY ANALYSIS ###') print('Running time: %.2fs' % (time.time() - start_t))
def main(): wtsd_name = get_watershed_name( 'Specify watershed name to run scenario analysis.') if wtsd_name not in list(DEMO_MODELS.keys()): print('%s is not one of the available demo watershed: %s' % (wtsd_name, ','.join(list(DEMO_MODELS.keys())))) exit(-1) cur_path = UtilClass.current_path(lambda: 0) SEIMS_path = os.path.abspath(cur_path + '../../..') model_paths = ModelPaths(SEIMS_path, wtsd_name, DEMO_MODELS[wtsd_name]) cf = write_scenario_analysis_config_file(model_paths, 'scenario_analysis.ini') base_cfg = SAConfig(cf) # type: SAConfig if base_cfg.bmps_cfg_unit == BMPS_CFG_UNITS[3]: # SLPPOS cfg = SASlpPosConfig(cf) elif base_cfg.bmps_cfg_unit == BMPS_CFG_UNITS[2]: # CONNFIELD cfg = SAConnFieldConfig(cf) else: # Common spatial units, e.g., HRU and EXPLICITHRU cfg = SACommUnitConfig(cf) cfg.construct_indexes_units_gene() sce = SUScenario(cfg) scoop_log('### START TO SCENARIOS OPTIMIZING ###') start_t = time.time() fpop, fstats = sa_nsga2.main(sce) fpop.sort(key=lambda x: x.fitness.values) scoop_log(fstats) with open(cfg.opt.logbookfile, 'w', encoding='utf-8') as f: # In case of 'TypeError: write() argument 1 must be unicode, not str' in Python2.7 # when using unicode_literals, please use '%s' to concatenate string! f.write('%s' % fstats.__str__()) end_t = time.time() scoop_log('Running time: %.2fs' % (end_t - start_t))