software:canopy:technical_manual
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
software:canopy:technical_manual [2024-08-03 10:43 pm] – removed - external edit (Unknown date) 127.0.0.1 | software:canopy:technical_manual [2024-08-03 10:43 pm] (current) – ↷ Links adapted because of a move operation hcho | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== CanoPy technical manual ====== | ||
+ | [[software: | ||
+ | |||
+ | This document outlines the uses and methodology of the functions contained within the [[software: | ||
+ | |||
+ | ===== Authors ===== | ||
+ | |||
+ | * [[lab_members: | ||
+ | * [[lab_members: | ||
+ | |||
+ | ===== Requirements ===== | ||
+ | |||
+ | * ArcGIS Desktop 10.x | ||
+ | * ArcPy | ||
+ | * Python 2 standard module: os | ||
+ | * Feature Analyst(tm) by the Textron Systems | ||
+ | * Automated Feature Extraction (AFE) models trained using Feature Analyst | ||
+ | |||
+ | We are currently planning on developing a fully open source solution without using ArcGIS and Feature Analyst. | ||
+ | |||
+ | ===== canopy_config module ===== | ||
+ | |||
+ | Contained in '' | ||
+ | |||
+ | ==== phyregs_layer ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Layer containing polygon features for all physiographic regions | ||
+ | * Required attribute fields: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * Example: '' | ||
+ | |||
+ | ==== naipqq_layer ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Layer containing polygon features for all NAIP quarter quad (QQ) tiles | ||
+ | * Required attribute field: | ||
+ | * '' | ||
+ | * Example: '' | ||
+ | |||
+ | ==== naipqq_phyregs_field ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * New field name for assigning physiographic region IDs to the '' | ||
+ | * This output text field will be created in the '' | ||
+ | * Output format: '',#,#, | ||
+ | * Example: '' | ||
+ | |||
+ | ==== naip_path ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Input folder in which NAIP imagery is stored | ||
+ | * The structure of this input folder is defined by USDA, the original source of NAIP imagery. Under this folder are multiple 5-digit numeric folders that contain actual imagery GeoTIFF files.< | ||
+ | F:/ | ||
+ | 34083/ | ||
+ | m_3408301_ne_17_1_20090929.tif | ||
+ | m_3408301_ne_17_1_20090930.tif | ||
+ | ... | ||
+ | 34084/ | ||
+ | m_3408407_ne_16_1_20090930.tif | ||
+ | m_3408407_nw_16_1_20090930.tif | ||
+ | ... | ||
+ | ... | ||
+ | </ | ||
+ | * Example: '' | ||
+ | |||
+ | ==== spatref_wkid ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Desired output coordinate system in WKID format | ||
+ | * Well-Known IDs (WKIDs) are numeric identifiers for coordinate systems administered by Esri. This variable specifies the target spatial reference for output files. The WKID used for the GFC canopy project is 102039 (USA Contiguous Albers Equal Area Conic USGS version). | ||
+ | * Example: '' | ||
+ | |||
+ | ==== project_path ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Folder path with which all other output paths are determined | ||
+ | * The default structure of the project folder is defined as follows:< | ||
+ | C:/.../ (project_path) | ||
+ | Data/ | ||
+ | Physiographic_Districts_GA.shp (added as a layer) | ||
+ | | ||
+ | | ||
+ | ... | ||
+ | 2009 Analysis/ (analysis_path) | ||
+ | Data/ | ||
+ | naip_ga_2009_1m_m4b.shp (added as a layer) | ||
+ | snaprast.tif (snaprast_path) | ||
+ | | ||
+ | | ||
+ | Inputs/ | ||
+ | | ||
+ | Outputs/ | ||
+ | intermediate output tiles | ||
+ | canopy_2009_Winder_Slope.tif | ||
+ | ... | ||
+ | 2019 Analysis/ (analysis_path) | ||
+ | Data/ | ||
+ | naip_ga_2019_1m_m4b.shp (added as a layer) | ||
+ | snaprast.tif (snaprast_path) | ||
+ | | ||
+ | | ||
+ | Inputs/ | ||
+ | | ||
+ | Outputs/ | ||
+ | intermediate output tiles | ||
+ | canopy_2019_Winder_Slope.tif | ||
+ | ... | ||
+ | ... | ||
+ | </ | ||
+ | * **NOTE:** Output folder must be manually created. It is used when running Feature Analyst and is _**NOT**_ created by CanoPy. | ||
+ | * Example: '' | ||
+ | |||
+ | ==== analysis_path_format ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Format of the analysis path for one year | ||
+ | * Example: '' | ||
+ | |||
+ | ==== analysis_year ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Year for analysis | ||
+ | * Example: '' | ||
+ | |||
+ | ==== snaprast_path ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Snap raster to which all output tiles will be snapped | ||
+ | * This input/ | ||
+ | * Example: '' | ||
+ | |||
+ | ==== results_path ==== | ||
+ | |||
+ | * Type: '' | ||
+ | * Folder where all results will be stored | ||
+ | * Example: '' | ||
+ | |||
+ | ===== canopy module ===== | ||
+ | |||
+ | All functions designed for preproccessing NAIP imagery and for postprocessing trained/ | ||
+ | |||
+ | **NOTE:** The '' | ||
+ | |||
+ | ==== assign_phyregs_to_naipqq() ==== | ||
+ | |||
+ | This function adds the phyregs field to the NAIP QQ shapefile and populates it with physiographic region IDs that intersect each NAIP tile. | ||
+ | |||
+ | Arguments: None | ||
+ | |||
+ | Config variables assigned with '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Process: | ||
+ | - The data fields of the input NAIP QQ shapefile are read using '' | ||
+ | - Using '' | ||
+ | - All selections are cleared and each NAIP QQ polygon will contain the '' | ||
+ | |||
+ | ==== reproject_naip_tiles(phyreg_ids) ==== | ||
+ | |||
+ | This function reprojects and snaps the NAIP tiles that intersect selected physiographic regions. | ||
+ | |||
+ | Arguments: | ||
+ | * '' | ||
+ | |||
+ | Config variables assigned with '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Process: | ||
+ | - The spatial reference desired is set using the WKID specified in the '' | ||
+ | - If the snap raster does not exist within the '' | ||
+ | - All NAIP tiles intersecting the input '' | ||
+ | - The '' | ||
+ | - Using '' | ||
+ | - The outputs of this function are saved in an inputs folder and are what will used by Textron' | ||
+ | |||
+ | ==== convert_afe_to_final_tiles(phyreg_ids) ==== | ||
+ | |||
+ | This function converts Textron' | ||
+ | |||
+ | Arguments: | ||
+ | * '' | ||
+ | |||
+ | Config variables assigned with '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Process: | ||
+ | - All NAIP tiles in the desired physiographic region are first selected using an SQL statement to select the input physiographic IDs. | ||
+ | - The filenames from the NAIP QQ shapefile with the reprojected prefix are used to as the outputs folder created to save the classified imagery is walked through. | ||
+ | - Conversion is necessary as some AFE models used in feature analysis output GeoTIFF files and some output shapefiles. | ||
+ | - If the file is a shapefile, it is converted to raster with classes 1 and 0. | ||
+ | - If the file is a GeoTIFF file, the values are reclassified from 1 to 0 and 2 to 1. | ||
+ | - If the file has already run through this function and has the appropriate prefix, nothing happens to it. | ||
+ | - Outputs are saved in the outputs folder with the prefix '' | ||
+ | |||
+ | ==== clip_final_tiles(phyreg_ids) ==== | ||
+ | |||
+ | This function clips final tiles to their respective NAIP QQ area to eliminate | ||
+ | overlap. | ||
+ | |||
+ | Arguments: | ||
+ | * '' | ||
+ | |||
+ | Config variables assigned with '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Process: | ||
+ | - First, the '' | ||
+ | - All NAIP tiles in the desired physiographic region are first selected using an SQL statement to select the input physiographic IDs. | ||
+ | - The output files from '' | ||
+ | - If the tile has already been clipped and has the appropriate prefix, it will be skipped. If not, the tile will be clipped and the output GeoTIFF will have the prefix '' | ||
+ | |||
+ | ==== mosaic_clipped_final_tiles(phyreg_ids) ==== | ||
+ | |||
+ | This function mosaics clipped final GeoTIFF and then clips the mosaicked files | ||
+ | to their corresponding physiographic regions | ||
+ | |||
+ | Arguments: | ||
+ | * '' | ||
+ | |||
+ | Config variables assigned with '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Process: | ||
+ | - All NAIP tiles in the input physiographic regions are first selected using an SQL statement to select the input physiographic IDs. | ||
+ | - If the mosaicked file with the analysis year set by the '' | ||
+ | - Input tiles to be mosiacked are products from '' | ||
+ | - Mosiacking occurs using '' | ||
+ | - The new mosaiked data set is clipped to the outline of the physiographic region with the corresponding physiographic ID. | ||
+ | |||
+ | ==== convert_afe_to_canopy_tif(phyreg_ids) ==== | ||
+ | |||
+ | This function is a wrapper function that converts AFE outputs to the final | ||
+ | canopy GeoTIFF file by invoking '' | ||
+ | '' | ||
+ | |||
+ | Arguments: | ||
+ | * '' | ||
+ | |||
+ | Config variables assigned with '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ==== generate_gtpoints(phyreg_ids, | ||
+ | |||
+ | This function generates randomized points for ground truthing with fields for corresponding years populated with the corresponding canopy value at each point. | ||
+ | |||
+ | Arguments: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Config variables assigned with '' | ||
+ | *'' | ||
+ | *'' | ||
+ | *'' | ||
+ | *'' | ||
+ | *'' | ||
+ | |||
+ | Process: | ||
+ | - The physiographic regions are selected using the input physiographic IDs. | ||
+ | - Random points in each region are created using '' | ||
+ | - Fields are created in each point shapefile with the field name of '' | ||
+ | - The attributes of the '' | ||
+ | - A new spatially joined point shapefile allows for the file names of each point' | ||
+ | - Each point is converted to corresponding rows and columns within the corresponding NAIP QQ using '' | ||
+ | - The value of the NumPy cell at each point' | ||
+ | - After all point values are read, all fields except '' | ||
+ | - The originally generated point shapefile is deleted. | ||
+ | |||
+ | {{tag> |