本文整理汇总了Python中ecohydrolib.metadata.GenericMetadata.readStudyAreaEntries方法的典型用法代码示例。如果您正苦于以下问题:Python GenericMetadata.readStudyAreaEntries方法的具体用法?Python GenericMetadata.readStudyAreaEntries怎么用?Python GenericMetadata.readStudyAreaEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecohydrolib.metadata.GenericMetadata
的用法示例。
在下文中一共展示了GenericMetadata.readStudyAreaEntries方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readStudyAreaEntries [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: checkMetadata
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readStudyAreaEntries [as 别名]
def checkMetadata(self, *args, **kwargs):
""" Check to make sure the project directory has the necessary metadata to run this command.
@note Concrete commands must call this super class method in their own
implementation of checkMetadata(), and must call their implementation
near the beginning of their run method.
"""
self.studyArea = GenericMetadata.readStudyAreaEntries(self.context)
示例3: test_empty_read
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readStudyAreaEntries [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)
示例4: test_delete
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readStudyAreaEntries [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)
示例5: test_write_and_read
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readStudyAreaEntries [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 readStudyAreaEntries [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: isValidSrs
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readStudyAreaEntries [as 别名]
sys.exit("Config file %s does not define option %s in section %s" % \
(configFile, 'PATH_OF_GDAL_WARP', 'GDAL/OGR'))
if args.outfile:
outfile = args.outfile
else:
outfile = "DEM"
demFilename = "%s.tif" % (outfile)
# Overwrite DEM if already present
demFilepath = os.path.join(context.projectDir, demFilename)
if os.path.exists(demFilepath):
os.unlink(demFilepath)
# Get study area parameters
studyArea = GenericMetadata.readStudyAreaEntries(context)
bbox = bboxFromString(studyArea['bbox_wgs84'])
# Determine target spatial reference
if args.t_srs:
if not isValidSrs(args.t_srs):
sys.exit(textwrap.fill("ERROR: '%s' is not a valid spatial reference. Spatial reference must be of the form 'EPSG:XXXX', e.g. 'EPSG:32617'. For more information, see: http://www.spatialreference.org/" % (args.t_srs,) ) )
t_srs = args.t_srs
else:
# Default for UTM
(centerLon, centerLat) = calculateBoundingBoxCenter(bbox)
(utmZone, isNorth) = getUTMZoneFromCoordinates(centerLon, centerLat)
t_srs = getEPSGStringForUTMZone(utmZone, isNorth)
# Get DEM from DEMExplorer
sys.stdout.write('Downloading DEM from DEMExplorer...')
示例8: Context
# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import readStudyAreaEntries [as 别名]
parser.add_argument('-c', '--collection', dest='collection', required=True,
help='The iRODS collection corresponding to the project directory')
args = parser.parse_args()
context = Context(args.projectDir, None)
# Make sure there's no trailing PATH_SEP_IRODS on the collection
collection = args.collection.rstrip(PATH_SEP_IRODS)
outfilePath = os.path.join(context.projectDir, OUTFILE_NAME)
outfile = codecs.getwriter('utf-8')(open(outfilePath, 'w'))
outfile.write('<?xml version="1.0" encoding="UTF-8" ?>\n')
outfile.write('<metadata>\n')
# Write study area metadata to collection root
writeDictToXMLFile(outfile, collection, GenericMetadata.readStudyAreaEntries(context))
# Write processing history to collection root
history = GenericMetadata.getProcessingHistoryList(context)
i = 1
for entry in history:
attribute = "processing_step_%d" % (i,); i += 1
writeAVUToXMLFile(outfile, collection, attribute, entry)
# Write provenance to each item in the manifest
provenance = GenericMetadata.readAssetProvenanceObjects(context)
for entry in provenance:
target = collection + PATH_SEP_IRODS + entry.dcIdentifier
writeAVUToXMLFile(outfile, target, 'name', entry.name)
writeAVUToXMLFile(outfile, target, 'dc.source', entry.dcSource)
writeAVUToXMLFile(outfile, target, 'dc.title', entry.dcTitle)