forked from drsudhanshupanda/Software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PCA.py
36 lines (30 loc) · 1.25 KB
/
PCA.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# PCA.py
# Created on: 2016-10-24 10:19:06.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy
# Set the workspace. List all of the TIFF files
#
arcpy.env.workspace= "E:/GSC_Data/Projects/DOE_CenterForForestedWetlandResearchSC_Biomass/Presentations/ParkerTractModelDevelopment"
# For each raster in the list of rasters
#
for tiff in arcpy.ListRasters("*", "TIF"):
# Create pyramids
#
arcpy.BuildPyramids_management(tiff)
# Select variables from workspace:
Band_7 = "2222_b2.img"
Band_6 = "2222_b3.img"
Band_5 = "2222_b4.img"
Band_4 = "2222_b5.img"
Band_3 = "2222_b6_1.img"
Band_2 = "2222_b7.img"
Band_1 = "2222_b8.img"
Princip_2 = "P:\\ArcGIS\\Default.gdb\\Princip_2"
PCA_results_TXT = "E:\\GSC_Data\\Projects\\DOE_CenterForForestedWetlandResearchSC_Biomass\\Presentations\\ParkerTractModelDevelopment\\PCA_results.TXT"
# Process: Principal Components
arcpy.gp.PrincipalComponents_sa("2222_B2.img;2222_b3.img;2222_b4.img;2222_b5.img;2222_b6_1.img;2222_b7.img;2022_B8.img", Princip_2, "7", PCA_results_TXT)