Open julietcohen opened 11 months ago
When we save any tile, regardless if it will be a new tile or appended to an existing tile, we extract the tile_path
here using path_from_tile(tile, base_dir='staged')
.
Then, if the tile is a new tile, we use that tile_path
as an input to save_new_tile()
which uses it like so: data.to_file(tile_path, mode=mode)
, and mode is set to 'w'
. The input argument tile_path
looks like: staged/WebMercatorQuad/15/nan/nan.gpkg
so the issue must occur before we execute save_new_tile()
.
Because of those nan
values, when we move on to define tiles_str
with tiles_str = data[self.props['tile']].copy()
, tile_str
looks like Tile(x=nan, y=nan, z=15)
.
Notes:
urn:ogc:def:crs:EPSG::3857
(as noted in the first comment) and Grid.py
includes a check that the CRS if the TMS is the same as the geodataframe's CRS: __check_crs_match(self, gdf)
, so the issue is more likely in the extraction of the x and y from the TMSGrid.py
, we execute indices_from_xy(self, x, y)
which returns "The row indices and column indices, respectively, that each of the given point coordinates falls within."When I run the workflow with the default TMS, WGS1984
, logging for this step looks like:
INFO:logger:before removing points outside grid:
row_ind is [ 1 1 1 ... 15 15 15]
col_ind is [23 23 23 ... 56 56 56]
INFO:logger:after removing points outside grid:
row_ind is [4241, 4241, 4241, 4241, 4223, 4223, 4223,...
col_ind is [3241, 3241, 3241, 3241, 3218, 3219, 3218,...
When I run the workflow with the desired TMS, WorldMercatorQuad
, logging for this step looks like:
INFO:logger:before removing points outside grid:
row_ind is [1 1 1 ... 1 1 1]
col_ind is [-1 -1 -1 ... -1 -1 -1]
INFO:logger:after removing points outside grid:
row_ind is [None, None, None, None, None, None, None,...
col_ind is [None, None, None, None, None, None, None,...
Seems the None values result from this operation. I am not sure if the repeated 1 and -1 values are valid. In contrast, the default TMS shows a large diversity in values for these lists.
When setting the config to tile for the TMS
WebMercatorQuad
, which differs from the default TMSWGS1984Quad
, the x and y identifiers for each tile cannot be identified (only the z component can be identified) when we save the tiles.Before we save the tiles, when we extract the EPSG code pulled from the default TMS
WGS1984Quad
here, it looks like:urn:ogc:def:crs:EPSG::4326
. When we extract the EPSG code from TMSWebMercatorQuad
, it is in the same format:urn:ogc:def:crs:EPSG::3857
. This means identifying the CRS of the TMS is not likely the issue.When we save tiles, we use the method
tile_from_str()
which pulls the tile x, y, and z identifiers.The following output identifies 2 options for the source of the error:
urn:ogc:def:crs:EPSG::3857
which is what we want(-18034999.95487016, 10070194.973863265)
looks like the units are meters, while the TMS bounds[-180.0, -85.0511287798066, 180.0, 85.0511287798066]
are in degreesconfig
``` { "deduplicate_clip_to_footprint": True, "dir_input": "/home/pdg/data/ice-wedge-polygon-data/version_2023-01-31/iwp_detections/iwp_files/high/alaska/", "ext_input": ".shp", "ext_footprints": ".shp", "dir_footprints": "/home/pdg/data/ice-wedge-polygon-data/version_2023-01-31/footprints/footprint_files_with_date_20230119/high/alaska/", "dir_staged": "staged/", "dir_geotiff": "geotiff/", "dir_web_tiles": "web_tiles/", "filename_staging_summary": "staging_summary.csv", "filename_rasterization_events": "raster_events.csv", "filename_rasters_summary": "raster_summary.csv", "filename_config": "config", "simplify_tolerance": 0.1, "tms_id": "WebMercatorQuad", "input_crs": None, "z_range": [ 0, 15 ], "geometricError": 57, "z_coord": 0, "statistics": [ { "name": "iwp_coverage", "weight_by": "area", "property": "area_per_pixel_area", "aggregation_method": "sum", "resampling_method": "average", "val_range": [ 0, 1 ], "palette": [ "#f8ff1f1A", # 10% alpha yellow "#f8ff1f" # solid yellow ], "nodata_val": 0, "nodata_color": "#ffffff00" }, ], "deduplicate_at": [ "raster" ], "deduplicate_keep_rules": [ [ "Date", "larger" ] ], "deduplicate_method": "footprints" } ```Other TMS's that we should be able to process can be found here.