• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python domain.Domain类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nansat.domain.Domain的典型用法代码示例。如果您正苦于以下问题:Python Domain类的具体用法?Python Domain怎么用?Python Domain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_reproject_GCPs_auto

    def test_reproject_GCPs_auto(self):
        ds = gdal.Open(self.test_file)
        d = Domain(ds=ds)
        d.reproject_GCPs()

        gcpproj = NSR(d.vrt.dataset.GetGCPProjection())
        self.assertEqual(gcpproj.GetAttrValue("PROJECTION"), "Stereographic")
开发者ID:nansencenter,项目名称:nansat,代码行数:7,代码来源:test_domain.py


示例2: test_reproject_gcps

 def test_reproject_gcps(self):
     ds = gdal.Open(self.test_file)
     d = Domain(ds=ds)
     d.reproject_gcps('+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=75 +lon_0=10 +no_defs')
     gcp = d.vrt.dataset.GetGCPs()[0]
     self.assertTrue(gcp.GCPX > 636161)
     self.assertTrue(gcp.GCPY < -288344)
开发者ID:nansencenter,项目名称:nansat,代码行数:7,代码来源:test_domain.py


示例3: test_get_border_dateline

 def test_get_border_dateline(self):
     dom = Domain('+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=0 +lon_0=-179 +no_defs',
                  '-te -1000000 -1000 1000000 1000 -ts 10 10')
     brd = dom.get_border()
     self.assertTrue(np.all(brd[0] > 0))
     brd = dom.get_border(fix_lon=False)
     self.assertTrue(brd[0].min() < 0)
开发者ID:nansencenter,项目名称:nansat,代码行数:7,代码来源:test_domain.py


示例4: test_get_geolocation_grids

    def test_get_geolocation_grids(self):
        d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
        lon, lat = d.get_geolocation_grids()

        self.assertEqual(type(lon), np.ndarray)
        self.assertEqual(type(lat), np.ndarray)
        self.assertEqual(lat.shape, (500, 500))
开发者ID:nansencenter,项目名称:nansat,代码行数:7,代码来源:test_domain.py


示例5: test_get_geolocation_grids_from_geolocationArray

 def test_get_geolocation_grids_from_geolocationArray(self):
     lat, lon = np.mgrid[25:35:0.02, 70:72:0.004]
     d = Domain(lon=lon, lat=lat)
     lon, lat = d.get_geolocation_grids()
     self.assertEqual(type(lon), np.ndarray)
     self.assertEqual(type(lat), np.ndarray)
     self.assertEqual(lat.shape, (500, 500))
开发者ID:nansencenter,项目名称:nansat,代码行数:7,代码来源:test_domain.py


示例6: test_get_row_col_vector

 def test_get_row_col_vector(self):
     test_1 = Domain._get_row_col_vector(250, 500)
     self.assertIsInstance(test_1, list)
     self.assertEqual(test_1, list(range(251)))
     self.assertEqual(len(test_1), 251)
     test_2 = Domain._get_row_col_vector(500, 10)
     self.assertEqual(test_2, list(range(0, 550, 50)))
     self.assertEqual(len(test_2), 10 + 1)
开发者ID:nansencenter,项目名称:nansat,代码行数:8,代码来源:test_domain.py


示例7: test_transform_points_dstsrs

    def test_transform_points_dstsrs(self):
        d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
        lon, lat = d.transform_points(
            [1, 2, 3], [1, 2, 3], dstSRS=NSR("+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=75 +lon_0=10 +no_defs")
        )

        self.assertEqual(type(lon), np.ndarray)
        self.assertEqual(type(lat), np.ndarray)
开发者ID:nansencenter,项目名称:nansat,代码行数:8,代码来源:test_domain.py


示例8: test_write_map_labels

    def test_write_map_labels(self):
        d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
        tmpfilename = os.path.join(ntd.tmp_data_path, "domain_write_map_labels.png")
        d.write_map(tmpfilename, merLabels=[False, False, False, True], parLabels=[True, False, False, False])

        self.assertTrue(os.path.exists(tmpfilename))
        i = Image.open(tmpfilename)
        i.verify()
开发者ID:nansencenter,项目名称:nansat,代码行数:8,代码来源:test_domain.py


示例9: test_transform_tr

 def test_transform_tr(self):
     result = Domain._transform_tr(4.0, 1.3, [0.015, 0.005])
     self.assertIsInstance(result, tuple)
     self.assertEquals(len(result), 4)
     map(lambda el: self.assertIsInstance(el, float), result)
     with self.assertRaises(ValueError) as param_err:
         Domain._transform_tr(4.0, 1.3, [5.0, 0.005])
         self.assertEqual(param_err.message,
                          '"-tr" is too large. width is 4.0, height is 1.3 ')
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_domain.py


示例10: test_gen_regexp

 def test_gen_regexp(self):
     test_1 = '(-te|-lle)(\\s+[-+]?\\d*[.\\d*]*)(\\s+[-+]?\\d*[.\\d*]*)(\\s+[-+]?' \
              '\\d*[.\\d*]*)(\\s+[-+]?\\d*[.\\d*]*)\\s?'
     result_1 = Domain._gen_regexp('te', 'lle', 4)
     self.assertIsInstance(result_1, str)
     self.assertEqual(result_1, test_1)
     test_2 = '(-ts|-tr)(\\s+[-+]?\\d*[.\\d*]*)(\\s+[-+]?\\d*[.\\d*]*)\\s?'
     result_2 = Domain._gen_regexp('ts', 'tr', 2)
     self.assertEqual(result_2, test_2)
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_domain.py


示例11: test_write_map_dpi100

    def test_write_map_dpi100(self):
        d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
        tmpfilename = os.path.join(ntd.tmp_data_path, "domain_write_map_dpi100.png")
        d.write_map(tmpfilename, dpi=100)

        self.assertTrue(os.path.exists(tmpfilename))
        i = Image.open(tmpfilename)
        i.verify()
        self.assertEqual(i.info["dpi"], (100, 100))
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_domain.py


示例12: test_get_geolocation_grids_from_GDAL_transformer

 def test_get_geolocation_grids_from_GDAL_transformer(self, mock_transform_points):
     mock_transform_points.return_value=(
                   np.meshgrid(range(0,500),range(0,500))[0].flatten()*(35-25)/500.+25,
                   np.meshgrid(range(0,500),range(0,500))[1].flatten()*(70-72)/500.+72)
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     lon, lat = d.get_geolocation_grids()
     self.assertEqual(type(lon), np.ndarray)
     self.assertEqual(type(lat), np.ndarray)
     self.assertEqual(lat.shape, (500, 500))
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_domain.py


示例13: test_get_pixelsize_meters

 def test_get_pixelsize_meters(self):
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     x, y = d.get_pixelsize_meters()
     self.assertEqual(int(x), 444)
     self.assertEqual(int(y), 723)
     d = Domain(ds=gdal.Open(self.test_file_projected))
     x, y = d.get_pixelsize_meters()
     self.assertEqual(int(x), 500)
     self.assertEqual(int(y), 500)
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_domain.py


示例14: test_get_border

    def test_get_border(self):
        d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
        lon, lat = d.get_border()

        self.assertEqual(type(lon), np.ndarray)
        self.assertEqual(type(lat), np.ndarray)
        self.assertEqual(len(lat), 44)
        self.assertEqual(lat[0], lat[-1])
        self.assertEqual(lon[0], lon[-1])
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_domain.py


示例15: test_get_min_max_lon_lat

 def test_get_min_max_lon_lat(self):
     dom = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     result = dom.get_min_max_lon_lat()
     self.assertIsInstance(result, tuple)
     self.assertEqual(len(result), 4)
     for el in result:
         self.assertIsInstance(el, float)
     self.assertLess(result[0], result[1])
     self.assertLess(result[2], result[3])
     self.assertEqual(result, (25.0, 34.980000000000004, 70.004000000000005, 72.0))
开发者ID:nansencenter,项目名称:nansat,代码行数:10,代码来源:test_domain.py


示例16: test_write_domain_map

 def test_write_domain_map(self):
     plt.switch_backend('Agg')
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     border = d.get_border()
     tmpfilename = os.path.join(ntd.tmp_data_path, 'domain_write_map.png')
     write_domain_map(border, tmpfilename, labels=['Patch1'])
     self.assertTrue(os.path.exists(tmpfilename))
     i = Image.open(tmpfilename)
     i.verify()
     self.assertEqual(i.info['dpi'], (50, 50))
开发者ID:nansencenter,项目名称:nansat,代码行数:10,代码来源:test_tools.py


示例17: test_overlaps_contains

 def test_overlaps_contains(self):
     Bergen = Domain(4326, "-te 5 60 6 61 -ts 500 500")
     WestCoast = Domain(4326, "-te 1 58 6 64 -ts 500 500")
     Norway = Domain(4326, "-te 3 55 30 72 -ts 500 500")
     Paris = Domain(4326, "-te 2 48 3 49 -ts 500 500")
     self.assertTrue(Bergen.overlaps(Norway))
     self.assertTrue(Norway.contains(Bergen))
     self.assertFalse(Bergen.contains(Norway))
     self.assertTrue(Norway.overlaps(WestCoast))
     self.assertFalse(Norway.contains(WestCoast))
     self.assertFalse(Paris.overlaps(Norway))
     self.assertFalse(Paris.contains(Norway))
开发者ID:nansencenter,项目名称:nansat,代码行数:12,代码来源:test_domain.py


示例18: test_write_domain_map_labels

 def test_write_domain_map_labels(self):
     plt.switch_backend('Agg')
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     border = d.get_border()
     tmpfilename = os.path.join(ntd.tmp_data_path,
                                'domain_write_map_labels.png')
     write_domain_map(border, tmpfilename,
                 mer_labels=[False, False, False, True],
                 par_labels=[True, False, False, False])
     self.assertTrue(os.path.exists(tmpfilename))
     i = Image.open(tmpfilename)
     i.verify()
开发者ID:nansencenter,项目名称:nansat,代码行数:12,代码来源:test_tools.py


示例19: test_get_border_postgis

 def test_get_border_postgis(self):
     d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
     result = d.get_border_postgis()
     self.assertIsInstance(result, str)
     self.assertEquals(result, "PolygonFromText('POLYGON((25.0 72.0,26.0 72.0,27.0 72.0,28.0 "
                               "72.0,29.0 72.0,30.0 72.0,31.0 72.0,32.0 72.0,33.0 72.0,34.0 "
                               "72.0,35.0 72.0,35.0 72.0,35.0 71.8,35.0 71.6,35.0 71.4,35.0 "
                               "71.2,35.0 71.0,35.0 70.8,35.0 70.6,35.0 70.4,35.0 70.2,35.0 "
                               "70.0,35.0 70.0,34.0 70.0,33.0 70.0,32.0 70.0,31.0 70.0,30.0 "
                               "70.0,29.0 70.0,28.0 70.0,27.0 70.0,26.0 70.0,25.0 70.0,25.0 "
                               "70.0,25.0 70.2,25.0 70.4,25.0 70.6,25.0 70.8,25.0 71.0,25.0 "
                               "71.2,25.0 71.4,25.0 71.6,25.0 71.8,25.0 72.0))')")
开发者ID:nansencenter,项目名称:nansat,代码行数:12,代码来源:test_domain.py


示例20: test_init_lonlat

    def test_init_lonlat(self):
        lat, lon = np.mgrid[-90:90:0.5, -180:180:0.5]
        with warnings.catch_warnings(record=True) as recorded_warnings:
            d = Domain(lon=lon, lat=lat)

        nansat_warning_raised = False
        for rw in recorded_warnings:
            if rw.category == NansatFutureWarning:
                nansat_warning_raised = True
        self.assertTrue(nansat_warning_raised)

        self.assertEqual(type(d), Domain)
        self.assertEqual(d.shape(), lat.shape)
开发者ID:nansencenter,项目名称:nansat,代码行数:13,代码来源:test_domain.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vrt.VRT类代码示例发布时间:2022-05-27
下一篇:
Python nansat.Nansat类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap