[gdal-dev] Issues in Raster Resampling

Even Rouault even.rouault at spatialys.com
Sat Apr 23 02:13:23 PDT 2022


Mike,

if you look at the nodata value set on 2015_daytime_mean_clip.tif, it is 
at 3.39999995214436425e+38, and not at nan.

If you add the srcNodata=math.nan argument to gdal.Warp(), this will fix 
your issue.

Even

Le 23/04/2022 à 06:40, Chao Li a écrit :
> Dear Gdal Developer,
>
> Thank you for reading my email.
>
> I used gdal.Wrap() to resample from a high resolution to a lower. 
> However, my raster has no value (nan). So, when I set resampleAlg, the 
> larger grids with nan(s) will become nan.
>
> Here is my reprex in Python:
>
> from osgeo import gdal
>
> ### resample and reproject
> ### data are from MOD11A2 and MYD11A2, and have been converted into 
> annual mean values
> raster_rprj = gdal.Warp("./2015_daytime_mean_re.tif",
>                         "./2015_daytime_mean_clip.tif", dstSRS = 
> "EPSG:4326",
>                         xRes = 0.008, yRes = 0.008, resampleAlg = 
> "average")
>
> raster_rprj = None
>
> I hope it runs as the function np.nanmean()
>
> Thank you for your time.
>
> Best regards,
>
> Mike Li
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list