Пример #1
0
#meanrefs = find_files("/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/Refs/2012", ".ref", recursive=False)
#reffiles.append(meanrefs)

rootout = "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/Classified/test1_envicurves/fullpxonly/geometricmean"
#outfolders = [os.path.join(rootout, "clip1refs")]#, os.path.join(rootout, "clip2refs"), os.path.join(rootout, "clip3refs"), os.path.join(rootout, "clip4refs"), os.path.join(rootout, "clip5refs"), os.path.join(rootout, "clip6refs"),
outfolders = [os.path.join(rootout, "clip1refs")]

imagelist = []
clip1imgs = ["/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/clips/KansasNDVI_2012_clip1.tif"]#, "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/clips/KansasEVI_2012_clip1.tif"]
imagelist.append(clip1imgs)

searchstrings = ["soy", "corn", "wwheat", "sorghum", "wwheatsoydbl"]
fitmethods = ["SLSQP"]#, "TNC"]

fullpixels = get_px_coords_from_points(clip1imgs[0], "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/clips/clip1_fullcells_points.shp")

for method in fitmethods:
    for images in imagelist:
        for img in images:
            name = os.path.splitext(os.path.basename(img))[0]
            if "NDVI" in name:
                type = "NDVI"
            else:
                type = "EVI"

            for reffile, outfolder in zip(reffiles, outfolders):

                refs = {}
                for f in reffile:
                    if type in f:
Пример #2
0
outroot = "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/Refs/2012clip1test2"
samplepointsroot = "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/SampleAreas/clip1/envipoints"
clips = []

#clip1
#wwheat = [(39, 37), (45, 50), (11, 54), (4, 19), (75, 34)]
#corn = [(48, 44), (10, 68), (8, 37), (67, 66), (83, 21)]
#soy = [(42, 45), (31, 86), (7, 64), (55, 83), (73, 73)]
#wwheatsoydbl = [(32, 62), (38, 55), (25, 56), (39, 30), (97, 3)]
#sorghum = [(82, 52), (70, 38), (49, 33), (36, 28), (28, 27)]

clip1imgs = ["/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/clips/KansasNDVI_2012_clip1.tif", "/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS_KANSAS_2007-2012/reprojected/clips/KansasEVI_2012_clip1.tif"]
clip1out = os.path.join(outroot, "clip1")

wwheat = get_px_coords_from_points(clip1imgs[0], os.path.join(samplepointsroot, "wwheat.shp"))
corn = get_px_coords_from_points(clip1imgs[0], os.path.join(samplepointsroot, "corn.shp"))
soy = get_px_coords_from_points(clip1imgs[0], os.path.join(samplepointsroot, "soy.shp"))
wwheatsoydbl = get_px_coords_from_points(clip1imgs[0], os.path.join(samplepointsroot, "wwheatsoydbl.shp"))
sorghum = get_px_coords_from_points(clip1imgs[0], os.path.join(samplepointsroot, "sorghum.shp"))

clip1locs = {"wwheat": wwheat, "corn": corn, "soy": soy, "wwheatsoydbl": wwheatsoydbl, "sorghum": sorghum}

clips.append((clip1locs, clip1imgs, clip1out))

##clip2
#wwheat = [(2, 11), (6, 28), (63, 29), (23, 55), (6, 55), (3, 36)]
#corn = [(3, 36), (79, 53), (50, 50), (66, 25), (70, 4), (65, 63)]
#soy = [(6, 25), (6, 14), (97, 35), (85, 49), (60, 25)]
#wwheatsoydbl = [(41, 53), (73, 61), (44, 32), (47, 64)]
#sorghum = []