EcohydroLib  1.29
Variables
GetHYDRO1kDEMForBoundingbox Namespace Reference

Extract tile for HYDRO1k digital elevation model (DEM) stored locally. More...

Variables

tuple parser = argparse.ArgumentParser(description='Get DEM raster (in GeoTIFF format) for a bounding box from GeoBrain WCS4DEM')
 
string help = 'The configuration file'
 
tuple args = parser.parse_args()
 
tuple cmdline = GenericMetadata.getCommandLine()
 
 configFile = None
 
tuple context = Context(args.projectDir, configFile)
 
 outfile = args.outfile
 
string demFilename = "%s.tif"
 
tuple demFilepath = os.path.join(context.projectDir, demFilename)
 
tuple studyArea = GenericMetadata.readStudyAreaEntries(context)
 
tuple bbox = bboxFromString(studyArea['bbox_wgs84'])
 
 t_srs = args.t_srs
 
string tmpDEMFilename = "%s-TEMP.tif"
 
tuple returnCode = demtile.getDEMForBoundingBox(context.config, context.projectDir, tmpDEMFilename, bbox=bbox, srs=t_srs)
 
tuple tmpDEMFilepath = os.path.join(context.projectDir, tmpDEMFilename)
 
list demResolutionX = args.demResolution[0]
 
list demResolutionY = args.demResolution[1]
 
tuple demSrs = getSpatialReferenceForRaster(tmpDEMFilepath)
 
 s_srs = t_srs,\
 
 trX = demResolutionY)
 
tuple asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION)
 

Detailed Description

Extract tile for HYDRO1k digital elevation model (DEM) stored locally.

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_WARP' 'HYDRO1k', 'PATH_OF_HYDRO1K_DEM'
  2. The following metadata entry(ies) must be present in the study area section of the metadata associated with the project directory: bbox_wgs84

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]
  2. Will write the following entry(ies) to the study area section of metadata associated with the project directory: 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 GetHYDRO1kDEMForBoundingbox.py -p /path/to/project_dir -s 3 3
Note
EcohydroLib configuration file must be specified by environmental variable 'ECOHYDROWORKFLOW_CFG', or -i option must be specified.
If option -t is not specified, UTM projection (WGS 84 coordinate system) will be inferred from bounding box center.
Todo:
Debug case where t_srs is specified as NAD83, with unit degree, and 1000 is used as default DEM resolution

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_WARP' 'HYDRO1k', 'PATH_OF_HYDRO1K_DEM'
  2. The following metadata entry(ies) must be present in the study area section of the metadata associated with the project directory: bbox_wgs84

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]
  2. Will write the following entry(ies) to the study area section of metadata associated with the project directory: 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 GetHYDRO1kDEMForBoundingbox.py -p /path/to/project_dir -s 3 3
Note
EcohydroLib configuration file must be specified by environmental variable 'ECOHYDROWORKFLOW_CFG', or -i option must be specified.
If option -t is not specified, UTM projection (WGS 84 coordinate system) will be inferred from bounding box center.
Todo:
Debug case where t_srs is specified as NAD83, with unit degree, and 1000 is used as default DEM resolution

Variable Documentation

tuple GetHYDRO1kDEMForBoundingbox.args = parser.parse_args()
tuple GetHYDRO1kDEMForBoundingbox.asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION)
tuple GetHYDRO1kDEMForBoundingbox.bbox = bboxFromString(studyArea['bbox_wgs84'])
tuple GetHYDRO1kDEMForBoundingbox.cmdline = GenericMetadata.getCommandLine()
GetHYDRO1kDEMForBoundingbox.configFile = None
tuple GetHYDRO1kDEMForBoundingbox.context = Context(args.projectDir, configFile)
string GetHYDRO1kDEMForBoundingbox.demFilename = "%s.tif"
tuple GetHYDRO1kDEMForBoundingbox.demFilepath = os.path.join(context.projectDir, demFilename)
list GetHYDRO1kDEMForBoundingbox.demResolutionX = args.demResolution[0]
list GetHYDRO1kDEMForBoundingbox.demResolutionY = args.demResolution[1]
tuple GetHYDRO1kDEMForBoundingbox.demSrs = getSpatialReferenceForRaster(tmpDEMFilepath)
string GetHYDRO1kDEMForBoundingbox.help = 'The configuration file'
string GetHYDRO1kDEMForBoundingbox.outfile = args.outfile
tuple GetHYDRO1kDEMForBoundingbox.parser = argparse.ArgumentParser(description='Get DEM raster (in GeoTIFF format) for a bounding box from GeoBrain WCS4DEM')
tuple GetHYDRO1kDEMForBoundingbox.returnCode = demtile.getDEMForBoundingBox(context.config, context.projectDir, tmpDEMFilename, bbox=bbox, srs=t_srs)
GetHYDRO1kDEMForBoundingbox.s_srs = t_srs,\
tuple GetHYDRO1kDEMForBoundingbox.studyArea = GenericMetadata.readStudyAreaEntries(context)
tuple GetHYDRO1kDEMForBoundingbox.t_srs = args.t_srs
string GetHYDRO1kDEMForBoundingbox.tmpDEMFilename = "%s-TEMP.tif"
tuple GetHYDRO1kDEMForBoundingbox.tmpDEMFilepath = os.path.join(context.projectDir, tmpDEMFilename)
GetHYDRO1kDEMForBoundingbox.trX = demResolutionY)