[gdal-dev] gdalwarp Resampling Input Raster Nodata Setting

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Sun Jun 26 22:52:01 PDT 2022


Hi,

The right syntax is average -srcnodata 32767 but you should not need to use it at all because GDAL recognizes nodata from your input automatically as you can see from the gdalinfo report. Could you clip and share a small sample from your source data so that some nodata is included? You can use gdal_translate with -srswin or -projwin for that.

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta Chao Li
Lähetetty: maanantai 27. kesäkuuta 2022 4.09
Vastaanottaja: gdal-dev at lists.osgeo.org
Aihe: [gdal-dev] gdalwarp Resampling Input Raster Nodata Setting

Dear GDAL experts,

I have a problem using gdalwarp.

I want to reproject a raster and change its resolution by the average method.

This is the gdalinfo of the raster

[q70176a at ito-2 ~]$ gdalinfo  DP12/11_RawData/02_GGP/Gross_PP_8Days_500m_v6/GPP/MOD17A2H_GPP_2016_001.tif                                                       Driver: GTiff/GeoTIFF
Files: DP12/11_RawData/02_GGP/Gross_PP_8Days_500m_v6/GPP/MOD17A2H_GPP_2016_001.tif
Size is 86400, 31200
Coordinate System is:
PROJCRS["unknown",
    BASEGEOGCRS["unknown",
        DATUM["unknown",
            ELLIPSOID["unknown",6371007.181,0,
                LENGTHUNIT["metre",1,
                    ID["EPSG",9001]]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]]],
    CONVERSION["Sinusoidal",
        METHOD["Sinusoidal"],
        PARAMETER["Longitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["False easting",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["easting",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["northing",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]
Data axis to CRS axis mapping: 1,2
Origin = (-20015109.353999998420477,7783653.637667000293732)
Pixel Size = (463.312716527771215,-463.312716527787586)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-20015109.354, 7783653.638) (166d17' 5.25"W, 70d 0' 0.00"N)
Lower Left  (-20015109.354,-6671703.118) (  0d 0' 0.00"E, 60d 0' 0.00"S)
Upper Right (20015109.354, 7783653.638) (166d17' 5.25"E, 70d 0' 0.00"N)
Lower Right (20015109.354,-6671703.118) (  0d 0' 0.00"W, 60d 0' 0.00"S)
Center      (      -0.000,  555975.260) (  0d 0' 0.00"W,  5d 0' 0.00"N)
Band 1 Block=86400x1 Type=Int16, ColorInterp=Gray
  NoData Value=32767

This is the gdalwarp commend:

[q70176a at ito-2 ~]$ gdalwarp -t_srs EPSG:4326 -te -180 -90 180  90 -tr 0.1 0.1 -ot Float64 -r average -srcnodata "32767" -multi -overwrite DP12/11_RawData/02_GGP/Gross_PP_8Days_500m_v6/GPP/MOD17A2H_GPP_2016_001.tif DP12/11_RawData/02_GGP/Gross_PP_8Days_500m_v6/GPP_01_test/test2.tif

I also tried

[q70176a at ito-2 ~]$ gdalwarp -t_srs EPSG:4326 -te -180 -90 180  90 -tr 0.1 0.1 -ot Float64 -r average -srcnodata 32767 -multi -overwrite DP12/11_RawData/02_GGP/Gross_PP_8Days_500m_v6/GPP/MOD17A2H_GPP_2016_001.tif DP12/11_RawData/02_GGP/Gross_PP_8Days_500m_v6/GPP_01_test/test2.tif

However, the 32767 is not set to be nodata, and be averaged in the output raster.

How can I set this?

Additionally, I am using a HPC with multinodes. With 8 nodes, I have 288. If I set -multi and -wo NUM_THREADS=val/ALL_CPUS, will all that 288 run together?

Since there nothing returns, I really do not know.

Best regards.

--
------------------------------------------------------------------------------------
Mike Li
Department of Urban and Environmental Engineering
Graduate School of Engineering
Kyushu University
744 Motooka, Nishi-ku, Fukuoka 819-0395 Japan
Tel: 090-8304-8953
E-mail: chaoli0394 at gmail.com<mailto:chaoli0394 at gmail.com>
-------------------------------------------------------------------------------------
李潮(リ チョウ)
九州大学 大学院 工学府 都市環境システム工学専攻
都市工学研究室
-------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220627/b6d107f6/attachment-0001.htm>


More information about the gdal-dev mailing list