EcohydroLib  1.29
Variables
RegisterRaster Namespace Reference

Register 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 raster dataset with project')
 
string help = 'The configuration file'
 
string choices = 'near'
 
tuple args = parser.parse_args()
 
tuple cmdline = GenericMetadata.getCommandLine()
 
 configFile = None
 
tuple context = Context(args.projectDir, configFile)
 
tuple inRasterPath = os.path.abspath(args.rasterfile)
 
 publisher = args.publisher
 
 outfile = args.outfile
 
 force = False
 
tuple studyArea = GenericMetadata.readStudyAreaEntries(context)
 
tuple bbox = bboxFromString(studyArea['bbox_wgs84'])
 
tuple demResolutionX = float(studyArea['dem_res_x'])
 
tuple demResolutionY = float(studyArea['dem_res_y'])
 
tuple demColumns = int(studyArea['dem_columns'])
 
tuple demRows = int(studyArea['dem_rows'])
 
list srs = studyArea['dem_srs']
 
string rasterFilename = "%s%stif"
 
tuple rasterFilepath = os.path.join(context.projectDir, rasterFilename)
 
 resample = False
 
tuple rasterMetadata = getSpatialReferenceForRaster(inRasterPath)
 
list rasterSrs = rasterMetadata[5]
 
tuple rasterX = float(rasterMetadata[0])
 
tuple rasterY = float(rasterMetadata[1])
 
string processingNotes = "Clipping %s raster %s to DEM extent"
 
tuple manifest = GenericMetadata.readManifestEntries(context)
 
list demFilename = manifest['dem']
 
tuple demFilepath = os.path.join(context.projectDir, demFilename)
 
 s_srs = srs,\
 
 trX = demResolutionY,\
 
 resampleMethod = args.resampleMethod)
 
tuple newRasterMetadata = getDimensionsForRaster(rasterFilepath)
 
tuple asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION)
 

Detailed Description

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

Raster type must be one of GenericMetadata.RASTER_TYPES.

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'
  2. 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
  3. The following metadata entry(ies) must be present in the manifest section of the metadata associated with the project directory: dem

Post conditions

  1. Will write the following entry(ies) to the manifest section of metadata associated with the project directory: landcover [for GenericMetadata.RASTER_TYPE_LC; the name of the landcover raster] roof_connectivity [for GenericMetadata.RASTER_TYPE_ROOF; the name of the roof raster]
  2. Will write the following entry(ies) to the study area section of metadata associated with the project directory: landcover_type=custom [for GenericMetadata.RASTER_TYPE_LC]

Usage:

1 RegisterRaster.py -p /path/to/project_dir -t RASTER_TYPE -r /raster/to/register
Todo:
Set date in provenance to file modification date

Raster type must be one of GenericMetadata.RASTER_TYPES.

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'
  2. 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
  3. The following metadata entry(ies) must be present in the manifest section of the metadata associated with the project directory: dem

Post conditions

  1. Will write the following entry(ies) to the manifest section of metadata associated with the project directory: landcover [for GenericMetadata.RASTER_TYPE_LC; the name of the landcover raster] roof_connectivity [for GenericMetadata.RASTER_TYPE_ROOF; the name of the roof raster]
  2. Will write the following entry(ies) to the study area section of metadata associated with the project directory: landcover_type=custom [for GenericMetadata.RASTER_TYPE_LC]

Usage:

1 RegisterRaster.py -p /path/to/project_dir -t RASTER_TYPE -r /raster/to/register
Todo:
Set date in provenance to file modification date

Variable Documentation

tuple RegisterRaster.args = parser.parse_args()
tuple RegisterRaster.asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION)
tuple RegisterRaster.bbox = bboxFromString(studyArea['bbox_wgs84'])
string RegisterRaster.choices = 'near'
tuple RegisterRaster.cmdline = GenericMetadata.getCommandLine()
RegisterRaster.configFile = None
tuple RegisterRaster.context = Context(args.projectDir, configFile)
tuple RegisterRaster.demColumns = int(studyArea['dem_columns'])
list RegisterRaster.demFilename = manifest['dem']
tuple RegisterRaster.demFilepath = os.path.join(context.projectDir, demFilename)
tuple RegisterRaster.demResolutionX = float(studyArea['dem_res_x'])
tuple RegisterRaster.demResolutionY = float(studyArea['dem_res_y'])
tuple RegisterRaster.demRows = int(studyArea['dem_rows'])
RegisterRaster.force = False
string RegisterRaster.help = 'The configuration file'
tuple RegisterRaster.inRasterPath = os.path.abspath(args.rasterfile)
tuple RegisterRaster.manifest = GenericMetadata.readManifestEntries(context)
tuple RegisterRaster.newRasterMetadata = getDimensionsForRaster(rasterFilepath)
RegisterRaster.outfile = args.outfile
tuple RegisterRaster.parser = argparse.ArgumentParser(description='Register raster dataset with project')
string RegisterRaster.processingNotes = "Clipping %s raster %s to DEM extent"
string RegisterRaster.publisher = args.publisher
string RegisterRaster.rasterFilename = "%s%stif"
tuple RegisterRaster.rasterFilepath = os.path.join(context.projectDir, rasterFilename)
tuple RegisterRaster.rasterMetadata = getSpatialReferenceForRaster(inRasterPath)
list RegisterRaster.rasterSrs = rasterMetadata[5]
tuple RegisterRaster.rasterX = float(rasterMetadata[0])
tuple RegisterRaster.rasterY = float(rasterMetadata[1])
RegisterRaster.resample = False
RegisterRaster.resampleMethod = args.resampleMethod)
RegisterRaster.s_srs = srs,\
list RegisterRaster.srs = studyArea['dem_srs']
tuple RegisterRaster.studyArea = GenericMetadata.readStudyAreaEntries(context)
RegisterRaster.trX = demResolutionY,\