本文整理汇总了Python中ecohydrolib.metadata.GenericMetadata.readManifestEntries方法的典型用法代码示例。如果您正苦于以下问题:Python GenericMetadata.readManifestEntries方法的具体用法?Python GenericMetadata.readManifestEntries怎么用?Python GenericMetadata.readManifestEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecohydrolib.metadata.GenericMetadata
的用法示例。
在下文中一共展示了GenericMetadata.readManifestEntries方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readManifestEntries [as 别名]
def test_delete(self):
GenericMetadata.writeManifestEntry(self.context, "key1", "value_one")
manifest = GenericMetadata.readManifestEntries(self.context)
self.assertTrue(manifest["key1"] == "value_one")
GenericMetadata.deleteManifestEntry(self.context, "key1")
manifest = GenericMetadata.readManifestEntries(self.context)
self.assertTrue(not 'key1' in manifest)
GenericMetadata.writeStudyAreaEntry(self.context, "key1", "value_one")
studyArea = GenericMetadata.readStudyAreaEntries(self.context)
self.assertTrue(studyArea["key1"] == "value_one")
GenericMetadata.deleteStudyAreaEntry(self.context, 'key1')
studyArea = GenericMetadata.readStudyAreaEntries(self.context)
self.assertTrue(not 'key1' in studyArea)
GenericMetadata.writeClimatePointEntry(self.context, "key1", "value_one")
climatePoint = GenericMetadata.readClimatePointEntries(self.context)
self.assertTrue(climatePoint["key1"] == "value_one")
GenericMetadata.deleteClimatePointEntry(self.context, 'key1')
climatePoint = GenericMetadata.readClimatePointEntries(self.context)
self.assertTrue(not 'key1' in climatePoint)
GenericMetadata.writeClimateGridEntry(self.context, "key1", "value_one")
climateGrid = GenericMetadata.readClimateGridEntries(self.context)
self.assertTrue(climateGrid["key1"] == "value_one")
GenericMetadata.deleteClimateGridEntry(self.context, 'key1')
climateGrid = GenericMetadata.readClimateGridEntries(self.context)
self.assertTrue(not 'key1' in climateGrid)
# Delete and empty entry
GenericMetadata.deleteClimateGridEntry(self.context, "not_in_store")
示例2: test_empty_read
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readManifestEntries [as 别名]
def test_empty_read(self):
manifest = GenericMetadata.readManifestEntries(self.context)
self.assertTrue(len(manifest) == 0)
studyArea = GenericMetadata.readStudyAreaEntries(self.context)
self.assertTrue(len(studyArea) == 0)
climatePoint = GenericMetadata.readClimatePointEntries(self.context)
self.assertTrue(len(climatePoint) == 0)
climateGrid = GenericMetadata.readClimateGridEntries(self.context)
self.assertTrue(len(climateGrid) == 0)
示例3: test_delete
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readManifestEntries [as 别名]
def test_delete(self):
GenericMetadata.writeManifestEntry(self.context, "key1", "value_one")
manifest = GenericMetadata.readManifestEntries(self.context)
self.assertTrue(manifest["key1"] == "value_one")
GenericMetadata.deleteManifestEntry(self.context, "key1")
manifest = GenericMetadata.readManifestEntries(self.context)
self.assertTrue(not 'key1' in manifest)
GenericMetadata.writeStudyAreaEntry(self.context, "key1", "value_one")
studyArea = GenericMetadata.readStudyAreaEntries(self.context)
self.assertTrue(studyArea["key1"] == "value_one")
GenericMetadata.deleteStudyAreaEntry(self.context, 'key1')
studyArea = GenericMetadata.readStudyAreaEntries(self.context)
self.assertTrue(not 'key1' in studyArea)
GenericMetadata.writeClimatePointEntry(self.context, "key1", "value_one")
climatePoint = GenericMetadata.readClimatePointEntries(self.context)
self.assertTrue(climatePoint["key1"] == "value_one")
GenericMetadata.deleteClimatePointEntry(self.context, 'key1')
climatePoint = GenericMetadata.readClimatePointEntries(self.context)
self.assertTrue(not 'key1' in climatePoint)
GenericMetadata.writeClimateGridEntry(self.context, "key1", "value_one")
climateGrid = GenericMetadata.readClimateGridEntries(self.context)
self.assertTrue(climateGrid["key1"] == "value_one")
GenericMetadata.deleteClimateGridEntry(self.context, 'key1')
climateGrid = GenericMetadata.readClimateGridEntries(self.context)
self.assertTrue(not 'key1' in climateGrid)
# Delete and empty entry
GenericMetadata.deleteClimateGridEntry(self.context, "not_in_store")
GenericMetadata.writeHydroShareEntry(self.context, "resource_id", "fae3688aa1354fb2a558380669229a66")
hydroshare = GenericMetadata.readHydroShareEntries(self.context)
self.assertTrue(hydroshare["resource_id"] == "fae3688aa1354fb2a558380669229a66")
GenericMetadata.deleteHydroShareEntry(self.context, "resource_id")
hydroshare = GenericMetadata.readHydroShareEntries(self.context)
self.assertTrue(not 'resource_id' in hydroshare)
示例4: checkMetadata
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readManifestEntries [as 别名]
def checkMetadata(self):
""" Check to make sure the project directory has the necessary metadata to run this command.
"""
super(USGSWCSNLCD, self).checkMetadata()
# Check for necessary information in metadata
self.manifest = GenericMetadata.readManifestEntries(self.context)
if not 'dem' in self.manifest:
raise MetadataException("Metadata in project directory %s does not contain a DEM" % (self.context.projectDir,))
if not 'dem_srs' in self.studyArea:
raise MetadataException("Metadata in project directory %s does not contain a spatial reference system" % (self.context.projectDir,))
if not 'dem_res_x' in self.studyArea:
raise MetadataException("Metadata in project directory %s does not contain a raster X resolution" % (self.context.projectDir,))
if not 'dem_res_y' in self.studyArea:
raise MetadataException("Metadata in project directory %s does not contain a raster Y resolution" % (self.context.projectDir,))
示例5: test_write_and_read
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readManifestEntries [as 别名]
def test_write_and_read(self):
GenericMetadata.writeManifestEntry(self.context, "key1", "value_one")
GenericMetadata.writeManifestEntry(self.context, "key2", "value_two")
manifest = GenericMetadata.readManifestEntries(self.context)
self.assertTrue(manifest["key1"] == "value_one")
GenericMetadata.writeStudyAreaEntry(self.context, "key1", "value_one")
GenericMetadata.writeStudyAreaEntry(self.context, "key2", "value_two")
studyArea = GenericMetadata.readStudyAreaEntries(self.context)
self.assertTrue(studyArea["key1"] == "value_one")
GenericMetadata.writeClimatePointEntry(self.context, "key1", "value_one")
GenericMetadata.writeClimatePointEntry(self.context, "key2", "value_two")
climatePoint = GenericMetadata.readClimatePointEntries(self.context)
self.assertTrue(climatePoint["key1"] == "value_one")
GenericMetadata.writeClimateGridEntry(self.context, "key1", "value_one")
GenericMetadata.writeClimateGridEntry(self.context, "key2", "value_two")
climateGrid = GenericMetadata.readClimateGridEntries(self.context)
self.assertTrue(climateGrid["key1"] == "value_one")
示例6: test_write_and_read
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readManifestEntries [as 别名]
def test_write_and_read(self):
GenericMetadata.writeManifestEntry(self.context, "key1", "value_one")
GenericMetadata.writeManifestEntry(self.context, "key2", "value_two")
manifest = GenericMetadata.readManifestEntries(self.context)
self.assertTrue(manifest["key1"] == "value_one")
GenericMetadata.writeStudyAreaEntry(self.context, "key1", "value_one")
GenericMetadata.writeStudyAreaEntry(self.context, "key2", "value_two")
studyArea = GenericMetadata.readStudyAreaEntries(self.context)
self.assertTrue(studyArea["key1"] == "value_one")
GenericMetadata.writeClimatePointEntry(self.context, "key1", "value_one")
GenericMetadata.writeClimatePointEntry(self.context, "key2", "value_two")
climatePoint = GenericMetadata.readClimatePointEntries(self.context)
self.assertTrue(climatePoint["key1"] == "value_one")
GenericMetadata.writeClimateGridEntry(self.context, "key1", "value_one")
GenericMetadata.writeClimateGridEntry(self.context, "key2", "value_two")
climateGrid = GenericMetadata.readClimateGridEntries(self.context)
self.assertTrue(climateGrid["key1"] == "value_one")
GenericMetadata.writeHydroShareEntry(self.context, "resource_id", "fae3688aa1354fb2a558380669229a66")
hydroshare = GenericMetadata.readHydroShareEntries(self.context)
self.assertTrue(hydroshare["resource_id"] == "fae3688aa1354fb2a558380669229a66")
示例7: Context
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readManifestEntries [as 别名]
help='Overwrite existing SSURGO features shapefile in project directory. If not specified, program will halt if a dataset already exists.')
args = parser.parse_args()
cmdline = GenericMetadata.getCommandLine()
configFile = None
if args.configfile:
configFile = args.configfile
context = Context(args.projectDir, configFile)
if not context.config.has_option('GDAL/OGR', 'PATH_OF_OGR2OGR'):
sys.exit("Config file %s does not define option %s in section %s" & \
(args.configfile, 'GDAL/OGR', 'PATH_OF_OGR2OGR'))
# Check if features shapefile already exists
manifest = GenericMetadata.readManifestEntries(context)
if 'soil_features' in manifest:
if args.overwrite:
sys.stdout.write('Deleting existing SSURGO features shapefile\n')
sys.stdout.flush()
shpFilepath = os.path.join( context.projectDir, manifest['soil_features'] )
deleteShapefile(shpFilepath)
else:
sys.exit( textwrap.fill('SSURGO features already exist in project directory. Use --overwrite option to overwrite.') )
# Get study area parameters
studyArea = GenericMetadata.readStudyAreaEntries(context)
bbox = bboxFromString(studyArea['bbox_wgs84'])
outputrasterresolutionX = studyArea['dem_res_x']
outputrasterresolutionY = studyArea['dem_res_y']