EcohydroLib  1.29
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'
 
string choices = 'bilinear'
 
tuple args = parser.parse_args()
 
tuple cmdline = GenericMetadata.getCommandLine()
 
 configFile = None
 
tuple context = Context(args.projectDir, configFile)
 
tuple inDEMPath = os.path.abspath(args.demfile)
 
tuple inSpatialMetadata = getSpatialReferenceForRaster(inDEMPath)
 
 resample = False
 
list s_srs = inSpatialMetadata[5]
 
 t_srs = s_srs
 
list demResolutionX = args.demResolution[0]
 
list demResolutionY = args.demResolution[1]
 
 publisher = args.publisher
 
 outfile = args.outfile
 
string demFilename = "%s%stif"
 
tuple demFilepath = os.path.join(context.projectDir, demFilename)
 
 outfileTemp = None
 
 demFilenameTemp = None
 
 demFilepathTemp = None
 
tuple bbox = getBoundingBoxForRaster(demFilepath)
 
tuple shpFilename = writeBboxPolygonToShapefile(bbox, context.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]
  2. 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
EcohydroLib 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

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]
  2. 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
EcohydroLib 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)
string RegisterDEM.choices = 'bilinear'
tuple RegisterDEM.cmdline = GenericMetadata.getCommandLine()
RegisterDEM.configFile = None
tuple RegisterDEM.context = Context(args.projectDir, configFile)
string RegisterDEM.demFilename = "%s%stif"
string RegisterDEM.demFilenameTemp = None
tuple RegisterDEM.demFilepath = os.path.join(context.projectDir, demFilename)
tuple RegisterDEM.demFilepathTemp = None
list RegisterDEM.demResolutionX = args.demResolution[0]
list RegisterDEM.demResolutionY = args.demResolution[1]
tuple RegisterDEM.demSpatialMetadata = getSpatialReferenceForRaster(demFilepath)
string RegisterDEM.help = 'The configuration file'
tuple RegisterDEM.inDEMPath = os.path.abspath(args.demfile)
string RegisterDEM.inputDEMURL = "file://%s"
tuple RegisterDEM.inSpatialMetadata = getSpatialReferenceForRaster(inDEMPath)
string RegisterDEM.outfile = args.outfile
string RegisterDEM.outfileTemp = None
tuple RegisterDEM.parser = argparse.ArgumentParser(description='Register DEM with project')
string RegisterDEM.publisher = args.publisher
RegisterDEM.resample = False
list RegisterDEM.s_srs = inSpatialMetadata[5]
tuple RegisterDEM.shpFilename = writeBboxPolygonToShapefile(bbox, context.projectDir, "studyarea")
RegisterDEM.t_srs = s_srs