本文整理汇总了Python中nansat.Nansat.get_transect方法的典型用法代码示例。如果您正苦于以下问题:Python Nansat.get_transect方法的具体用法?Python Nansat.get_transect怎么用?Python Nansat.get_transect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nansat.Nansat
的用法示例。
在下文中一共展示了Nansat.get_transect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_no_transect_interactive
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
def test_get_no_transect_interactive(self):
import matplotlib.pyplot as plt
plt.ion()
n1 = Nansat(self.test_file_gcps, logLevel=40)
noneResult = n1.get_transect()
self.assertEqual(noneResult, None)
plt.ioff()
示例2: test_get_transect_false
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
def test_get_transect_false(self):
n1 = Nansat(self.test_file_gcps, logLevel=40)
v, xy, pl = n1.get_transect([(28.31299128, 70.93709219),
(28.93691525, 70.69646524)])
self.assertEqual(len(v['1:L_645']), 2)
self.assertEqual(len(v['1:L_645']), len(xy))
self.assertEqual(len(v['1:L_645']), len(pl))
self.assertEqual(type(xy['shape0']['latitude']), np.ndarray)
self.assertEqual(type(pl['shape0'][0]), np.ndarray)
示例3: test_get_transect_wrong_band
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
def test_get_transect_wrong_band(self):
n1 = Nansat(self.test_file_gcps, logLevel=40)
t = n1.get_transect([[0, 28.31299128], [0, 70.93709219]], [10])
self.assertTrue('line' in t.dtype.fields)
self.assertTrue('pixel' in t.dtype.fields)
self.assertTrue('lat' in t.dtype.fields)
self.assertTrue('lon' in t.dtype.fields)
self.assertEqual(type(t['lat']), np.ndarray)
self.assertEqual(type(t['lon']), np.ndarray)
示例4: test_get_transect_outside
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
def test_get_transect_outside(self):
n1 = Nansat(self.test_file_gcps, logLevel=40)
v, xy, pl = n1.get_transect([[(28.31299128, 70.93709219),
(0.0, 0.0)]])
self.assertTrue(len(v['1:L_645']['shape0']) > 50)
self.assertEqual(len(v['1:L_645']['shape0']),
len(xy['shape0']['latitude']))
self.assertEqual(len(v['1:L_645']['shape0']),
len(pl['shape0'][0]))
self.assertEqual(type(xy['shape0']['latitude']), np.ndarray)
self.assertEqual(type(pl['shape0'][0]), np.ndarray)
示例5: test_get_transect_data
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
def test_get_transect_data(self):
n1 = Nansat(self.test_file_gcps, logLevel=40)
b1 = n1[1]
t = n1.get_transect([[28.3], [70.9]], [], data=b1)
self.assertTrue('input' in t.dtype.fields)
self.assertTrue('L_645' not in t.dtype.fields)
self.assertTrue('line' in t.dtype.fields)
self.assertTrue('pixel' in t.dtype.fields)
self.assertTrue('lat' in t.dtype.fields)
self.assertTrue('lon' in t.dtype.fields)
self.assertEqual(type(t['lat']), np.ndarray)
self.assertEqual(type(t['lon']), np.ndarray)
示例6: test_get_transect_pixlin
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
def test_get_transect_pixlin(self):
n1 = Nansat(self.test_file_gcps, logLevel=40)
t = n1.get_transect([[10, 20],
[10, 10]],
['L_645'],
lonlat=False)
self.assertTrue('L_645' in t.dtype.fields)
self.assertTrue('line' in t.dtype.fields)
self.assertTrue('pixel' in t.dtype.fields)
self.assertTrue('lat' in t.dtype.fields)
self.assertTrue('lon' in t.dtype.fields)
self.assertEqual(type(t['lat']), np.ndarray)
self.assertEqual(type(t['lon']), np.ndarray)
self.assertEqual(len(t['lon']), 11)
示例7: test_get_transect
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
def test_get_transect(self):
n1 = Nansat(self.test_file_gcps, logLevel=40)
v, xy, pl = n1.get_transect([[(28.31299128, 70.93709219),
(28.93691525, 70.69646524)]])
tmpfilename = os.path.join(ntd.tmp_data_path,
'nansat_get_transect.png')
plt.plot(v['1:L_645']['shape0'], xy['shape0']['latitude'])
plt.savefig(tmpfilename)
plt.close('all')
self.assertTrue(len(v['1:L_645']['shape0']) > 50)
self.assertEqual(len(v['1:L_645']['shape0']),
len(xy['shape0']['latitude']))
self.assertEqual(len(v['1:L_645']['shape0']),
len(pl['shape0'][0]))
self.assertEqual(type(xy['shape0']['latitude']), np.ndarray)
self.assertEqual(type(pl['shape0'][0]), np.ndarray)
示例8: test_get_transect
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
def test_get_transect(self):
n1 = Nansat(self.test_file_gcps, logLevel=40)
t = n1.get_transect([[28.31299128, 28.93691525],
[70.93709219, 70.69646524]],
['L_645'])
tmpfilename = os.path.join(ntd.tmp_data_path,
'nansat_get_transect.png')
plt.plot(t['lat'], t['L_645'], '.-')
plt.savefig(tmpfilename)
plt.close('all')
self.assertTrue('L_645' in t.dtype.fields)
self.assertTrue('line' in t.dtype.fields)
self.assertTrue('pixel' in t.dtype.fields)
self.assertTrue('lat' in t.dtype.fields)
self.assertTrue('lon' in t.dtype.fields)
self.assertEqual(type(t['lat']), np.ndarray)
self.assertEqual(type(t['lon']), np.ndarray)
示例9: Domain
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
# Write indexed picture with data from the first band
n.write_figure(oFileName + '.png', clim='hist')
# Reproject input image onto map of Norwegian Coast
# 1. Create domain describing the desired map
# 2. Transform the original satellite image
# 3. Write the transfromed image into RGB picture
dLatlong = Domain("+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs",
"-te 27 70.2 31 71.5 -ts 500 500")
n.reproject(dLatlong)
n.write_figure(oFileName + 'pro.png', bands=[1, 2, 3], clim=[0, 100])
# Export projected satelite image into NetCDF format
n.export(oFileName + '.nc')
# Collect values from interactively drawn transect
# 1. draw transect interactively
# 2. plot the values
values, lonlat, pixlinCoord = n.get_transect()
plt.plot(lonlat[0], values[0], '.-'); plt.show()
# run tests of other nansat components
import test_domain
import test_nansat
import test_figure
import test_nansatmap
import test_nansatshape
import test_mosaic
import test_pointbrowser
示例10: watermask
# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_transect [as 别名]
n.export_band(oFileName + '07.tif', bandID=1, driver='GTiff')
# get array with watermask (landmask)
# -- Get Nansat object with watermask
wm = n.watermask()[1]
# -- Reproject with cubic interpolation
d = Domain(4326, "-te 27 70.3 31 71.5 -ts 300 300")
n.reproject(d, 2)
# -- Write image
n.write_figure(oFileName + '08_pro.png', clim='hist')
# Get transect of the 1st and 2nd bands corresponding to the given points
values, lonlat, pixlinCoord = n.get_transect(
points=((29.287, 71.153),
(29.275, 71.145),
(29.210, 71.154)),
transect=False,
bandList=[1, 2])
# print the results
print '1stBandVal 2ndBandVal pix/lin lon/lat '
for i in range (len(values[0])):
print '%6d %10d %13.2f /%6.2f %7.2f /%6.2f' % (values[0][i],
values[1][i],
pixlinCoord[0][i],
pixlinCoord[1][i],
lonlat[0][i],
lonlat[1][i])
print ''
print '\n***nansat_test completed successfully. Output files are found here:' + oFileName