def __del__(self): """Close the database interface and stop the messenger and C-interface subprocesses. """ if self.dbif.connected is True: self.dbif.close() tgis.stop_subprocesses()
def tearDown(self): """Remove raster maps from current mapset""" # switch to old mapset self.runModule( "g.mapset", mapset=self.currmapset, quiet=True, ) tgis.stop_subprocesses() tgis.init() self.strds_abs.delete() self.runModule( "g.remove", flags="f", type="raster", name="register_map_1,register_map_2", quiet=True, ) grassenv = gscript.gisenv() mapset_path = os.path.join( grassenv["GISDBASE"], grassenv["LOCATION_NAME"], self.newmapset ) gscript.try_rmdir(mapset_path)
def __del__(self): """Close the database interface and stop the messenger and C-interface subprocesses. """ if self.dbif.connected is True: self.dbif.close() tgis.stop_subprocesses()
def OnClose(self, event): """Close the database interface and stop the messenger and C-interface subprocesses. """ if self.dbif.connected is True: self.dbif.close() tgis.stop_subprocesses() self.Destroy()
def setUp(self): """Create the space time raster dataset""" self.strds_abs = tgis.open_new_stds( name="register_test_abs", type="strds", temporaltype="absolute", title="Test strds", descr="Test strds", semantic="field", overwrite=True, ) tgis.register_maps_in_space_time_dataset( type="raster", name=self.strds_abs.get_name(), maps="register_map_1,register_map_2", start="2001-01-01", increment="1 day", interval=True, ) self.currmapset = tgis.get_current_mapset() self.newmapset = "test_temporal_register_mapset_access" # create and switch to new mapset self.runModule( "g.mapset", mapset=self.newmapset, flags="c", quiet=True, ) # add old mapset to search path self.runModule( "g.mapsets", mapset=self.currmapset, operation="add", quiet=True, ) self.runModule( "g.mapsets", flags="p", verbose=True, ) tgis.stop_subprocesses() tgis.init() self.assertNotEqual(self.currmapset, tgis.get_current_mapset())