Sie sind auf Seite 1von 3

Principal Components

Pagina 1 di 3

Principal Components
Performs principal components analysis on a set of raster bands. Learn more about how Principal Components works

Usage tips
Command line and Scripting The value specified for the number of principal components determines the number of principal component layers in the output multiband raster. The number must not be larger than the total number of raster bands in the input. If the input is a layer created from a multiband raster with more than three bands, the operation will only consider the bands that were loaded (symbolized) by the layer. The raster bands must have a common intersection. If there is none, an error will occur and no output will be created. With the output data file name specified, the correlation and covariance matrices, as well as the eigenvalues and eigenvectors, will be stored in an ASCII file. ArcObjects The value specified for the [numberComponents] determines the number of principal component layers in the output multiband raster. The number must not be larger than the total number of raster bands in the input. The raster bands must have a common intersection. If there is none, an error will occur and no output will be created. With the dataFile name specified, the correlation and covariance matrixes, as well as the eigenvalues and eigenvectors, will be stored in an ASCII file.

Command line syntax


An overview of the command line window PrincipalComponents_sa <in_raster_bands; in_raster_bands...> <out_multiband_raster> {number_components} {out_data_file} Parameter <in_raster_bands; in_raster_bands...> <out_multiband_raster> {number_components} Explanation Input raster bands. Output multiband raster dataset. Number of principal components. Must be greater than zero and less than or equal to the total number of raster bands in in_raster_bands. The default is the total number of rasters in the input. {out_data_file} Output ASCII data file storing principal component parameters. The extension for the output file can be ".txt" or ".asc". Data types for geoprocessing tool parameters File Datatype Composite Geodataset Raster Dataset Long

mk:@MSITStore:C:\Programmi\ArcGIS\Help\spatial_analyst_tools.chm::/principal_c... 30/01/2010

Principal Components

Pagina 2 di 3

Command line example PrincipalComponents_sa "C:/data/raster1; C:/data/raster2; C:/data/raster3" C:/data/princomp

Scripting syntax
An overview of scripting in geoprocessing PrincipalComponents_sa (in_raster_bands, out_multiband_raster, number_components, out_data_file) Parameter in_raster_bands (Required) out_multiband_raster (Required) number_components (Optional) Explanation Input raster bands. Output multiband raster dataset. Number of principal components. Must be greater than zero and less than or equal to the total number of raster bands in in_raster_bands. The default is the total number of rasters in the input. out_data_file (Optional) Output ASCII data file storing principal component parameters. The extension for the output file can be ".txt" or ".asc". Data types for geoprocessing tool parameters Script example # # # # # # PrincipalComponents_sample.py Description: Performs principal components analysis on a set of raster bands. Requirements: None Author: ESRI Date: Sept 6, 2005 File Datatype Composite Geodataset Raster Dataset Long

# Import system modules import arcgisscripting # Create the Geoprocessor object gp = arcgisscripting.create() try: # Set the workspace gp.Workspace = "C:/data" # Set local variables InRasters = "raster1; raster2; raster3" OutMultibandRaster = "princomp.img" # Check out Spatial Analyst extension license gp.CheckOutExtension("Spatial") # Process: PrincipalComponents gp.PrincipalComponents_sa(InRasters, OutMultibandRaster) except: # If an error occurred while running a tool, then print the messages. print gp.GetMessages()

Map Algebra syntax


See PrinComp

mk:@MSITStore:C:\Programmi\ArcGIS\Help\spatial_analyst_tools.chm::/principal_c... 30/01/2010

Principal Components

Pagina 3 di 3

ArcObjects syntax
IMultivariateBandsOp::PrincipalComponent (rasterBands As IGeoDataset, dataFile As String, [numberComponents]) As IGeoDataset Parameter rasterBands dataFile Explanation Name of a multiband raster for which the principal component layers will be created. Name of the ASCII file where the principal component parameters will be stored. The extension for the output file can be ".txt" or ".asc". The number of principal components. Must be greater than zero and less than or equal to the total number of raster bands in rasterBands. The default is the total number of rasters in the input.

[numberComponents]

ArcObjects example Create the RasterMultivariateOp object Dim pMultivariateOp As IMultivariateOp Set pMultivariateOp = New RasterMultivariateOp Declare the first input raster object Dim pInputRaster1 As IGeoDataset Calls function to open the first raster dataset from disk Set pInputRaster1 = OpenRasterDataset (D:\SpatialData, inputraster1) Declare the second input raster object Dim pInputRaster2 As IGeoDataset Calls function to open the second raster dataset from disk Set pInputRaster2 = OpenRasterDataset (D:\SpatialData, inputraster2) Declare the third input raster object Dim pInputRaster3 As IGeoDataset Calls function to open the third raster dataset from disk Set pInputRaster3 = OpenRasterDataset (D:\SpatialData, inputraster3) Create a raster bandcollection Dim pBandCollection as IRasterBandCollection Set pBandCollection = New Raster pBandCollection.AppendBand pInputRaster1 pBandCollection.AppendBand pInputRaster2 pBandCollection.AppendBand pInputRaster3 Dim pInputDataset As IGeoDataset Set pInputDataset = pBandCollection Create the output file where the statistics for the components will be stored Dim strDataFile As String strDataFile = D:\SpatialData\princomp Declare the number of components Dim numComponents As Integer numComponents = 2 Declare the output raster object Dim pOutputRaster As IGeoDataset Calls the method Set pOutputRaster = pMultivariateOp.PrincipalComponents _ (pInputDataset, strDataFile, numComponents)

mk:@MSITStore:C:\Programmi\ArcGIS\Help\spatial_analyst_tools.chm::/principal_c... 30/01/2010

Das könnte Ihnen auch gefallen