当前位置: 首页>>代码示例>>Python>>正文


Python Nansat.get_transect方法代码示例

本文整理汇总了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()
开发者ID:WYC19910220,项目名称:nansat,代码行数:10,代码来源:test_nansat.py

示例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)
开发者ID:WYC19910220,项目名称:nansat,代码行数:12,代码来源:test_nansat.py

示例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)
开发者ID:,项目名称:,代码行数:12,代码来源:

示例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)
开发者ID:WYC19910220,项目名称:nansat,代码行数:14,代码来源:test_nansat.py

示例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)
开发者ID:,项目名称:,代码行数:15,代码来源:

示例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)
开发者ID:,项目名称:,代码行数:17,代码来源:

示例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)
开发者ID:WYC19910220,项目名称:nansat,代码行数:19,代码来源:test_nansat.py

示例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)
开发者ID:,项目名称:,代码行数:20,代码来源:

示例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
开发者ID:yuxiaobu,项目名称:nansat,代码行数:31,代码来源:tutorial.py

示例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
开发者ID:yuxiaobu,项目名称:nansat,代码行数:33,代码来源:test_nansat.py


注:本文中的nansat.Nansat.get_transect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。