-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
GDAL 3.5.0 warping issue with geolocation arrays #5823
Description
Expected behavior and actual behavior.
When reprojecting a NetCDF file with geolocation arrays, GDAL 3.5.0 puts 'nan' pixels all over the output. GDAL 3.4.3 successfully reprojects the same file. Also, the extents of the projected outputs differ between the two GDAL versions.
For the files attached to this issue report, see https://drive.google.com/file/d/1k72Xmqw1rUe0ToQec6etfNC1qyhksFAR/view?usp=sharing .
Steps to reproduce the problem.
I started out with the file L2_of_S3A_OL_1_EFR____20210601T081845_20210601T082145_20210602T131125.nc (see attachment) which is a NetCDF file with geolocation bands lat and lon. I extracted the latitude and longitude grids and a subdataset of interest (algal_2) with
gdal_translate -of VRT NetCDF:L2_of_S3A_OL_1_EFR____20210601T081845_20210601T082145_20210602T131125.nc:lat lat.vrt
gdal_translate -of VRT NetCDF:L2_of_S3A_OL_1_EFR____20210601T081845_20210601T082145_20210602T131125.nc:lon lon.vrt
gdal_translate -of VRT NetCDF:L2_of_S3A_OL_1_EFR____20210601T081845_20210601T082145_20210602T131125.nc:algal_2 algal.vrt
I then modified algal.vrt by adding the lines 62–71 so that it references the latitude and longitude arrays given in the other files:
<metadata domain="GEOLOCATION">
<mdi key="X_DATASET">lon.vrt</mdi>
<mdi key="X_BAND">1</mdi>
<mdi key="Y_DATASET">lat.vrt</mdi>
<mdi key="Y_BAND">1</mdi>
<mdi key="PIXEL_OFFSET">0</mdi>
<mdi key="LINE_OFFSET">0</mdi>
<mdi key="PIXEL_STEP">1</mdi>
<mdi key="LINE_STEP">1</mdi>
</metadata>
I then tried to convert the layer to a GeoTIFF file using
gdalwarp -geoloc -t_srs EPSG:4326 algal.vrt gdal_output.tif
(and also tried with -s_srs EPSG:4326).
However, with GDAL 3.5.0, the output is full of no-data holes whereas (see file gdal_3.5.0_output.tif) whereas GDAL 3.4.3 doesn't have such artefacts (see file gdal_3.4.3_output.tif).
Operating system
Microsoft Windows 10 Enterprise
GDAL version and provenance
Versions 3.4.3 and 3.5.0 from conda-forge. The GDAL distributed with Docker-Hub's alpine-normal-3.5.0 has the same issue.
