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


Python Nansat.export方法代码示例

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


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

示例1: test_export_netcdf_arctic_hardcopy

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
 def test_export_netcdf_arctic_hardcopy(self):
     n = Nansat(self.test_file_arctic, mapper=self.default_mapper)
     n.export(self.tmp_filename, hardcopy=True)
     exported = Nansat(self.tmp_filename, mapper=self.default_mapper)
     self.assertTrue((n[1] == exported[1]).any())
     self.assertTrue((n[2] == exported[2]).any())
     self.assertTrue((n[3] == exported[3]).any())
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_exporter.py

示例2: make_reproject

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
def make_reproject(path, final_path, file_name, show='off'):
    """
    Функция для перепроецирования снимков согласно параметрам указываемым в dom.
    После перепроецирования к файлу снимку генерируется и добавляется маска
    :param path: Путь до папки в которой лежит файл
    :param final_path: Путь до папки в которую нужно положить перепроецированный файл
    :param file_name: Имя файла (исходного)
    :param show: Флаг для отрисовки [2] канала. По умолчанию 'off', чтобы включить show='on'
    :return: Перепроецированный файл с иходным file_name
    """
    print path + file_name
    nansat_obj = Nansat(path + file_name)
    #  Для маленького конечного куска
    #dom = Domain('+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs', '-lle -86.20 45.10 -86.10 45.20 -ts 300 300')
    #   Для всего района
    dom = Domain('+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs', '-lle -86.3 44.6 -85.2 45.3 -ts 300 200')
    nansat_obj.reproject(dom)
    nansat_obj = create_mask(nansat_obj)

    if show == 'on':
        plt.imshow(nansat_obj[2])
        plt.colorbar()
        plt.show()

    nansat_obj.export(final_path + file_name + '.reproject.nc')
开发者ID:korvinos,项目名称:work,代码行数:27,代码来源:custrepr.py

示例3: test_export_gcps_complex_to_netcdf

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [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

示例4: test_export_netcdf_complex_remove_meta

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
 def test_export_netcdf_complex_remove_meta(self):
     n = Nansat(self.test_file_complex, mapper=self.default_mapper)
     self.assertEqual(n.get_metadata('PRODUCT_TYPE'), 'SLC')
     n.export(self.tmp_filename, rm_metadata=['PRODUCT_TYPE'])
     exported = Nansat(self.tmp_filename, mapper=self.default_mapper)
     with self.assertRaises(ValueError):
         exported.get_metadata('PRODUCT_TYPE')
     self.assertTrue((n[1] == exported[1]).any())
开发者ID:nansencenter,项目名称:nansat,代码行数:10,代码来源:test_exporter.py

示例5: test_export_band

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
    def test_export_band(self):
        n = Nansat(self.test_file_gcps, logLevel=40)
        tmpfilename = os.path.join(ntd.tmp_data_path,
                                   'nansat_export_band.tif')
        n.export(tmpfilename, bands= [1], driver='GTiff')
        n = Nansat(tmpfilename, mapperName='generic')

        self.assertTrue(os.path.exists(tmpfilename))
        self.assertEqual(n.vrt.dataset.RasterCount, 1)
开发者ID:WYC19910220,项目名称:nansat,代码行数:11,代码来源:test_nansat.py

示例6: test_export_band_by_name

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
    def test_export_band_by_name(self):
        n = Nansat(self.test_file_gcps, log_level=40, mapper=self.default_mapper)
        tmpfilename = os.path.join(self.tmp_data_path,
                                   'nansat_export_band.tif')
        n.export(tmpfilename, bands=['L_645'], driver='GTiff')
        n = Nansat(tmpfilename, mapper=self.default_mapper)

        self.assertTrue(os.path.exists(tmpfilename))
        self.assertEqual(n.vrt.dataset.RasterCount, 1)
开发者ID:nansencenter,项目名称:nansat,代码行数:11,代码来源:test_exporter.py

示例7: test_special_characters_in_exported_metadata

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
 def test_special_characters_in_exported_metadata(self):
     orig = Nansat(self.test_file_gcps, mapper=self.default_mapper)
     orig.vrt.dataset.SetMetadataItem('jsonstring', json.dumps({'meta1':
                                      'hei', 'meta2': 'derr'}))
     orig.export(self.tmp_filename)
     copy = Nansat(self.tmp_filename, mapper=self.default_mapper)
     dd = json.loads(unescape(copy.get_metadata('jsonstring'), {'"':
                                                                '"'}))
     self.assertIsInstance(dd, dict)
开发者ID:nansencenter,项目名称:nansat,代码行数:11,代码来源:test_exporter.py

示例8: boreali_processing

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
def boreali_processing(obj,  final_path):
    wavelen = [412, 443, 469, 488, 531, 547, 555, 645, 667, 678]
    cpa_limits = [0.01, 2,
                  0.01, 1,
                  0.01, 1, 10]
    b = Boreali('michigan', wavelen)

    n = Nansat(obj)
    dom = Domain('+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs', '-lle -86.3 44.6 -85.2 45.3 -ts 300 200')
    n.reproject(dom)
    theta = numpy.zeros_like(n[2])
    custom_n = Nansat(domain=n)
    band_rrs_numbers = list(map(lambda x: n._get_band_number('Rrs_' + str(x)),
                                wavelen))

    for index in range(0, len(wavelen)):
        # Преобразуем в Rrsw
        rrsw = n[band_rrs_numbers[index]] / (0.52 + 1.7 * n[band_rrs_numbers[index]])
        custom_n.add_band(rrsw, parameters={'name': 'Rrsw_' + str(wavelen[index]),
                                            'units': 'sr-1',
                                            'wavelength': wavelen[index]})

    custom_n = create_mask(custom_n)
    cpa = b.process(custom_n, cpa_limits, mask=custom_n['mask'], theta=theta, threads=4)

    custom_n.add_band(array=cpa[0], parameters={'name': 'chl',
                                                'long_name': 'Chlorophyl-a',
                                                'units': 'mg m-3'})
    custom_n.add_band(array=cpa[1], parameters={'name': 'tsm',
                                                'long_name': 'Total suspended matter',
                                                'units': 'g m-3'})
    custom_n.add_band(array=cpa[2], parameters={'name': 'doc',
                                                'long_name': 'Dissolved organic carbon',
                                                'units': 'gC m-3'})
    custom_n.add_band(array=cpa[3], parameters={'name': 'mse',
                                                'long_name': 'Root Mean Square Error',
                                                'units': 'sr-1'})
    custom_n.add_band(array=cpa[4], parameters={'name': 'mask',
                                                'long_name': 'L2 Boreali mask',
                                                'units': '1'})

    custom_n.export(final_path + obj.split('/')[-1] + 'cpa_deep.nc')

    fig_params = {'legend': True,
                  'LEGEND_HEIGHT': 0.5,
                  'NAME_LOCATION_Y': 0,
                  'mask_array': cpa[4],
                  'mask_lut': {1: [255, 255, 255], 2: [128, 128, 128], 4: [200, 200, 255]}}
    custom_n.write_figure(final_path + obj.split('/')[-1] + 'chl_deep.png', 'chl', clim=[0, 1.], **fig_params)
    custom_n.write_figure(final_path + obj.split('/')[-1] + 'tsm_deep.png', 'tsm', clim=[0, 1.], **fig_params)
    custom_n.write_figure(final_path + obj.split('/')[-1] + 'doc_deep.png', 'doc', clim=[0, .2], **fig_params)
    custom_n.write_figure(final_path + obj.split('/')[-1] + 'mse_deep.png', 'mse', clim=[1e-5, 1e-2], logarithm=True, **fig_params)
    n.write_figure(final_path + obj.split('/')[-1] + 'rgb_deep.png',
                   [16, 14, 6],
                   clim=[[0, 0, 0], [0.006, 0.04, 0.024]],
                   mask_array=cpa[4],
                   mask_lut={2: [128, 128, 128]})
开发者ID:korvinos,项目名称:work,代码行数:59,代码来源:custrepr.py

示例9: test_geolocation_of_exportedNC_vs_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [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

示例10: test_export_netcdf_arctic

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
 def test_export_netcdf_arctic(self):
     ''' Test export of the arctic data without GCPS
     '''
     n = Nansat(self.test_file_arctic)
     n.export(self.tmpfilename)
     exported = Nansat(self.tmpfilename)
     self.assertTrue((n[1] == exported[1]).any())
     self.assertTrue((n[2] == exported[2]).any())
     self.assertTrue((n[3] == exported[3]).any())
     os.unlink(self.tmpfilename)
开发者ID:,项目名称:,代码行数:12,代码来源:

示例11: geolocation_of_exportedNC_vs_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [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

示例12: test_export_netcdf_complex_remove_meta

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
 def test_export_netcdf_complex_remove_meta(self):
     ''' Test export of complex data with pixelfunctions
     '''
     n = Nansat(self.test_file_complex)
     self.assertEqual(n.get_metadata('PRODUCT_TYPE'), 'SLC')
     n.export(self.tmpfilename, rmMetadata=['PRODUCT_TYPE'])
     exported = Nansat(self.tmpfilename)
     with self.assertRaises(OptionError):
         exported.get_metadata('PRODUCT_TYPE')
     self.assertTrue((n[1] == exported[1]).any())
     os.unlink(self.tmpfilename)
开发者ID:,项目名称:,代码行数:13,代码来源:

示例13: test_reproject_and_export_band

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [as 别名]
    def test_reproject_and_export_band(self):
        n1 = Nansat(self.test_file_gcps, logLevel=40)
        n2 = Nansat(self.test_file_stere, logLevel=40)
        n1.reproject(n2)
        tmpfilename = os.path.join(ntd.tmp_data_path,
                                   'nansat_reproject_export_band.nc')
        n1.export(tmpfilename, bands=[1])

        n = Nansat(tmpfilename, mapperName='generic')
        self.assertTrue(os.path.exists(tmpfilename))
        self.assertEqual(n.vrt.dataset.RasterCount, 1)
开发者ID:,项目名称:,代码行数:13,代码来源:

示例14: test_geolocation_of_exportedNC_vs_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [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,代码来源:

示例15: test_geolocation_of_exportedNC_vs_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import export [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


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