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

Register digital elevation model (DEM) data into metadata store for a project directory, copying the DEM file into the project directory in the process. More...

Variables

tuple parser argparse.ArgumentParser(description='Register DEM 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 inDEMPath os.path.abspath(args.demfile)
 
 publisher args.publisher
 
 outfile args.outfile
 
string demFilename "%s%stif"
 
tuple demFilepath os.path.join(projectDir, demFilename)
 
tuple bbox getBoundingBoxForRaster(demFilepath)
 
tuple shpFilename writeBboxPolygonToShapefile(bbox, projectDir, "studyarea")
 
tuple demSpatialMetadata getSpatialReferenceForRaster(demFilepath)
 
string inputDEMURL "file://%s"
 
tuple asset AssetProvenance(GenericMetadata.MANIFEST_SECTION)
 

Detailed Description

Register digital elevation model (DEM) data into metadata store for a project directory, copying the DEM file into the project directory in the process.

Will create a study area polygon shapefile for the extent of the DEM imported.

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

None

Post conditions

  1. Will write the following entry(ies) to the manifest section of metadata associated with the project directory: dem [the name of the DEM raster] study_area_shapefile [the name of the study area shapefile generated from the DEM raster extent]
  1. Will write the following entry(ies) to the study area section of metadata associated with the project directory: bbox_wgs84 dem_res_x [X resolution of the DEM raster in units of the raster's projection] dem_res_y [Y resolution of the DEM raster in units of the raster's projection] dem_srs [spatial reference system of the DEM, in EPSG:<nnnn> format] dem_columns [number of pixels in the X direction] dem_rows [number of pixels in the Y direction]

Usage:

1 python ./RegisterDEM.py -p /path/to/project_dir -d /demfile/to/register
Note
EcoHydroWorkflowLib configuration file must be specified by environmental variable 'ECOHYDROWORKFLOW_CFG', or -i option must be specified.
Todo:

Add targer SRS, if present, call GDAL warp instead of just copying the file

Set date in provenance to file modification date

Variable Documentation

tuple RegisterDEM.args parser.parse_args()
tuple RegisterDEM.bbox getBoundingBoxForRaster(demFilepath)
tuple RegisterDEM.cmdline GenericMetadata.getCommandLine()
tuple RegisterDEM.config ConfigParser.RawConfigParser()
list RegisterDEM.configFile None
string RegisterDEM.demFilename "%s%stif"
tuple RegisterDEM.demFilepath os.path.join(projectDir, demFilename)
tuple RegisterDEM.demSpatialMetadata getSpatialReferenceForRaster(demFilepath)
string RegisterDEM.help 'The configuration file'
tuple RegisterDEM.inDEMPath os.path.abspath(args.demfile)
string RegisterDEM.inputDEMURL "file://%s"
string RegisterDEM.outfile args.outfile
tuple RegisterDEM.parser argparse.ArgumentParser(description='Register DEM with project')
tuple RegisterDEM.projectDir args.projectDir
string RegisterDEM.publisher args.publisher
tuple RegisterDEM.shpFilename writeBboxPolygonToShapefile(bbox, projectDir, "studyarea")