diff --git a/city_metrix/layers/layer.py b/city_metrix/layers/layer.py index ff6cda9..3a1bf2c 100644 --- a/city_metrix/layers/layer.py +++ b/city_metrix/layers/layer.py @@ -55,14 +55,14 @@ def groupby(self, zones, layer=None): """ return LayerGroupBy(self.aggregate, zones, layer, self.masks) - def write(self, bbox, output_path, tile_side_meters=None, buffer_meters=None, **kwargs): + def write(self, bbox, output_path, tile_side_meters=None, tile_buffer_meters=None, **kwargs): """ Write the layer to a path. Does not apply masks. :param bbox: (min x, min y, max x, max y) :param output_path: local or s3 path to output to :param tile_side_meters: optional param to tile the results into multiple files specified as tile length on a side in meters - : param buffer_meters: tile buffer distance in meters + : param tile_buffer_meters: tile buffer distance in meters :return: """ @@ -70,7 +70,7 @@ def write(self, bbox, output_path, tile_side_meters=None, buffer_meters=None, ** clipped_data = self.aggregate.get_data(bbox) write_layer(output_path, clipped_data) else: - tile_grid, unbuffered_tile_grid = _get_tile_boundaries(bbox, tile_side_meters, buffer_meters) + tile_grid, unbuffered_tile_grid = _get_tile_boundaries(bbox, tile_side_meters, tile_buffer_meters) # write raster data to files if not os.path.exists(output_path): diff --git a/tests/resources/layer_dumps_for_br_lauro_de_freitas/test_write_layers_to_qgis_files.py b/tests/resources/layer_dumps_for_br_lauro_de_freitas/test_write_layers_to_qgis_files.py index a9c269a..1467cd0 100644 --- a/tests/resources/layer_dumps_for_br_lauro_de_freitas/test_write_layers_to_qgis_files.py +++ b/tests/resources/layer_dumps_for_br_lauro_de_freitas/test_write_layers_to_qgis_files.py @@ -39,10 +39,11 @@ def test_write_albedo_tiled_unbuffered(target_folder, bbox_info, target_spatial_ file_path = prep_output_path(target_folder, 'albedo_tiled.tif') target_resolution = target_spatial_resolution_multiplier * get_class_default_spatial_resolution(Albedo()) (Albedo(spatial_resolution=target_resolution). - write(bbox_info.bounds, file_path, tile_side_meters=1000, buffer_meters=None)) + write(bbox_info.bounds, file_path, tile_side_meters=1000, tile_buffer_meters=None)) file_count = get_file_count_in_folder(file_path) - assert file_count == 7 + expected_file_count = 7 # includes 6 tiles and one geojson file + assert file_count == expected_file_count @pytest.mark.skipif(RUN_DUMPS == False, reason='Skipping since RUN_DUMPS set to False') def test_write_albedo_tiled_buffered(target_folder, bbox_info, target_spatial_resolution_multiplier): @@ -50,10 +51,11 @@ def test_write_albedo_tiled_buffered(target_folder, bbox_info, target_spatial_re file_path = prep_output_path(target_folder, 'albedo_tiled_buffered.tif') target_resolution = target_spatial_resolution_multiplier * get_class_default_spatial_resolution(Albedo()) (Albedo(spatial_resolution=target_resolution). - write(bbox_info.bounds, file_path, tile_side_meters=1000, buffer_meters=buffer_meters)) + write(bbox_info.bounds, file_path, tile_side_meters=1000, tile_buffer_meters=buffer_meters)) file_count = get_file_count_in_folder(file_path) - assert file_count == 8 + expected_file_count = 8 # includes 6 tiles and two geojson files + assert file_count == expected_file_count @pytest.mark.skipif(RUN_DUMPS == False, reason='Skipping since RUN_DUMPS set to False')