Beispiel #1
0
    def testSaPaRun(self):
        with TempDir() as d:
            ratio_raster = os.path.join(d, 'test_sapa_ratio.tif')
            surf_raster = os.path.join(d, 'test_surface_area.tif')

            arcpy.env.scratchWorkspace = d
            surface_area_to_planar_area.main(config.bathy_raster,
                    ratio_raster, surf_raster)
            self.assertTrue(os.path.exists(ratio_raster))
            self.assertTrue(os.path.exists(surf_raster))

            self.assertAlmostEqual(su.raster_properties(ratio_raster, "MEAN"), \
               1.0042422342676)
            self.assertAlmostEqual(su.raster_properties(ratio_raster, "STD"), \
               0.0058175502835692)

            self.assertAlmostEqual(su.raster_properties(surf_raster, "MEAN"), \
                25.119343739217)
            self.assertAlmostEqual(su.raster_properties(surf_raster, "STD"), \
                0.14551573347447)
Beispiel #2
0
    def testSaPaRunCorrection(self):
        with TempDir() as d:
            ratio_raster = os.path.join(d, 'test_sapa_ratio.tif')
            surf_raster = os.path.join(d, 'test_surface_area.tif')

            arcpy.env.scratchWorkspace = d
            surface_area_to_planar_area.main(
                config.bathy_raster, ratio_raster, True, surf_raster)

            self.assertTrue(os.path.exists(ratio_raster))
            self.assertTrue(os.path.exists(surf_raster))

            self.assertAlmostEqual(
                su.raster_properties(ratio_raster, "MEAN"), 1.000616701751028)
            self.assertAlmostEqual(
                su.raster_properties(ratio_raster, "STD"), 0.0008445980914179108)

            self.assertAlmostEqual(
                su.raster_properties(surf_raster, "MEAN"), 25.119343091857)
            self.assertAlmostEqual(
                su.raster_properties(surf_raster, "STD"), 0.14551570953239)
Beispiel #3
0
    def testSaPaRunCorrection(self):
        with TempDir() as d:
            ratio_raster = os.path.join(d, 'test_sapa_ratio.tif')
            surf_raster = os.path.join(d, 'test_surface_area.tif')

            arcpy.env.scratchWorkspace = d
            surface_area_to_planar_area.main(config.bathy_raster, ratio_raster,
                                             True, surf_raster)

            self.assertTrue(os.path.exists(ratio_raster))
            self.assertTrue(os.path.exists(surf_raster))

            self.assertAlmostEqual(su.raster_properties(ratio_raster, "MEAN"),
                                   1.000616701751028)
            self.assertAlmostEqual(su.raster_properties(ratio_raster, "STD"),
                                   0.0008445980914179108)

            self.assertAlmostEqual(su.raster_properties(surf_raster, "MEAN"),
                                   25.119343091857)
            self.assertAlmostEqual(su.raster_properties(surf_raster, "STD"),
                                   0.14551570953239)
Beispiel #4
0
    def testSaPaRunNoCorrection(self):
        with TempDir() as d:
            ratio_raster = os.path.join(d, 'test_sapa_ratio.tif')
            surf_raster = os.path.join(d, 'test_surface_area.tif')

            arcpy.env.scratchWorkspace = d
            surface_area_to_planar_area.main(config.bathy_raster, ratio_raster,
                                             False, surf_raster)

            self.assertTrue(os.path.exists(ratio_raster))
            self.assertTrue(os.path.exists(surf_raster))

            self.assertAlmostEqual(su.raster_properties(ratio_raster, "MEAN"),
                                   1.0042422342676)
            self.assertAlmostEqual(su.raster_properties(ratio_raster, "STD"),
                                   0.0058175502835692)

            self.assertAlmostEqual(su.raster_properties(surf_raster, "MEAN"),
                                   25.119343091857)
            self.assertAlmostEqual(su.raster_properties(surf_raster, "STD"),
                                   0.14551573347447)
Beispiel #5
0
    def testSaPaRunWithFgdbLocation(self):
        with TempDir() as d:
            fgdb_name = "sapa.gdb"
            fgdb_workspace = os.path.join(d, fgdb_name)
            # create a temporary File Geodatabase location
            arcpy.CreateFileGDB_management(d, fgdb_name)
            self.assertTrue(os.path.exists(fgdb_workspace))

            ratio_raster = os.path.join(fgdb_workspace, 'test_sapa_ratio')
            surf_raster = os.path.join(fgdb_workspace, 'test_sapa_area')

            arcpy.env.scratchWorkspace = d
            surface_area_to_planar_area.main(
                config.bathy_raster, ratio_raster, False, surf_raster)

            self.assertAlmostEqual(
                su.raster_properties(ratio_raster, "MEAN"), 1.0042422342676)
            self.assertAlmostEqual(
                su.raster_properties(ratio_raster, "STD"), 0.0058175502835692)

            self.assertAlmostEqual(
                su.raster_properties(surf_raster, "MEAN"), 25.119343091857)
            self.assertAlmostEqual(
                su.raster_properties(surf_raster, "STD"), 0.14551573347447)
Beispiel #6
0
    def testSaPaRunWithFgdbLocation(self):
        with TempDir() as d:
            fgdb_name = "sapa.gdb"
            fgdb_workspace = os.path.join(d, fgdb_name)
            # create a temporary File Geodatabase location
            arcpy.CreateFileGDB_management(d, fgdb_name)
            self.assertTrue(os.path.exists(fgdb_workspace))

            ratio_raster = os.path.join(fgdb_workspace, 'test_sapa_ratio')
            surf_raster = os.path.join(fgdb_workspace, 'test_sapa_area')

            arcpy.env.scratchWorkspace = d
            surface_area_to_planar_area.main(config.bathy_raster, ratio_raster,
                                             False, surf_raster)

            self.assertAlmostEqual(su.raster_properties(ratio_raster, "MEAN"),
                                   1.0042422342676)
            self.assertAlmostEqual(su.raster_properties(ratio_raster, "STD"),
                                   0.0058175502835692)

            self.assertAlmostEqual(su.raster_properties(surf_raster, "MEAN"),
                                   25.119343091857)
            self.assertAlmostEqual(su.raster_properties(surf_raster, "STD"),
                                   0.14551573347447)