本文整理汇总了Python中nansat.Nansat.set_metadata方法的典型用法代码示例。如果您正苦于以下问题:Python Nansat.set_metadata方法的具体用法?Python Nansat.set_metadata怎么用?Python Nansat.set_metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nansat.Nansat
的用法示例。
在下文中一共展示了Nansat.set_metadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_time_coverage_start_end
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import set_metadata [as 别名]
def test_get_time_coverage_start_end(self):
n = Nansat(self.test_file_gcps, logLevel=40)
n.set_metadata('time_coverage_start', '2016-01-20')
n.set_metadata('time_coverage_end', '2016-01-21')
self.assertEqual(type(n.time_coverage_start),
datetime.datetime)
self.assertEqual(type(n.time_coverage_end),
datetime.datetime)
示例2: test_time_coverage_metadata_of_exported_equals_original
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import set_metadata [as 别名]
def test_time_coverage_metadata_of_exported_equals_original(self):
orig = Nansat(self.test_file_gcps, mapper=self.default_mapper)
orig.set_metadata('time_coverage_start', '2010-01-02T08:49:02.347809')
orig.set_metadata('time_coverage_end', '2010-01-02T08:50:03.599373')
orig.export(self.tmp_filename)
copy = Nansat(self.tmp_filename, mapper=self.default_mapper)
self.assertEqual(orig.get_metadata('time_coverage_start'),
copy.get_metadata('time_coverage_start'))
self.assertEqual(orig.get_metadata('time_coverage_end'),
copy.get_metadata('time_coverage_end'))
示例3: test_export2thredds_longlat_list
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import set_metadata [as 别名]
def test_export2thredds_longlat_list(self):
d = Domain("+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs",
"-te 27 70 31 72 -ts 200 200")
n = Nansat(domain=d)
n.add_band(np.ones(d.shape(), np.float32),
parameters={'name': 'L_469'})
n.set_metadata('time_coverage_start', '2016-01-19')
tmpfilename = os.path.join(ntd.tmp_data_path,
'nansat_export2thredds_longlat.nc')
n.export2thredds(tmpfilename, ['L_469'])
ncI = netcdf_file(tmpfilename, 'r')
ncIVar = ncI.variables['L_469']
self.assertTrue(ncIVar.grid_mapping in ncI.variables.keys())
示例4: test_set_metadata_bandid
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import set_metadata [as 别名]
def test_set_metadata_bandid(self):
n1 = Nansat(self.test_file_stere, logLevel=40)
n1.set_metadata('newKey', 'newVal', 1)
m = n1.get_metadata('newKey', 1)
self.assertEqual(m, 'newVal')
示例5: Nansat
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import set_metadata [as 别名]
n = Nansat(iFileName)
# Open an input file, specify which Mapper to use, set logging level
n = Nansat(iFileName, mapperName='generic', logLevel=10)
# list bands and georeference of the object
print 'Raw Nansat:', n, '\n'
# get dictionary with metadata from all bands
print 'Bands:', n.bands(), '\n'
# get time of the image aquisition
print 'Time:', n.get_time()[0], '\n'
# set GlobalMetadata
n.set_metadata(key='GlobalKey', value='GlobalVal')
# get Global Metadata
print 'Global Metadata:', n.get_metadata(), '\n'
# set BandMetadata to the 1st band
n.set_metadata(key='BandKey', value='BandVal', bandID=1)
# get 1st Band Metadata
print '1st Band Metadata:', n.get_metadata(bandID=1), '\n'
# add a band from file (copy the 2nd band to the end (4th band)
n.add_band(fileName=n.fileName, bandID=2)
# add a band from numpy array (copy the 1st band to the end (5th band))
n.add_band(array=n[1], parameters={'name': 'Name1',
'info': 'copy from the 1st band array'})
# print band list
n.list_bands()