EcohydroWorkflowLib  0.973
 All Classes Namespaces Files Functions Variables Pages
Variables
RegisterLandcover Namespace Reference

Register landcover raster into metadata store for a project directory, copying the raster into the project directory in the process. More...

Variables

tuple parser argparse.ArgumentParser(description='Register landcover dataset with project')
 
string help 'The configuration file'
 
tuple args parser.parse_args()
 
tuple cmdline GenericMetadata.getCommandLine()
 
 configFile None
 
tuple config ConfigParser.RawConfigParser()
 
 projectDir args.projectDir
 
tuple inLandcoverPath os.path.abspath(args.landcoverfile)
 
 publisher args.publisher
 
 outfile args.outfile
 
 force False
 
tuple studyArea GenericMetadata.readStudyAreaEntries(projectDir)
 
list bbox studyArea['bbox_wgs84']
 
list demResolutionX studyArea['dem_res_x']
 
list demResolutionY studyArea['dem_res_y']
 
list demColumns studyArea['dem_columns']
 
list demRows studyArea['dem_rows']
 
list srs studyArea['dem_srs']
 
string landcoverFilename "%s%stif"
 
tuple landcoverFilepath os.path.join(projectDir, landcoverFilename)
 
tuple lcMetadata getSpatialReferenceForRaster(inLandcoverPath)
 
list lcSrs lcMetadata[5]
 
list lcX lcMetadata[0]
 
list lcY lcMetadata[1]
 
 s_srs lcSrs,t_srssrs,\
 
 trX demResolutionX,trYdemResolutionY,\
 
string resampleMethod 'near'
 
tuple newLcMetadata getDimensionsForRaster(landcoverFilepath)
 
tuple asset AssetProvenance(GenericMetadata.MANIFEST_SECTION)
 

Detailed Description

Register landcover raster into metadata store for a project directory, copying the raster into the project directory in the process.

This software is provided free of charge under the New BSD License. Please see the following license information:

Copyright (c) 2013, University of North Carolina at Chapel Hill All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Author
Brian Miles brian.nosp@m._mil.nosp@m.es@un.nosp@m.c.ed.nosp@m.u

Pre conditions

  1. Configuration file must define the following sections and values: 'GDAL/OGR', 'PATH_OF_GDAL_TRANSLATE' 'GDAL/OGR', 'PATH_OF_GDAL_WARP'
  1. The following metadata entry(ies) must be present in the study area section of the metadata associated with the project directory: bbox_wgs84 dem_res_x dem_res_y dem_columns dem_rows dem_srs

Post conditions

  1. Will write the following entry(ies) to the manifest section of metadata associated with the project directory: landcover [the name of the landcover raster]
  1. Will write the following entry(ies) to the study area section of metadata associated with the project directory: landcover_type=custom

Usage:

1 python ./RegisterLandcover.py -p /path/to/project_dir -l /landcoverfile/to/register
Note
If option -t is not specified, UTM projection (WGS 84 coordinate system) will be inferred from bounding box center.
Todo:
Set date in provenance to file modification date

Variable Documentation

tuple RegisterLandcover.args parser.parse_args()
tuple RegisterLandcover.asset AssetProvenance(GenericMetadata.MANIFEST_SECTION)
tuple RegisterLandcover.bbox studyArea['bbox_wgs84']
tuple RegisterLandcover.cmdline GenericMetadata.getCommandLine()
tuple RegisterLandcover.config ConfigParser.RawConfigParser()
list RegisterLandcover.configFile None
list RegisterLandcover.demColumns studyArea['dem_columns']
list RegisterLandcover.demResolutionX studyArea['dem_res_x']
list RegisterLandcover.demResolutionY studyArea['dem_res_y']
list RegisterLandcover.demRows studyArea['dem_rows']
RegisterLandcover.force False
string RegisterLandcover.help 'The configuration file'
tuple RegisterLandcover.inLandcoverPath os.path.abspath(args.landcoverfile)
string RegisterLandcover.landcoverFilename "%s%stif"
tuple RegisterLandcover.landcoverFilepath os.path.join(projectDir, landcoverFilename)
tuple RegisterLandcover.lcMetadata getSpatialReferenceForRaster(inLandcoverPath)
list RegisterLandcover.lcSrs lcMetadata[5]
list RegisterLandcover.lcX lcMetadata[0]
list RegisterLandcover.lcY lcMetadata[1]
tuple RegisterLandcover.newLcMetadata getDimensionsForRaster(landcoverFilepath)
string RegisterLandcover.outfile args.outfile
tuple RegisterLandcover.parser argparse.ArgumentParser(description='Register landcover dataset with project')
tuple RegisterLandcover.projectDir args.projectDir
string RegisterLandcover.publisher args.publisher
string RegisterLandcover.resampleMethod 'near'
RegisterLandcover.s_srs lcSrs,t_srssrs,\
list RegisterLandcover.srs studyArea['dem_srs']
tuple RegisterLandcover.studyArea GenericMetadata.readStudyAreaEntries(projectDir)
RegisterLandcover.trX demResolutionX,trYdemResolutionY,\