[gdal-dev] gdalwarp help/bug

savoie at nsidc.org savoie at nsidc.org
Tue Oct 7 16:22:56 PDT 2014


While I hate to do this, I'm going to answer my own question, or let you know that my question was answered by someone on gis.stackexchange.  This suggestion seems to have solved the problem.

Thanks
Matt


Try adding the -et (error threshold) option with lower thresholds than the default (0.125). When I use "-et 0.01", the horizontal artifacts disappear:

gdalwarp -t_srs "+proj=stere +lat_0=90 +lon_0=-45 +lat_ts=70 +ellps=WGS84 +datum=WGS84 +units=m" \
    -et 0.01 \
    ./UiMbqSd.withmetadata.tif ./regridded_lon0_-45.tif


savoie at nsidc.org writes:

> Hi all,
>
> I'm not sure if I'm doing something wrong or if I've found a bug in gdalwarp.  I thought I'd ask here before putting in a trac ticket. Please let me know if this is the wrong procedure.
>
> In any event, I have posted steps and links on gis.stackexchange that shows horizontal artifacts in the middle of images created during simple calls to gdal warp.
>
>
> Stack exchange link: http://gis.stackexchange.com/questions/116465/gdalwarp-leaves-horizontal-artifacts-regridding-from-ease-grid-laea-to-polarst
>
> Text of link follows:
>
>
> Hi there,
>
> I'm trying to understand how to use gdalwarp to warp an image.  I believe I'm doing the basics correctly, but I might be missing some gdalwarp options?  Any help would be greatly appreciate.
>
> The basic problem is that I see horizontal artifiacts in my output image.
>
> Here's the steps to reproduce.
>
> Start with a simple 722x722 image.  http://imgur.com/UiMBqSd  (you can save with http://imgur.com/UiMBqSd.png)
>
> apply metadata to make this a geotiff (this is a EASE-grid Lambert Azimuthal Equal Area projection on a 1924 authallic sphere.)
>
>
> gdal_translate -a_srs '+proj=laea +lat_0=90 +lon_0=0 +x_0=0 +y_0=0 +a=6371228 +b=6371228 +units=m +no_defs' \
>     -a_ullr -4524688.262500000 4524688.262500000 4524688.262500000 -4524688.262500000  \
>     -co COMPRESS=DEFLATE -co PREDICTOR=2 -co ZLEVEL=9 \
>     -of GTiff ./UiMbqSd.png ./UiMbqSd.withmetadata.tif
>
>
> This seems to have the expected geographic information (~12.5km grid) confirmed with gdalinfo
>
>
> gdalinfo UiMBqSd.withmetadata.tif
>
>
> Driver: GTiff/GeoTIFF
> Files: UiMbqSd.withmetadata.tif
> Size is 722, 722
> Coordinate System is:
> PROJCS["unnamed",
>     GEOGCS["unnamed ellipse",
>         DATUM["unknown",
>             SPHEROID["unnamed",6371228,0]],
>         PRIMEM["Greenwich",0],
>         UNIT["degree",0.0174532925199433]],
>     PROJECTION["Lambert_Azimuthal_Equal_Area"],
>     PARAMETER["latitude_of_center",90],
>     PARAMETER["longitude_of_center",0],
>     PARAMETER["false_easting",0],
>     PARAMETER["false_northing",0],
>     UNIT["metre",1,
>         AUTHORITY["EPSG","9001"]]]
> Origin = (-4524688.262500000186265,4524688.262500000186265)
> Pixel Size = (12533.762500000000728,-12533.762500000000728)
> Metadata:
>   AREA_OR_POINT=Area
> Image Structure Metadata:
>   COMPRESSION=DEFLATE
>   INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  (-4524688.263, 4524688.263) (135d 0' 0.00"W, 29d42'45.71"N)
> Lower Left  (-4524688.263,-4524688.263) ( 45d 0' 0.00"W, 29d42'45.71"N)
> Upper Right ( 4524688.263, 4524688.263) (135d 0' 0.00"E, 29d42'45.71"N)
> Lower Right ( 4524688.263,-4524688.263) ( 45d 0' 0.00"E, 29d42'45.71"N)
> Center      (   0.0000000,   0.0000000) (180d 0' 0.00"E, 90d 0' 0.00"N)
> Band 1 Block=722x2 Type=Byte, ColorInterp=Red
>   Mask Flags: PER_DATASET ALPHA
> Band 2 Block=722x2 Type=Byte, ColorInterp=Green
>   Mask Flags: PER_DATASET ALPHA
> Band 3 Block=722x2 Type=Byte, ColorInterp=Blue
>   Mask Flags: PER_DATASET ALPHA
> Band 4 Block=722x2 Type=Byte, ColorInterp=Alpha
>
>
> If I then try to regrid it.
>
> gdalwarp -t_srs "+proj=stere +lat_0=90 +lon_0=-45 +lat_ts=70 +ellps=WGS84 +datum=WGS84 +units=m" ./UiMbqSd.withmetadata.tif ./regridded_lon0_-45.tif
>
> The problem I'm seeing is horizontal artifacts that appear to protrude horizontally around the middle of the image.
> You can see a png representation on imagur: http://imgur.com/Nrx4ZoS
>
> This occurs even with different lat_0 values.
> gdalwarp -t_srs "+proj=stere +lat_0=90 +lon_0=0 +lat_ts=70 +ellps=WGS84 +datum=WGS84 +units=m" ./UiMbqSd.withmetadata.tif ./regridded_lon0_0.tif
>
> Another png representation on imagur:  http://imgur.com/uiiF9Ir
>
>
> I'm currently running this on a mac:
>
>> gdalwarp --version
> GDAL 1.11.1, released 2014/09/24
>
> But I've tested and seen the same behavior on ubuntu 12.04:
> GDAL 1.10.1, released 2013/08/26
>
> Any help solving this would be greatly appreciated.
>
> Thanks
> Matt

-- 
Matthew Savoie  -  Senior Software Developer
National Snow and Ice Data Center
(303) 735-0785   http://nsidc.org


More information about the gdal-dev mailing list