def tar(sceneID): # if no tar for sceneID in tarStorage, go get it if not(re.search(sceneID, ' '.join(glob.glob(os.path.join(LSF.tarStorage, '*.gz'))))): # writes to extracted_imagery, minimum_dn, and landsat_metadata landsatFactTools_GDAL.extractProductForCompare(sceneID, LSF.tarStorage,LSF.tiffsStorage,LSF.fmaskShellCall,LSF.quadsFolder,LSF.projectStorage) # if the tar's been processed, should at least be a row in minimum_dn # note if the row is missing else: resultRowExists = rowExists(sceneID, 'minimum_dn', 'scene_id') if resultRowExists == False: print "No row for {} in minimum_dn".format(sceneID)
quadTiffList2Process = landsatFactTools_GDAL.getNextBestQuad(quadCCDict,cloudCoverThreshold) # ========================================================================= #jdm: Need to make sure the next best quads we are going to be comparing to are actually extracted #and pre-processed to a level appropriate for differencing. print "quadTiffList2Process: ", quadTiffList2Process #TO-DO: create/call a function in landsatFactTools_GDAL called extractProductForCompare() #loop through quadTiffList2Process and get unique list of data to download for quad_pair in quadTiffList2Process: base_quad = quad_pair[1] diff_quad = quad_pair[0] # The first quad that is determined to be missing from disk sets off a call # to extractProductForCompare. extractProductForCompare then download the tar ball for that # scene and presumably the next time through a quad from that given seen will be # accounted for. if os.path.exists(projectStorage+'/'+diff_quad) == False: landsatFactTools_GDAL.extractProductForCompare(diff_quad[:-2],tarStorage,tiffsStorage,fmaskShellCall,quadsFolder,projectStorage) extractedList.append(diff_quad[0:21]+'.tar.gz') else: print diff_quad+" already exist in the projectStorage" # ========================================================================= # checks the list of quads, if 0 then there were no quads under the cloud cover threshold # so there is nothing to process for that scene if len(quadTiffList2Process) > 0: #print "quadTiffList2Process: ", quadTiffList2Process # for each quad pair perform the change analysis for compareList in quadTiffList2Process: pathList = [os.path.join(projectStorage,compareList[0]), os.path.join(projectStorage,compareList[1])] # ========================================================================= # sets the scenes in order tifPathList = pathList #print "tifPathList: ", tifPathList
#and pre-processed to a level appropriate for differencing. print "quadTiffList2Process: ", quadTiffList2Process #TO-DO: create/call a function in landsatFactTools_GDAL called extractProductForCompare() #loop through quadTiffList2Process and get unique list of data to download for quad_pair in quadTiffList2Process: base_quad = quad_pair[1] diff_quad = quad_pair[0] # The first quad that is determined to be missing from disk sets off a call # to extractProductForCompare. extractProductForCompare then download the tar ball for that # scene and presumably the next time through a quad from that given seen will be # accounted for. if os.path.exists(projectStorage+'/'+diff_quad) == False: print "Begin extractProductForCompare of input1 " + str(datetime.datetime.now()) sceneID = diff_quad[:-2] productID = landsatFactTools_GDAL.getProductIDForScene(sceneID) landsatFactTools_GDAL.extractProductForCompare(sceneID,tarStorage,tiffsStorage,fmaskShellCall,quadsFolder,projectStorage,productID) print "End extractProductForCompare of input1 " + str(datetime.datetime.now()) extractedList.append(sceneID+'.tar.gz') else: print diff_quad+" already exist in the projectStorage" # ========================================================================= # checks the list of quads, if 0 then there were no quads under the cloud cover threshold # so there is nothing to process for that scene if len(quadTiffList2Process) > 0: #print "quadTiffList2Process: ", quadTiffList2Process # for each quad pair perform the change analysis for compareList in quadTiffList2Process: pathList = [os.path.join(projectStorage,compareList[0]), os.path.join(projectStorage,compareList[1])] # ========================================================================= # sets the scenes in order tifPathList = pathList