if __name__ == '__main__': # 1979 is spin up # 1980 till 1984 is used for calibration # 1985 till 1989 is used for validation begin = 1980 end = 1989 prefix = "semi_dis_landuse" runs = 100000 # File names of the forcing data subcatchment_names = ["grass", "wood", "rest", "crops"] # import algorithm from spotpy.algorithms import rope as sampler # Find out if the model should run parallel (for supercomputer) parallel = 'mpi' if 'OMPI_COMM_WORLD_SIZE' in os.environ else 'seq' # Create the model model = SemiDisLanduse(datetime.datetime(begin, 1, 1), datetime.datetime(end, 12, 31), subcatchment_names) sampler = sampler(model, parallel=parallel, dbname="semi_dis_landuse_penman", dbformat="csv", save_sim=True, save_threshold=[0, 0]) sampler.sample(runs, subsets=30)
""" return spotpy.parameter.generate(self.Params) @staticmethod def objectivefunction(simulation, evaluation): """ For Spotpy """ return spotpy.objectivefunctions.nashsutcliffe(evaluation, simulation) if __name__ == '__main__': from spotpy.algorithms import lhs as sampler parallel = 'mpi' if 'OMPI_COMM_WORLD_SIZE' in os.environ else 'seq' model = LumpedModelCMF() # par = model.parameters()['optguess'] # sim = model.simulation(par) # evalu = model.evaluation() # like = model.objectivefunction(sim, evalu) # print(like) # print(evalu) # print(sim) sampler = sampler(model, parallel=parallel, dbname="bench.csv", dbformat="csv") sampler.sample(1000)
# 1979 is spin up # 1980 till 1984 is used for calibration # 1985 till 1989 is used for validation begin = 1980 end = 1989 prefix = "semi_dis_landuse" runs = 100000 # File names of the forcing data subcatchment_names = ["grass_high", "wood_high", "rest_high", "crops_high", "grass_low", "wood_low", "rest_low", "crops_low"] # import algorithm from spotpy.algorithms import rope as sampler # Find out if the model should run parallel (for supercomputer) parallel = 'mpi' if 'OMPI_COMM_WORLD_SIZE' in os.environ else 'seq' # Create the model model = SemiDisLanduse(datetime.datetime(begin, 1, 1), datetime.datetime(end, 12, 31), subcatchment_names) sampler = sampler(model, parallel=parallel, dbname="semi_dis_landuse_height_hargreaves", dbformat="csv", save_sim=True, save_threshold=[0, 0]) sampler.sample(runs, subsets=30) #print(cmf.describe(model.project))