Beispiel #1
0
img_b5_11 = functions.create_band(band=b5_11)
img_b7_11 = functions.create_band(band=b7_11)
img_ndvi_11 = functions.create_band(band=ndvi_11)
img_ndwi_11 = functions.create_band(band=ndwi_11)
img_mndwi1_11 = functions.create_band(band=mndwi1_11)
img_mndwi2_11 = functions.create_band(band=mndwi2_11)
img_ndbi_11 = functions.create_band(band=ndbi_11)
img_mndbi_11 = functions.create_band(band=mndbi_11)

img_11 = functions.combine_bands_sf(
    b1=img_b1_11,
    b2=img_b2_11,
    b3=img_b3_11,
    b4=img_b4_11,
    b5=img_b5_11,
    b7=img_b7_11,
    ndvi=img_ndvi_11,
    ndwi=img_ndwi_11,
    mndwi1=img_mndwi1_11,
    mndwi2=img_mndwi2_11,
    ndbi=img_ndbi_11,
    mndbi=img_mndbi_11,
    multiband_array_file='L2 imagery/img_11_sf.npy')

#-----------------------------------------------------------------------------------------------
#train and predict with RF
#400 trees
result_11_300 = functions.train_rf(
    trees=300,
    maxfeatures=None,
    train_array=train_array_11,
    gt_array=train11,
#2009
b1_09_t = functions.extract_values(shp = file_test09_shp, raster = b1_09)
b2_09_t = functions.extract_values(shp = file_test09_shp, raster = b2_09)
b3_09_t = functions.extract_values(shp = file_test09_shp, raster = b3_09)
b4_09_t = functions.extract_values(shp = file_test09_shp, raster = b4_09)
b5_09_t = functions.extract_values(shp = file_test09_shp, raster = b5_09)
b7_09_t = functions.extract_values(shp = file_test09_shp, raster = b7_09)
ndvi_09_t = functions.extract_values(shp = file_test09_shp, raster = ndvi_09)
ndwi_09_t = functions.extract_values(shp = file_test09_shp, raster = ndwi_09)
mndwi1_09_t = functions.extract_values(shp = file_test09_shp, raster = mndwi1_09)
mndwi2_09_t = functions.extract_values(shp = file_test09_shp, raster = mndwi2_09)
ndbi_09_t = functions.extract_values(shp = file_test09_shp, raster = ndbi_09)
mndbi_09_t = functions.extract_values(shp = file_test09_shp, raster = mndbi_09)

test_09 = functions.combine_bands_sf(b1 = b1_09_t, b2 = b2_09_t, b3 = b3_09_t, b4 = b4_09_t, 
	b5 = b5_09_t, b7 = b7_09_t, ndvi = ndvi_09_t, ndwi = ndwi_09_t, mndwi1 = mndwi1_09_t, 
	mndwi2 = mndwi2_09_t, ndbi = ndbi_09_t, mndbi = mndbi_09_t,
	multiband_array_file = 'Samples/SLC off/C_test_array_sf_09.npy')

#2011
b1_11_t = functions.extract_values(shp = file_test11_shp, raster = b1_11)
b2_11_t = functions.extract_values(shp = file_test11_shp, raster = b2_11)
b3_11_t = functions.extract_values(shp = file_test11_shp, raster = b3_11)
b4_11_t = functions.extract_values(shp = file_test11_shp, raster = b4_11)
b5_11_t = functions.extract_values(shp = file_test11_shp, raster = b5_11)
b7_11_t = functions.extract_values(shp = file_test11_shp, raster = b7_11)
ndvi_11_t = functions.extract_values(shp = file_test11_shp, raster = ndvi_11)
ndwi_11_t = functions.extract_values(shp = file_test11_shp, raster = ndwi_11)
mndwi1_11_t = functions.extract_values(shp = file_test11_shp, raster = mndwi1_11)
mndwi2_11_t = functions.extract_values(shp = file_test11_shp, raster = mndwi2_11)
ndbi_11_t = functions.extract_values(shp = file_test11_shp, raster = ndbi_11)
mndbi_11_t = functions.extract_values(shp = file_test11_shp, raster = mndbi_11)
img_b5_09 = functions.create_band(band=b5_09)
img_b7_09 = functions.create_band(band=b7_09)
img_ndvi_09 = functions.create_band(band=ndvi_09)
img_ndwi_09 = functions.create_band(band=ndwi_09)
img_mndwi1_09 = functions.create_band(band=mndwi1_09)
img_mndwi2_09 = functions.create_band(band=mndwi2_09)
img_ndbi_09 = functions.create_band(band=ndbi_09)
img_mndbi_09 = functions.create_band(band=mndbi_09)

img_09 = functions.combine_bands_sf(
    b1=img_b1_09,
    b2=img_b2_09,
    b3=img_b3_09,
    b4=img_b4_09,
    b5=img_b5_09,
    b7=img_b7_09,
    ndvi=img_ndvi_09,
    ndwi=img_ndwi_09,
    mndwi1=img_mndwi1_09,
    mndwi2=img_mndwi2_09,
    ndbi=img_ndbi_09,
    mndbi=img_mndbi_09,
    multiband_array_file='L2 imagery/img_09_sf.npy')

#-----------------------------------------------------------------------------------------------
#train and predict with RF
#400 trees
result_09_400 = functions.train_rf(
    trees=400,
    maxfeatures=None,
    train_array=train_array_09,
    gt_array=train09,