Geoscience Reference
In-Depth Information
-sds
If this flag is passed the script will compare all subdatasets that are part of the
dataset, otherwise subdatasets are ignored.
golden_file
The file that is considered correct, referred to as the golden file.
new_file
The file being compared to the golden file, referred to as the new file.
We fir s t run gdalcompare.py , selecting identical files for the golden and new
file. As expected, a perfect match is found:
gdalcompare.py lena_rgb.tif lena_rgb.tif
< FILE: lena_rgb.tif
> FILE: lena_rgb.tif
OK - Files match.
We then use the similar, but different images from the example in Sect. 6.2 . An
error message is returned, indicating that the images are not identical:
gdalcompare.py lena_rgb.tif lena_ct_rgb.tif
< FILE: lena_rgb.tif
> FILE: lena_ct_rgb.tif
Checking checksums...
ERROR: Comparison via GDAL failed: 'Checksum of band '1'
differs: '24719' != '47394'.'
In Sect. 6.2 we use gdalinfo -checksum as an alternative for gdalcom
pare.py . A more advanced script based on checksums is shown in Sect. 5.1 where
a directory is searched for duplicate images.
5.4 gdal_edit.py
The Python script gdal_edit.py allows for the modification of raster data
attributes such as its projection, geotransform, no-data and metadata. In contrast
to gdaltransform , the dataset is not copied to a new file. This is useful as you
don't have to create temporary files in case you want to change some attribute of a
raster file. Moreover, in the case of compressed raster files, there is no need to decom-
press and compress. This script only works with raster formats that do support update
access to existing datasets. For instance, it will not work for GIF, JPEG and PNG
image file formats. You can check the complete list of file formats that support update
 
 
Search WWH ::




Custom Search