You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to_geotiff(da, "out.vrt") (which dispatches to _write_vrt_tiled) silently drops several metadata attrs that to_geotiff(da, "out.tif") propagates from a rioxarray-style DataArray:
A rioxarray-sourced raster therefore round-trips correctly through .tif but loses its nodata sentinel (along with the rich tags) through .vrt. The two destinations should produce metadata-equivalent outputs.
Use _resolve_nodata_attr(data.attrs) to honor nodatavals / _FillValue like the TIF and GPU writers do.
Pull raster_type, gdal_metadata (XML or dict), extra_tags (folded with friendly tag attrs via _merge_friendly_extra_tags), x_resolution, y_resolution, resolution_unit from data.attrs and thread them to each per-tile write_single_tile call so every tile carries the same rich metadata as the equivalent TIF write would.
Severity: MEDIUM (backend-inconsistent metadata between .tif and .vrt outputs for the same input).
Summary
to_geotiff(da, "out.vrt")(which dispatches to_write_vrt_tiled) silently drops several metadata attrs thatto_geotiff(da, "out.tif")propagates from a rioxarray-style DataArray:attrs['nodatavals']/attrs['_FillValue']-- the VRT path usesdata.attrs.get('nodata')directly instead of_resolve_nodata_attr(data.attrs)(the alias resolver added in to_geotiff drops rioxarray nodatavals and CF _FillValue silently #1582 for the TIF / GPU writers).attrs['gdal_metadata']/attrs['gdal_metadata_xml']attrs['extra_tags']attrs['image_description']/attrs['extra_samples']/attrs['colormap'](folded in via_merge_friendly_extra_tagson the TIF path)attrs['x_resolution']/attrs['y_resolution']/attrs['resolution_unit']attrs['raster_type']A rioxarray-sourced raster therefore round-trips correctly through
.tifbut loses its nodata sentinel (along with the rich tags) through.vrt. The two destinations should produce metadata-equivalent outputs.Repro
Output:
Fix
In
_write_vrt_tiled:_resolve_nodata_attr(data.attrs)to honornodatavals/_FillValuelike the TIF and GPU writers do.raster_type,gdal_metadata(XML or dict),extra_tags(folded with friendly tag attrs via_merge_friendly_extra_tags),x_resolution,y_resolution,resolution_unitfromdata.attrsand thread them to each per-tilewrite_single_tilecall so every tile carries the same rich metadata as the equivalent TIF write would.Severity: MEDIUM (backend-inconsistent metadata between
.tifand.vrtoutputs for the same input).Found by /sweep-metadata.