Esempio n. 1
0
    def clean(self,
              scenario_id=None,
              calibration_id=None,
              delete_scenario=False,
              delete_spatial_gfs=False):
        """Clean model outputs in OUTPUT<ScenarioID>-<CalibrationID> directory and/or
        GridFS files in OUTPUT collection.

        Examples:
            model.SetMongoClient()
            model.clean()
            model.UnsetMongoClient()
        """
        rmtree(self.OutputDirectory, ignore_errors=True)
        self.ConnectMongoDB()
        read_model = ReadModelData(self.mongoclient, self.db_name)
        if scenario_id is None:
            scenario_id = self.scenario_id
        if calibration_id is None:
            calibration_id = self.calibration_id
        read_model.CleanOutputGridFs(scenario_id, calibration_id)
        if delete_scenario:
            read_model.CleanScenariosConfiguration(scenario_id)
            if delete_spatial_gfs:
                read_model.CleanSpatialGridFs(scenario_id)
Esempio n. 2
0
 def clean(self,
           scenario_id=None,
           calibration_id=None,
           delete_scenario=False):
     """Clean model outputs in OUTPUT<ScenarioID>-<CalibrationID> directory and/or
     GridFS files in OUTPUT collection.
     """
     rmtree(self.OutputDirectory, ignore_errors=True)
     read_model = ReadModelData(self.host, self.port, self.db_name)
     if scenario_id is None:
         scenario_id = self.scenario_id
     if calibration_id is None:
         calibration_id = self.calibration_id
     read_model.CleanOutputGridFs(scenario_id, calibration_id)
     if delete_scenario:
         read_model.CleanScenariosConfiguration(scenario_id)