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


Python Nansat.get_geolocation_grids方法代码示例

本文整理汇总了Python中nansat.Nansat.get_geolocation_grids方法的典型用法代码示例。如果您正苦于以下问题:Python Nansat.get_geolocation_grids方法的具体用法?Python Nansat.get_geolocation_grids怎么用?Python Nansat.get_geolocation_grids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nansat.Nansat的用法示例。


在下文中一共展示了Nansat.get_geolocation_grids方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_export_gcps_complex_to_netcdf

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_export_gcps_complex_to_netcdf(self):
        ''' Should export file with GCPs and write correct complex bands'''
        n0 = Nansat(self.test_file_gcps, logLevel=40)
        b0 = n0['L_469']

        n1 = Nansat(domain=n0)
        n1.add_band(b0.astype('complex64'),
                    parameters={'name': 'L_469'})

        tmpfilename = os.path.join(ntd.tmp_data_path, 'nansat_export_gcps_complex.nc')
        n1.export(tmpfilename)

        ncf = netcdf_file(tmpfilename)
        self.assertTrue(os.path.exists(tmpfilename))
        self.assertTrue('GCPX' in ncf.variables)
        self.assertTrue('GCPY' in ncf.variables)
        self.assertTrue('GCPPixel' in ncf.variables)
        self.assertTrue('GCPLine' in ncf.variables)

        n2 = Nansat(tmpfilename)
        b2 = n2['L_469']
        np.testing.assert_allclose(b0, b2)

        lon0, lat0 = n0.get_geolocation_grids()
        lon2, lat2 = n1.get_geolocation_grids()
        np.testing.assert_allclose(lon0, lon2)
        np.testing.assert_allclose(lat0, lat2)
开发者ID:WYC19910220,项目名称:nansat,代码行数:29,代码来源:test_nansat.py

示例2: test_geolocation_of_exportedNC_vs_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_geolocation_of_exportedNC_vs_original(self):
        """ Lon/lat in original and exported file should coincide """
        orig = Nansat(self.test_file_gcps, mapper=self.default_mapper)
        orig.export(self.tmp_filename)

        copy = Nansat(self.tmp_filename, mapper=self.default_mapper)
        lon0, lat0 = orig.get_geolocation_grids()
        lon1, lat1 = copy.get_geolocation_grids()
        np.testing.assert_allclose(lon0, lon1)
        np.testing.assert_allclose(lat0, lat1)
开发者ID:nansencenter,项目名称:nansat,代码行数:12,代码来源:test_exporter.py

示例3: geolocation_of_exportedNC_vs_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
 def geolocation_of_exportedNC_vs_original(self, file):
     orig = Nansat(file)
     testFile = "test.nc"
     orig.export(testFile)
     copy = Nansat(testFile)
     lon0, lat0 = orig.get_geolocation_grids()
     lon1, lat1 = copy.get_geolocation_grids()
     np.testing.assert_allclose(lon0, lon1)
     np.testing.assert_allclose(lat0, lat1)
     os.unlink(ncfile)
开发者ID:WYC19910220,项目名称:nansat,代码行数:12,代码来源:test_mappers.py

示例4: test_geolocation_of_exportedNC_vs_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_geolocation_of_exportedNC_vs_original(self):
        ''' Lon/lat in original and exported file should coincide '''
        orig = Nansat(self.test_file_gcps)
        tmpfilename = os.path.join(ntd.tmp_data_path, 'nansat_export_gcps.nc')
        orig.export(tmpfilename)

        copy = Nansat(tmpfilename)
        lon0, lat0 = orig.get_geolocation_grids()
        lon1, lat1 = copy.get_geolocation_grids()
        np.testing.assert_allclose(lon0, lon1)
        np.testing.assert_allclose(lat0, lat1)
开发者ID:WYC19910220,项目名称:nansat,代码行数:13,代码来源:test_nansat.py

示例5: test_geolocation_of_exportedNC_vs_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_geolocation_of_exportedNC_vs_original(self):
        ''' Lon/lat in original and exported file should coincide '''
        orig = Nansat(self.test_file_gcps)
        orig.export(self.tmpfilename)

        copy = Nansat(self.tmpfilename)
        lon0, lat0 = orig.get_geolocation_grids()
        lon1, lat1 = copy.get_geolocation_grids()
        np.testing.assert_allclose(lon0, lon1)
        np.testing.assert_allclose(lat0, lat1)
        os.unlink(self.tmpfilename)
开发者ID:,项目名称:,代码行数:13,代码来源:

示例6: test_get_auto_ticks_vector

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_get_auto_ticks_vector(self):
        n = Nansat(self.test_file_gcps)
        lon, lat = n.get_geolocation_grids()
        f = Figure(lon)
        lonTicks = f._get_auto_ticks([28, 29, 30, 100], lon)

        self.assertEqual(len(lonTicks), 3)
开发者ID:scollis,项目名称:nansat,代码行数:9,代码来源:test_figure.py

示例7: test_get_auto_ticks_number

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_get_auto_ticks_number(self):
        n = Nansat(self.test_file_gcps)
        lon, lat = n.get_geolocation_grids()
        f = Figure(lon)
        lonTicks = f._get_auto_ticks(5, lon)
        latTicks = f._get_auto_ticks(5, lat)

        self.assertEqual(len(lonTicks), 5)
        n.logger.error(str(lonTicks))
        n.logger.error(str(latTicks))
开发者ID:scollis,项目名称:nansat,代码行数:12,代码来源:test_figure.py

示例8: test_get_tick_index_from_grid

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_get_tick_index_from_grid(self):
        ''' Should return indeces of pixel closest to ticks '''
        n = Nansat(self.test_file_gcps)
        lon, lat = n.get_geolocation_grids()

        f = Figure(lon)
        lonTicksIdx = f._get_tick_index_from_grid([28.5, 29], lon, 1, lon.shape[1])
        latTicksIdx = f._get_tick_index_from_grid([71, 71.5], lat, lat.shape[0], 1)
        n.logger.error(str(lonTicksIdx))
        n.logger.error(str(latTicksIdx))
开发者ID:scollis,项目名称:nansat,代码行数:12,代码来源:test_figure.py

示例9: test_add_latlon_grids_auto

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_add_latlon_grids_auto(self):
        ''' Should create figure with lon/lat gridlines spaced automatically '''
        tmpfilename = os.path.join(ntd.tmp_data_path, 'figure_latlon_grids_auto.png')
        n = Nansat(self.test_file_gcps)
        b = n[1]
        lon, lat = n.get_geolocation_grids()

        f = Figure(b)
        f.process(clim='hist', lonGrid=lon, latGrid=lat)
        f.save(tmpfilename)

        self.assertEqual(type(f), Figure)
        self.assertTrue(os.path.exists(tmpfilename))
开发者ID:scollis,项目名称:nansat,代码行数:15,代码来源:test_figure.py

示例10: test_export_gcps_to_netcdf

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_export_gcps_to_netcdf(self):
        ''' Should export file with GCPs and write correct bands'''
        n0 = Nansat(self.test_file_gcps, logLevel=40)
        tmpfilename = os.path.join(ntd.tmp_data_path, 'nansat_export_gcps.nc')
        n0.export(tmpfilename)

        ncf = netcdf_file(tmpfilename)
        self.assertTrue(os.path.exists(tmpfilename))
        self.assertTrue('GCPX' in ncf.variables)
        self.assertTrue('GCPY' in ncf.variables)
        self.assertTrue('GCPPixel' in ncf.variables)
        self.assertTrue('GCPLine' in ncf.variables)

        n1 = Nansat(tmpfilename)
        b0 = n0['L_469']
        b1 = n1['L_469']
        np.testing.assert_allclose(b0, b1)

        lon0, lat0 = n0.get_geolocation_grids()
        lon1, lat1 = n1.get_geolocation_grids()
        np.testing.assert_allclose(lon0, lon1)
        np.testing.assert_allclose(lat0, lat1)
开发者ID:WYC19910220,项目名称:nansat,代码行数:24,代码来源:test_nansat.py

示例11: test_add_latlon_grids_list

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_add_latlon_grids_list(self):
        ''' Should create figure with lon/lat gridlines given manually '''
        tmpfilename = os.path.join(self.tmp_data_path, 'figure_latlon_grids_list.png')
        n = Nansat(self.test_file_gcps, mapper=self.default_mapper)
        b = n[1]
        lon, lat = n.get_geolocation_grids()

        f = Figure(b)
        f.process(clim='hist', lonGrid=lon,
                               latGrid=lat,
                               lonTicks=[28, 29, 30],
                               latTicks=[70.5, 71, 71.5, 73])
        f.save(tmpfilename)

        self.assertEqual(type(f), Figure)
        self.assertTrue(os.path.exists(tmpfilename))
开发者ID:nansencenter,项目名称:nansat,代码行数:18,代码来源:test_figure.py

示例12: test_add_latlon_grids_number

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
    def test_add_latlon_grids_number(self):
        ''' Should create figure with lon/lat gridlines given manually '''
        tmpfilename = os.path.join(self.tmp_data_path, 'figure_latlon_grids_number.png')
        n = Nansat(self.test_file_gcps, mapper=self.default_mapper)
        n.resize(3)
        b = n[1]
        lon, lat = n.get_geolocation_grids()

        f = Figure(b)
        f.process(cmax=100, lonGrid=lon,
                               latGrid=lat,
                               lonTicks=7,
                               latTicks=7)
        f.save(tmpfilename)

        self.assertEqual(type(f), Figure)
        self.assertTrue(os.path.exists(tmpfilename))
开发者ID:nansencenter,项目名称:nansat,代码行数:19,代码来源:test_figure.py

示例13: object

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_geolocation_grids [as 别名]
fig.save(oFileName + '03_title.png')

# Create a Figure object (fig)
fig = Figure(array)
# add logo to image to the lower left corner
# (make sure file is in the current folder)
fig.process(cmin=10, cmax=60, logoFileName='nansat_logo_s.png',
            logoLocation=[10, -35], logoSize=[20, 20],
            legend=True, LEGEND_HEIGHT=0.3)
# Save the figure
fig.save(oFileName + '04_logo.png')

# Create a Figure object (fig)
fig = Figure(array)
# Get lat/lon arrays from Nansat object (may take some time)
lonGrid, latGrid = n.get_geolocation_grids()
# Make figure with lat/lon grids
fig.process(cmin=10, cmax=60, latGrid=latGrid, lonGrid=lonGrid,
            latlonGridSpacing=10, latlonLabels=10)
# save the fig
fig.save(oFileName + '05_latlon.png', )

# Create a Figure object (fig)
fig = Figure(array)
# Get Nansat object with watermask
wm = n.watermask()
# Get array from Nansat object. 0 - land, 1 - water
wmArray = wm[1]
# Compute min and max valuse from ratio
clim = fig.clim_from_histogram(ratio=1.0)
# Make figure with land overlay (gray) and apply brightness gamma correction
开发者ID:yuxiaobu,项目名称:nansat,代码行数:33,代码来源:test_figure.py


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