[gdal-dev] Problem with results on two different versions of gdal_wrap

Stephen Woodbridge woodbri at swoodbridge.com
Fri Mar 7 14:23:55 PST 2014


Hi All,

First off, sorry this is really long with all the gdalinfo pasted into 
it, but I thought is might be more useful to have real information to 
look at.

I have been running down a problem caused by upgrading a server to a 
newer version of gdal. Here are the details:

old server: GDAL 1.6.0dev, FWTools 2.0.6, released 2008/02/03
new server: GDAL 1.9.2, released 2012/10/08

My process is:

wget 
'http://cyclops.marine.usf.edu/modis/level3/husf/fullpass/2014/061/1km/pass/final/MODIS.2014061.194420.fullpass.rgb.hdf'

old server:
gdal_translate -of GTiff -ot Int16 -a_srs EPSG:32662 -a_ullr 
-13914936.3491592 6094982.02936303 -5009377.08569731 -560262.454244465 
HDF4_SDS:UNKNOWN:MODIS.2014061.194420.fullpass.rgb.hdf:0 temp.tif

new server:
gdal_translate -of GTiff -ot Int16 -a_srs EPSG:32662 -a_ullr 
-13914936.3491592 6115512.02936303 -5009377.08569731 -539731.454244465 
HDF4_SDS:UNKNOWN:MODIS.2014061.194420.fullpass.rgb.hdf:0 temp.tif

I have verified that gdalinfo -mm -stats temp.tif looks equivalent for 
the two generated temp.tif images. The -a_ullr are different because 
proj4 is shifting the image 20530m south so I'm correcting here for that.

summary old:
Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
   Min=377.000 Max=32767.000   Computed Min/Max=377.000,32767.000
   Minimum=377.000, Maximum=32767.000, Mean=27526.311, StdDev=11176.835

summary new:
Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
   Min=377.000 Max=32767.000   Computed Min/Max=377.000,32767.000
   Minimum=377.000, Maximum=32767.000, Mean=27526.311, StdDev=11176.835

---------------------- full output --------------------------------
old server:
# /opt/FWTools/bin_safe/gdalinfo -mm -stats temp.tif
Driver: GTiff/GeoTIFF
Files: temp.tif
Size is 8800, 6600
Coordinate System is:
PROJCS["WGS 84 / Plate Carree",
     GEOGCS["WGS 84",
         DATUM["WGS_1984",
             SPHEROID["WGS 84",6378137,298.2572235629972,
                 AUTHORITY["EPSG","7030"]],
             AUTHORITY["EPSG","6326"]],
         PRIMEM["Greenwich",0],
         UNIT["degree",0.0174532925199433],
         AUTHORITY["EPSG","4326"]],
     UNIT["metre",1,
         AUTHORITY["EPSG","9001"]],
     AUTHORITY["EPSG","32662"]]
Origin = (-13914936.349159199744463,6094982.029363029636443)
Pixel Size = (1011.995370847942013,-1008.370376304165802)
Metadata:
   AREA_OR_POINT=Area
   Collection Location=USF Institute for Marine Remote Sensing
   Data Source Type=Direct Broadcast
   Input 
File(s)=/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.194420.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.194650.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.194920.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.195150.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.195420.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.194420.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.194650.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.194920.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.195150.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.195420.hdf
   L3 Software Name=/usr/bin/map_modis.pl
   L3 Software Version=4.2
   Map Limit=-5, -125, 55, -45
   Map Projection Category=Proj 4.4.7
   Map Projection Name=eqc
   Proj Projection Parameters=#Equidistant Cylindrical (Plate Caree)
#       Cyl, Sph
#       lat_ts=
# +proj=eqc +ellps=WGS84
   Processing Status=final
   Satellite=aqua
   Spatial Resolution=1km
   Temporal Resolution=pass
   _FillValue=[65535]
   band_name=1
   corrected_counts_offset=-0
   corrected_counts_scale=0.124973
   corrected_counts_units=counts
   long_name=Earth View 250M Aggregated 1km Reflective Solar Bands 
Scaled Integers Band 1
   radiance_offset=-0
   radiance_scale=0.0246418
   radiance_units=Watts/m^2/micrometer/steradian
   reflectance_offset=-0
   reflectance_scale=4.72967e-05
   reflectance_units=none
   units=none
   valid_range=[0 32767]
Image Structure Metadata:
   INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-13914936.349, 6094982.029)
Lower Left  (-13914936.349, -560262.454)
Upper Right (-5009377.086, 6094982.029)
Lower Right (-5009377.086, -560262.454)
Center      (-9462156.717, 2767359.788)
Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
     Computed Min/Max=377.000,32767.000
   Minimum=377.000, Maximum=32767.000, Mean=27526.311, StdDev=11176.835
   Metadata:
     STATISTICS_MINIMUM=377
     STATISTICS_MAXIMUM=32767
     STATISTICS_MEAN=27526.311392114
     STATISTICS_STDDEV=11176.834697473


new server:
# gdalinfo -mm -stats temp.tif
Driver: GTiff/GeoTIFF
Files: temp.tif
        temp.tif.aux.xml
Size is 8800, 6600
Coordinate System is:
LOCAL_CS["WGS 84 / Plate Carree",
     GEOGCS["WGS 84",
         DATUM["WGS_1984",
             SPHEROID["WGS 84",6378137,298.257223563,
                 AUTHORITY["EPSG","7030"]],
             AUTHORITY["EPSG","6326"]],
         PRIMEM["Greenwich",0],
         UNIT["degree",0.0174532925199433],
         AUTHORITY["EPSG","4326"]],
     AUTHORITY["EPSG","32662"],
     UNIT["metre",1]]
Origin = (-13914936.349159199744463,6115512.029363029636443)
Pixel Size = (1011.995370847942013,-1008.370224789014287)
Metadata:
   _FillValue=[65535]
   AREA_OR_POINT=Area
   band_name=1
   Collection Location=USF Institute for Marine Remote Sensing
   corrected_counts_offset=-0
   corrected_counts_scale=0.124973
   corrected_counts_units=counts
   Data Source Type=Direct Broadcast
   Input 
File(s)=/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.194420.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.194650.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.194920.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.195150.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD021KM.2014061.195420.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.194420.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.194650.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.194920.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.195150.hdf, 
/tmp/s4p_run_map_modis_2.3_2HwoEbWy/MYD03.2014061.195420.hdf
   L3 Software Name=/usr/bin/map_modis.pl
   L3 Software Version=4.2
   long_name=Earth View 250M Aggregated 1km Reflective Solar Bands 
Scaled Integers Band 1
   Map Limit=-5, -125, 55, -45
   Map Projection Category=Proj 4.4.7
   Map Projection Name=eqc
   Processing Status=final
   Proj Projection Parameters=#Equidistant Cylindrical (Plate Caree)
#       Cyl, Sph
#       lat_ts=
# +proj=eqc +ellps=WGS84
   radiance_offset=-0
   radiance_scale=0.0246418
   radiance_units=Watts/m^2/micrometer/steradian
   reflectance_offset=-0
   reflectance_scale=4.72967e-05
   reflectance_units=none
   Satellite=aqua
   Spatial Resolution=1km
   Temporal Resolution=pass
   units=none
   valid_range=[0 32767]
Image Structure Metadata:
   INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-13914936.349, 6115512.029)
Lower Left  (-13914936.349, -539731.454)
Upper Right (-5009377.086, 6115512.029)
Lower Right (-5009377.086, -539731.454)
Center      (-9462156.717, 2787890.288)
Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
   Min=377.000 Max=32767.000   Computed Min/Max=377.000,32767.000
   Minimum=377.000, Maximum=32767.000, Mean=27526.311, StdDev=11176.835
   Metadata:
     STATISTICS_MAXIMUM=32767
     STATISTICS_MEAN=27526.311392114
     STATISTICS_MINIMUM=377
     STATISTICS_STDDEV=11176.834697473
-------------------------------------------------------------------------


This is the problem step:

gdalwarp -rcs -ts 8800 6600 -s_srs EPSG:32662 -t_srs EPSG:4326 temp.tif 
target.tif

gdalinfo -mm -stats target.tif

is showing that the range of values in the image are dramatically 
different on the two servers!

summary old:
Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
     Computed Min/Max=-3877.000,32767.000
   Minimum=-3877.000, Maximum=32767.000, Mean=25235.731, StdDev=10612.642


summary new:
Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
   Min=-9314.000 Max=32561.000   Computed Min/Max=-9314.000,32561.000
   Minimum=-9314.000, Maximum=32561.000, Mean=19166.800, StdDev=7786.806


Ok, so you can see that the values are radically different. My question 
is how do I get values like the old system? These values represent 
temperatures and I need to get the same values.

My one thought on this is that if is another side effrct of proj4 
behaving differently as I had to adjust the position above to get it to 
align. So maybe the gdalwarp is messing up the pixel values when it 
reprojects it also. But I'm totally lost on how make this work correctly.

Any thoughts on how to fix this?


Thanks,
   -Steve

--------------------------- full output -------------------------------
old server:
# /opt/FWTools/bin_safe/gdalinfo -mm -stats target.tif
Driver: GTiff/GeoTIFF
Files: target.tif
Size is 8800, 6600
Coordinate System is:
GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.2572235629972,
             AUTHORITY["EPSG","7030"]],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0],
     UNIT["degree",0.0174532925199433],
     AUTHORITY["EPSG","4326"]]
Origin = (-125.000000000000128,54.752155134106310)
Pixel Size = (0.009090909090909,-0.009058345210874)
Metadata:
   AREA_OR_POINT=Area
Image Structure Metadata:
   INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-125.0000000,  54.7521551) (125d 0'0.00"W, 54d45'7.76"N)
Lower Left  (-125.0000000,  -5.0329233) (125d 0'0.00"W,  5d 1'58.52"S)
Upper Right ( -45.0000000,  54.7521551) ( 45d 0'0.00"W, 54d45'7.76"N)
Lower Right ( -45.0000000,  -5.0329233) ( 45d 0'0.00"W,  5d 1'58.52"S)
Center      ( -85.0000000,  24.8596159) ( 85d 0'0.00"W, 24d51'34.62"N)
Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
     Computed Min/Max=-3877.000,32767.000
   Minimum=-3877.000, Maximum=32767.000, Mean=25235.731, StdDev=10612.642
   Metadata:
     STATISTICS_MINIMUM=-3877
     STATISTICS_MAXIMUM=32767
     STATISTICS_MEAN=25235.730898691
     STATISTICS_STDDEV=10612.642070873



new server:
# gdalinfo -mm -stats target2.tif
Driver: GTiff/GeoTIFF
Files: target2.tif
Size is 8800, 6600
Coordinate System is:
GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.257223563,
             AUTHORITY["EPSG","7030"]],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0],
     UNIT["degree",0.0174532925199433],
     AUTHORITY["EPSG","4326"]]
Origin = (-125.000000000000000,54.936579261935996)
Pixel Size = (0.009090548058866,-0.009058564516722)
Metadata:
   AREA_OR_POINT=Area
Image Structure Metadata:
   INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-125.0000000,  54.9365793) (125d 0' 0.00"W, 54d56'11.69"N)
Lower Left  (-125.0000000,  -4.8499465) (125d 0' 0.00"W,  4d50'59.81"S)
Upper Right ( -45.0031771,  54.9365793) ( 45d 0'11.44"W, 54d56'11.69"N)
Lower Right ( -45.0031771,  -4.8499465) ( 45d 0'11.44"W,  4d50'59.81"S)
Center      ( -85.0015885,  25.0433164) ( 85d 0' 5.72"W, 25d 2'35.94"N)
Band 1 Block=8800x1 Type=Int16, ColorInterp=Gray
     Computed Min/Max=-9314.000,32561.000
   Minimum=-9314.000, Maximum=32561.000, Mean=19166.800, StdDev=7786.806
   Metadata:
     STATISTICS_MAXIMUM=32561
     STATISTICS_MEAN=19166.799570351
     STATISTICS_MINIMUM=-9314
     STATISTICS_STDDEV=7786.8063693375


More information about the gdal-dev mailing list