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


Python IonObject.geospatial_longitude_limit_east方法代码示例

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


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

示例1: _do_test_create_geospatial_point_center

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import geospatial_longitude_limit_east [as 别名]
    def _do_test_create_geospatial_point_center(self, resources):
        platformsite_obj = IonObject(RT.PlatformSite,
                                        name='TestPlatformSite',
                                        description='some new TestPlatformSite')
        geo_index_obj = IonObject(OT.GeospatialBounds)
        geo_index_obj.geospatial_latitude_limit_north = 20.0
        geo_index_obj.geospatial_latitude_limit_south = 10.0
        geo_index_obj.geospatial_longitude_limit_east = 15.0
        geo_index_obj.geospatial_longitude_limit_west = 20.0
        platformsite_obj.constraint_list = [geo_index_obj]

        platformsite_id = self.OMS.create_platform_site(platformsite_obj)

        # now get the dp back to see if it was updated
        platformsite_obj = self.OMS.read_platform_site(platformsite_id)
        self.assertEquals('some new TestPlatformSite', platformsite_obj.description)
        self.assertAlmostEqual(15.0, platformsite_obj.geospatial_point_center.lat, places=1)


        #now adjust a few params
        platformsite_obj.description = 'some old TestPlatformSite'
        geo_index_obj = IonObject(OT.GeospatialBounds)
        geo_index_obj.geospatial_latitude_limit_north = 30.0
        geo_index_obj.geospatial_latitude_limit_south = 20.0
        platformsite_obj.constraint_list = [geo_index_obj]
        update_result = self.OMS.update_platform_site(platformsite_obj)

        # now get the dp back to see if it was updated
        platformsite_obj = self.OMS.read_platform_site(platformsite_id)
        self.assertEquals('some old TestPlatformSite', platformsite_obj.description)
        self.assertAlmostEqual(25.0, platformsite_obj.geospatial_point_center.lat, places=1)

        self.OMS.force_delete_platform_site(platformsite_id)
开发者ID:shenrie,项目名称:coi-services,代码行数:35,代码来源:test_observatory_management_service_integration.py

示例2: test_midpoint

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import geospatial_longitude_limit_east [as 别名]
    def test_midpoint(self):
        geospatial_bounds = IonObject("GeospatialBounds")
        geospatial_bounds.geospatial_latitude_limit_north = 10
        geospatial_bounds.geospatial_latitude_limit_south = -10
        geospatial_bounds.geospatial_longitude_limit_east = 10
        geospatial_bounds.geospatial_longitude_limit_west = -10

        # Basic test
        #TODO. do we really want calc_geospatial_point_center() to return string?
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lat, 0.0)
        self.assertAlmostEqual(mid_point.lon, 0.0)

        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds, distance=GeoUtils.DISTANCE_SHORTEST)
        self.assertAlmostEqual(mid_point.lat, 0.0)
        self.assertAlmostEqual(mid_point.lon, 0.0)

        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds, distance=GeoUtils.DISTANCE_LONGEST)
        self.assertAlmostEqual(mid_point.lat, 0.0)
        self.assertAlmostEqual(mid_point.lon, -180)


        geospatial_bounds.geospatial_latitude_limit_north = 10
        geospatial_bounds.geospatial_latitude_limit_south = -10
        geospatial_bounds.geospatial_longitude_limit_east = 179
        geospatial_bounds.geospatial_longitude_limit_west = -179

        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lat, 0.0)
        self.assertAlmostEqual(mid_point.lon, 0.0)
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds, distance=GeoUtils.DISTANCE_SHORTEST)
        self.assertAlmostEqual(mid_point.lat, 0.0)
        self.assertAlmostEqual(mid_point.lon, -180.0)
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds, distance=GeoUtils.DISTANCE_LONGEST)
        self.assertAlmostEqual(mid_point.lat, 0.0)
        self.assertAlmostEqual(mid_point.lon, 0.0)
        geospatial_bounds.geospatial_longitude_limit_east = -179
        geospatial_bounds.geospatial_longitude_limit_west = 179
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lon, -180.0)


        geospatial_bounds.geospatial_latitude_limit_north = 90
        geospatial_bounds.geospatial_latitude_limit_south = -90
        geospatial_bounds.geospatial_longitude_limit_east = 0
        geospatial_bounds.geospatial_longitude_limit_west = 0
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lat, 0.0)
        self.assertAlmostEqual(mid_point.lon, 0.0)
        # MM: changed this: if the same values are given, we expect a point not the full globe
        #self.assertAlmostEqual(mid_point.lon, -180.0)

        geospatial_bounds.geospatial_latitude_limit_north = 40
        geospatial_bounds.geospatial_latitude_limit_south = 50
        geospatial_bounds.geospatial_longitude_limit_east = -75
        geospatial_bounds.geospatial_longitude_limit_west = -125
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lat, 47.801397, 6)
        self.assertAlmostEqual(mid_point.lon, -102.328727, 6)
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds, distance=GeoUtils.DISTANCE_SHORTEST)
        self.assertAlmostEqual(mid_point.lat, 47.801397, 6)
        self.assertAlmostEqual(mid_point.lon, -102.328727, 6)

        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds, distance=GeoUtils.DISTANCE_LONGEST)
        self.assertAlmostEqual(mid_point.lat, 47.801397, 6)
        self.assertAlmostEqual(mid_point.lon, 77.671273, 6)

        geospatial_bounds.geospatial_longitude_limit_west = 165
        geospatial_bounds.geospatial_latitude_limit_north = 5
        geospatial_bounds.geospatial_longitude_limit_east = -170
        geospatial_bounds.geospatial_latitude_limit_south = 5
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lat, 5.121583, 6)
        self.assertAlmostEqual(mid_point.lon, 177.5, 6)

        geospatial_bounds.geospatial_longitude_limit_west = 65
        geospatial_bounds.geospatial_latitude_limit_north = 0
        geospatial_bounds.geospatial_longitude_limit_east = 165
        geospatial_bounds.geospatial_latitude_limit_south = 0
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lat, 0.0, 6)
        self.assertAlmostEqual(mid_point.lon, 115.0, 6)

        geospatial_bounds.geospatial_longitude_limit_west = 10.0
        geospatial_bounds.geospatial_latitude_limit_north = 0
        geospatial_bounds.geospatial_longitude_limit_east = -150
        geospatial_bounds.geospatial_latitude_limit_south = 0
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lat, 0.0, 6)
        self.assertAlmostEqual(mid_point.lon, 110.0, 6)

        geospatial_bounds.geospatial_longitude_limit_west = -150
        geospatial_bounds.geospatial_latitude_limit_north = 0
        geospatial_bounds.geospatial_longitude_limit_east = 170
        geospatial_bounds.geospatial_latitude_limit_south = 0
        mid_point = GeoUtils.calc_geospatial_point_center(geospatial_bounds)
        self.assertAlmostEqual(mid_point.lat, 0.0, 6)
        self.assertAlmostEqual(mid_point.lon, 10.0, 6)

        geospatial_bounds.geospatial_longitude_limit_west = 30
#.........这里部分代码省略.........
开发者ID:Bobfrat,项目名称:coi-services,代码行数:103,代码来源:test_geo_utils.py


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