當前位置: 首頁>>代碼示例>>Python>>正文


Python GenericMetadata.readManifestEntries方法代碼示例

本文整理匯總了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")
開發者ID:npp2016,項目名稱:EcohydroLib,代碼行數:32,代碼來源:test_metadata.py

示例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)
開發者ID:dblodgett-usgs,項目名稱:EcohydroLib,代碼行數:14,代碼來源:test_metadata.py

示例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)
開發者ID:dblodgett-usgs,項目名稱:EcohydroLib,代碼行數:39,代碼來源:test_metadata.py

示例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,))    
開發者ID:dblodgett-usgs,項目名稱:EcohydroLib,代碼行數:17,代碼來源:landcover.py

示例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")
開發者ID:npp2016,項目名稱:EcohydroLib,代碼行數:22,代碼來源:test_metadata.py

示例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")
開發者ID:dblodgett-usgs,項目名稱:EcohydroLib,代碼行數:26,代碼來源:test_metadata.py

示例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']
開發者ID:npp2016,項目名稱:EcohydroLib,代碼行數:33,代碼來源:GetSSURGOFeaturesForBoundingbox.py


注:本文中的ecohydrolib.metadata.GenericMetadata.readManifestEntries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。