def test_generate_basic_project_land_cover(self):
        """
        Tests generating a basic GSSHA project with land cover
        """

        chdir(self.gssha_project_directory)
        project_name = "grid_standard_basic_land_cover"
        # Instantiate GSSHAPY object for reading to database
        project_manager = ProjectFile(name=project_name, map_type=1)
        self.db_session.add(project_manager)
        self.db_session.commit()

        # ADD MASK
        mask_name = '{0}.msk'.format(project_name)
        msk_file = WatershedMaskFile(project_file=project_manager,
                                     session=self.db_session)

        msk_file.generateFromWatershedShapefile(
            self.shapefile_path,
            cell_size=1000,
            out_raster_path=mask_name,
        )

        # ADD ELEVATION FILE
        ele_file = ElevationGridFile(project_file=project_manager,
                                     session=self.db_session)
        ele_file.generateFromRaster(self.elevation_path, self.shapefile_path)

        # ADD ROUGHNESS FROM LAND COVER
        # see http://www.gsshawiki.com/Project_File:Overland_Flow_%E2%80%93_Required
        mapTableFile = MapTableFile(project_file=project_manager)
        mapTableFile.addRoughnessMapFromLandUse(
            "roughness",
            self.db_session,
            self.land_use_grid,
            land_use_grid_id='glcf',
        )

        # ADD ADDITIONAL REQUIRED FILES
        # see http://www.gsshawiki.com/Project_File:Required_Inputs
        project_manager.setCard('TOT_TIME', '180')
        project_manager.setCard('TIMESTEP', '10')
        project_manager.setCard('HYD_FREQ', '15')
        # see http://www.gsshawiki.com/Project_File:Output_Files_%E2%80%93_Required
        project_manager.setCard('SUMMARY',
                                '{0}.sum'.format(project_name),
                                add_quotes=True)
        project_manager.setCard('OUTLET_HYDRO',
                                '{0}.otl'.format(project_name),
                                add_quotes=True)
        # see http://www.gsshawiki.com/Project_File:Rainfall_Input_and_Options_%E2%80%93_Required
        project_manager.setCard('PRECIP_UNIF', '')
        project_manager.setCard('RAIN_INTENSITY', '2.4')
        project_manager.setCard('RAIN_DURATION', '30')
        project_manager.setCard('START_DATE', '2017 02 28')
        project_manager.setCard('START_TIME', '14 33')

        # write data
        project_manager.writeInput(session=self.db_session,
                                   directory=self.gssha_project_directory,
                                   name=project_name)
        # compare main project files
        self._compare_basic_model_idx_maps(project_name)
    def test_generate_basic_project(self):
        """
        Tests generating a basic GSSHA project
        """

        chdir(self.gssha_project_directory)
        project_name = "grid_standard_basic"
        # Instantiate GSSHAPY object for reading to database
        project_manager = ProjectFile(name=project_name, map_type=1)
        self.db_session.add(project_manager)
        self.db_session.commit()

        # ADD MASK
        mask_name = '{0}.msk'.format(project_name)
        msk_file = WatershedMaskFile(project_file=project_manager,
                                     session=self.db_session)

        msk_file.generateFromWatershedShapefile(
            self.shapefile_path,
            cell_size=1000,
            out_raster_path=mask_name,
        )

        # ADD ELEVATION FILE
        ele_file = ElevationGridFile(project_file=project_manager,
                                     session=self.db_session)
        ele_file.generateFromRaster(self.elevation_path, self.shapefile_path)

        # ADD OUTLET POINT
        project_manager.setOutlet(col=0, row=6, outslope=0.002)

        # ADD ADDITIONAL REQUIRED FILES
        # see http://www.gsshawiki.com/Project_File:Required_Inputs
        project_manager.setCard('TOT_TIME', '180')
        project_manager.setCard('TIMESTEP', '10')
        project_manager.setCard('HYD_FREQ', '15')
        # see http://www.gsshawiki.com/Project_File:Output_Files_%E2%80%93_Required
        project_manager.setCard('SUMMARY',
                                '{0}.sum'.format(project_name),
                                add_quotes=True)
        project_manager.setCard('OUTLET_HYDRO',
                                '{0}.otl'.format(project_name),
                                add_quotes=True)
        # see http://www.gsshawiki.com/Project_File:Overland_Flow_%E2%80%93_Required
        project_manager.setCard('MANNING_N', '0.013')
        # see http://www.gsshawiki.com/Project_File:Rainfall_Input_and_Options_%E2%80%93_Required
        project_manager.setCard('PRECIP_UNIF', '')
        project_manager.setCard('RAIN_INTENSITY', '2.4')
        project_manager.setCard('RAIN_DURATION', '30')
        project_manager.setCard('START_DATE', '2017 02 28')
        project_manager.setCard('START_TIME', '14 33')

        # write data
        project_manager.writeInput(session=self.db_session,
                                   directory=self.gssha_project_directory,
                                   name=project_name)
        # compare
        self._compare_basic_model(project_name)