Commit a4d89fb2 authored by Dumoulin Nicolas's avatar Dumoulin Nicolas
Browse files

shapefiles written in post-process step, useless here

parent 8e53a37c
......@@ -145,27 +145,6 @@ class MCMC:
return scenarios
def write_data(self, iter_nb, scenarios):
print(' Writing modified patches of scenarios')
# Writing shapefiles
start_time = time.time()
shp_dir = self.outputdir + '/patches_iter_{0:03d}'.format(iter_nb)
counter = 0
for index,scenario in tqdm(scenarios.cultgeopat.iterrows(), total=len(scenarios.cultgeopat)):
#if scenarios.scores.loc[index,'full_reallocated']:
counter += 1
concat = pd.concat([self.patches, scenario.to_frame("newcult")], axis=1)
concat = concat[concat['init_cult']!=concat['newcult']]
if len(concat)>0:
for c in ['newcult','cultgeopat','init_cult']:
patutils.decode_cultgeopat(concat, c)
concat.to_file(shp_dir+'/{:03d}_{}'.format(iter_nb, index), encoding='utf-8')
elapsed_time = time.time() - start_time
#print(' {} shapefiles (only scenario fully reallocated) written in {}'.format(counter, time.strftime("%M:%S", time.gmtime(elapsed_time))))
print(' {} shapefiles written in {}'.format(counter, time.strftime("%M:%S", time.gmtime(elapsed_time))))
def run(self):
# Start with initial scenario
scenarios = ScenariosStack(self.indicators, self.reallocator, self.patches)
......@@ -182,9 +161,8 @@ class MCMC:
if scenarios.allFullReallocated():
print('All scenarios are fully reallocated. Simulation finished.')
self.write_data(nb_iteration, scenarios)
return scenarios
if __name__ == '__main__':
mcmc = MCMC('MCMC_config.yml')
scenario =
scenarios =
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment