def test_geotiff_gdal_dataset_querying(self): my_map = GeoTiffBCCVLMap( data_url= "https://raw.github.com/BCCVL/BCCVL_Visualiser/master/bccvl_visualiser/tests/fixtures/raster.tif", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512") self.assertEqual(my_map.get_scale(), 1) self.assertEqual(my_map.get_maximum_value(), 0.62908011869436)
def test_geotiff_gdal_dataset_querying(self): my_map = GeoTiffBCCVLMap( data_url="https://raw.github.com/BCCVL/BCCVL_Visualiser/master/BCCVL_Visualiser/bccvl_visualiser/tests/fixtures/raster.tif", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512", ) self.assertEqual(my_map.get_scale(), 1) self.assertEqual(my_map.get_maximum_value(), 0.62908011869436)
def test_geotiff_gdal_dataset_metadata_access(self): my_map = GeoTiffBCCVLMap(data_url="https://raw.github.com/BCCVL/BCCVL_Visualiser/master/BCCVL_Visualiser/bccvl_visualiser/tests/fixtures/raster.tif", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512") self.assertEqual(my_map.get_metadata(), {}) expected_band_metadata = { 'STATISTICS_MAXIMUM': '0.62908011869436', 'STATISTICS_MEAN': '0.00037273920856963', 'STATISTICS_MINIMUM': '0', 'STATISTICS_STDDEV': '0.0089147334375146' } self.assertEqual(my_map.get_band_metadata(), expected_band_metadata)
def test_raster_get_expected_value_range(self): my_map = GeoTiffBCCVLMap( data_url="https://raw.github.com/BCCVL/BCCVL_Visualiser/master/BCCVL_Visualiser/bccvl_visualiser/tests/fixtures/biomod_2_pkg_0_to_1000.asc", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512", ) self.assertEqual(my_map.get_expected_value_range(), (0, 985)) my_map_2 = GeoTiffBCCVLMap( data_url="https://raw.github.com/BCCVL/BCCVL_Visualiser/master/BCCVL_Visualiser/bccvl_visualiser/tests/fixtures/raster.tif", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512", ) self.assertEqual(my_map_2.get_expected_value_range(), (0, 1))
def test_raster_has_expected_class_style_legend_information(self): my_map = GeoTiffBCCVLMap(data_url="https://raw.github.com/BCCVL/BCCVL_Visualiser/master/BCCVL_Visualiser/bccvl_visualiser/tests/fixtures/biomod_2_pkg_0_to_1000.asc", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512") layer_name = my_map.layer_name layer = my_map.getLayerByName(layer_name) # We should have 1 class per color band, plus 1 final color band for the "max_value" self.assertEqual(layer.numclasses, GeoTiffBCCVLMap.COLOR_BANDS + 1) last_class = layer.getClass(GeoTiffBCCVLMap.COLOR_BANDS) self.assertEqual(last_class.name, "985.0") second_last_class = layer.getClass(GeoTiffBCCVLMap.COLOR_BANDS - 1) step = 985.0 / GeoTiffBCCVLMap.COLOR_BANDS second_last_value = 985.0 - step self.assertEqual(second_last_class.name, str(second_last_value))
def test_geotiff_gdal_dataset_metadata_access(self): my_map = GeoTiffBCCVLMap( data_url= "https://raw.github.com/BCCVL/BCCVL_Visualiser/master/bccvl_visualiser/tests/fixtures/raster.tif", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512") self.assertEqual(my_map.get_metadata(), {}) expected_band_metadata = { 'STATISTICS_MAXIMUM': '0.62908011869436', 'STATISTICS_MEAN': '0.00037273920856963', 'STATISTICS_MINIMUM': '0', 'STATISTICS_STDDEV': '0.0089147334375146' } self.assertEqual(my_map.get_band_metadata(), expected_band_metadata)
def test_raster_has_expected_class_style_legend_information(self): my_map = GeoTiffBCCVLMap( data_url= "https://raw.github.com/BCCVL/BCCVL_Visualiser/master/bccvl_visualiser/tests/fixtures/biomod_2_pkg_0_to_1000.asc", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512") layer_name = my_map.layer_name layer = my_map.getLayerByName(layer_name) # We should have 1 class per color band, plus 1 final color band for the "max_value" self.assertEqual(layer.numclasses, GeoTiffBCCVLMap.COLOR_BANDS + 1) last_class = layer.getClass(GeoTiffBCCVLMap.COLOR_BANDS) self.assertEqual(last_class.name, "985.0") second_last_class = layer.getClass(GeoTiffBCCVLMap.COLOR_BANDS - 1) step = 985.0 / GeoTiffBCCVLMap.COLOR_BANDS second_last_value = 985.0 - step self.assertEqual(second_last_class.name, str(second_last_value))
def test_raster_get_expected_value_range(self): my_map = GeoTiffBCCVLMap( data_url= "https://raw.github.com/BCCVL/BCCVL_Visualiser/master/bccvl_visualiser/tests/fixtures/biomod_2_pkg_0_to_1000.asc", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512") self.assertEqual(my_map.get_expected_value_range(), (0, 985)) my_map_2 = GeoTiffBCCVLMap( data_url= "https://raw.github.com/BCCVL/BCCVL_Visualiser/master/bccvl_visualiser/tests/fixtures/raster.tif", query_string="HEIGHT=1024&LAYERS=DEFAULT&WIDTH=512") self.assertEqual(my_map_2.get_expected_value_range(), (0, 1))