def create_replicate_map_pack(self, m_name, instance_idx, replicate, ls): action = "REPLICATE_MAP_PACK" model_file = mdig.repository.get_models()[m_name] dm = DispersalModel(model_file) instance = dm.get_instances()[instance_idx] # Tell web interface we've started msg = {'model': m_name, 'action': action, 'status': {'started': datetime.datetime.now(), 'active_instance': instance_idx, 'description': "Generating images", 'active_replicate': replicate}} self.results_q.put(msg) # Add listener so that we have progress updates instance.listeners.append(self.listener) # also convert replicate maps into images # via ExportAction from actions import ExportAction ea = ExportAction() ea.parse_options([]) ea.options.output_map_pack = True ea.options.output_lifestage = ls ea.options.overwrite_flag = True ea.options.reps = [replicate] try: ea.do_instance(instance) except: raise msg = {'model': m_name, 'action': action, 'status': { 'active_instance': instance_idx, 'description': "Generating images", 'active_replicate': replicate, 'complete': datetime.datetime.now()}} self.results_q.put(msg)
def create_occupancy_map_pack(self, m_name, instance_idx=None, ls=None): action = "OCCUPANCY_MAP_PACK" model_file = mdig.repository.get_models()[m_name] dm = DispersalModel(model_file) instance = dm.get_instances()[instance_idx] # Tell web interface we've started msg = { 'model': m_name, 'action': action, 'status': { 'started': datetime.datetime.now() } } self.results_q.put(msg) self.log.debug("Checking/creating envelopes") # Tell web interface what we're doing msg = { 'model': m_name, 'action': action, 'status': { 'active_instance': instance_idx, 'description': "Creating occupancy envelopes" } } self.results_q.put(msg) # Add listener so that we have progress updates instance.listeners.append(self.listener) # Now actually create the envelopes if necessary instance.update_occupancy_envelope(ls_list=[ls]) # also convert occupancy envelopes into images # via ExportAction from actions import ExportAction ea = ExportAction() ea.parse_options([]) ea.options.output_map_pack = True ea.options.output_lifestage = ls ea.options.overwrite_flag = True ea.listeners.append(self.listener) self.log.debug("Exporting maps") msg = { 'model': m_name, 'action': action, 'status': { 'active_instance': instance_idx, 'description': "Exporting maps" } } self.results_q.put(msg) try: ea.do_instance(instance) except: raise msg = { 'model': m_name, 'action': action, 'status': { 'complete': datetime.datetime.now() } } self.results_q.put(msg)
def create_replicate_gif(self, m_name, instance_idx, replicate, ls): action = "REPLICATE_GIF" model_file = mdig.repository.get_models()[m_name] dm = DispersalModel(model_file) instance = dm.get_instances()[instance_idx] # Tell web interface we've started msg = { 'model': m_name, 'action': action, 'status': { 'started': datetime.datetime.now(), 'active_instance': instance_idx, 'description': "Generating images", 'active_replicate': replicate } } self.results_q.put(msg) # Add listener so that we have progress updates instance.listeners.append(self.listener) # also convert replicate maps into images # via ExportAction from actions import ExportAction ea = ExportAction() ea.parse_options([]) ea.options.output_gif = True ea.options.output_image = True ea.options.output_lifestage = ls ea.options.overwrite_flag = True ea.options.reps = [replicate] try: ea.do_instance(instance) except: raise msg = { 'model': m_name, 'action': action, 'status': { 'active_instance': instance_idx, 'description': "Generating images", 'active_replicate': replicate, 'complete': datetime.datetime.now() } } self.results_q.put(msg)
def create_occupancy_map_pack(self, m_name, instance_idx=None, ls=None): action = "OCCUPANCY_MAP_PACK" model_file = mdig.repository.get_models()[m_name] dm = DispersalModel(model_file) instance = dm.get_instances()[instance_idx] # Tell web interface we've started msg = {'model': m_name, 'action': action, 'status': {'started': datetime.datetime.now()}} self.results_q.put(msg) self.log.debug("Checking/creating envelopes") # Tell web interface what we're doing msg = {'model': m_name, 'action': action, 'status': {'active_instance': instance_idx, 'description': "Creating occupancy envelopes"}} self.results_q.put(msg) # Add listener so that we have progress updates instance.listeners.append(self.listener) # Now actually create the envelopes if necessary instance.update_occupancy_envelope(ls_list=[ls]) # also convert occupancy envelopes into images # via ExportAction from actions import ExportAction ea = ExportAction() ea.parse_options([]) ea.options.output_map_pack = True ea.options.output_lifestage = ls ea.options.overwrite_flag = True ea.listeners.append(self.listener) self.log.debug("Exporting maps") msg = {'model': m_name, 'action': action, 'status': {'active_instance': instance_idx, 'description': "Exporting maps"}} self.results_q.put(msg) try: ea.do_instance(instance) except: raise msg = {'model': m_name, 'action': action, 'status': { 'complete': datetime.datetime.now()}} self.results_q.put(msg)