190 likes | 219 Views
A PYTHON SCRIPT TO PAN-SHARPEN IMAGERY & SUBSET IT WITH A QUARTERQUAD SHAPEFILE FINAL PROJECT CHRIS CURLIS GEOGRAPHY 376 AMERICAN RIVER COLLEGE SPRING 2010 NATHAN JENNINGS, INSTRUCTOR MAY 14, 2010. The goal of this project was to create a python script which
E N D
A PYTHON SCRIPT TO PAN-SHARPEN IMAGERY & SUBSET IT WITH A QUARTERQUAD SHAPEFILE FINAL PROJECT CHRIS CURLIS GEOGRAPHY 376 AMERICAN RIVER COLLEGE SPRING 2010 NATHAN JENNINGS, INSTRUCTOR MAY 14, 2010
The goal of this project was to create a python script which would pan-sharpen a Landsat 7 image and subset the new sharpened imagery by quarterquad. A shapefile was first created of those quarterquads which were of interest because they had no gaps from the SLC malfunction. The final products are: A full pan-sharpened Landsat 7 TM scene A set of shapefile boundaries for each quarterquad of interest A set of pan-sharpened TM quarterquad images
LANDSAT 7 IMAGERY Due to scan line corrector malfunction, imagery has gaps on either side but there is a path in the middle of the image with no gaps.
Statewide grid of quarterquads overlaying Landsat 7 TM imagery.
A statewide quarterquadshapefile was used To identify which quarterquads have no gaps
A statewide quarterquadshapefile was used To identify which quarterquads have no gaps This shapefile(NoGaps.shp) was created by visually selecting q-quads with no gaps in imagery.
Arc Toolbox has a tool for creating pan-sharpened imagery using coarser (30 meter) multispectral imagery with finer (15 meter) panchromatic imagery The toolbox was used to study and generate a python script example of pan-sharpening
The parameters needed for pan-sharpening. Greatest weight is given to the infrared band of imagery. The weights can be set or defaults used based on pan-sharpening type.
The python script checks for a pre-existing pan-sharpened image and deletes it. The variables are from modelbuilder exported script. The script creates a new pan-sharpened image of the full Landsat 7 scene.
Next a search cursor is created that loops through all the records in the table for NoGaps.shp A portion of the script checks for the existence of the entire “Outputs” directory which has over 100 files and deletes it. a new “Outputs” directory is then created.
Two of the fields in the NoGaps.shp table are combined to name the mask shapefiles and the subset pan-sharpened images: “USGSID” and “Qdrnt” since “QQNAME” has spaces in it.
This “try” statement of the script begins looping through the FID values using “while” and gives a name combining “USGSID” and “Qdrnt”. The selected quarterquads become new individual shapefiles and these shapefiles are used with “extract by mask” on the pan-sharpened Landsat 7 TM scene to create individual quarterquad images. Using row = rows.Next(), the script continues looping until all FID’s have been selected and new files created. The script then prints: “Script completed…all quarterquads have been clipped”
15 meter resolution pan-sharpened imagery quarterquad overlaying 30 meter Landsat imagery SUCCESS!