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


Python domain.Domain类代码示例

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


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


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