示例#1
0
def test_vertical_crs__chance_cs_axis(axis):
    vc = VerticalCRS(
        name="NAVD88 height",
        datum="North American Vertical Datum 1988",
        vertical_cs=VerticalCS(axis=axis),
    )
    assert vc.name == "NAVD88 height"
    assert vc.type_name == "Vertical CRS"
    assert vc.coordinate_system == VerticalCS(axis=axis)
def test_verticalcs_height_to_cf():
    vcs = VerticalCS(axis=VerticalCSAxis.GRAVITY_HEIGHT_US_FT)
    vcs.to_cf() == [{
        "standard_name": "height_above_reference_ellipsoid",
        "long_name": "Gravity-related height",
        "units": "0.304800609601219 metre",
        "positive": "up",
        "axis": "Z",
    }]
def test_verticalcs_depth_to_cf():
    vcs = VerticalCS(axis=VerticalCSAxis.DEPTH)
    vcs.to_cf() == [{
        "standard_name": "height_above_reference_ellipsoid",
        "long_name": "Depth",
        "units": "metre",
        "positive": "down",
        "axis": "Z",
    }]
示例#4
0
    def __init__(self,
                 name,
                 datum,
                 vertical_cs=VerticalCS(),
                 geoid_model=None):
        """
        Parameters
        ----------
        name: str
            The name of the Vertical CRS (e.g. NAVD88 height).
        datum: Any
            Anything accepted by :meth:`pyproj.crs.Datum.from_user_input`
        vertical_cs: Any, optional
            Input to create a Vertical Coordinate System accepted by
            :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or :class:`pyproj.crs.coordinate_system.VerticalCS`
        geoid_model: str, optional
            The name of the GEOID Model (e.g. GEOID12B).
        """
        vert_crs_json = {
            "$schema":
            "https://proj.org/schemas/v0.2/projjson.schema.json",
            "type":
            "VerticalCRS",
            "name":
            name,
            "datum":
            Datum.from_user_input(datum).to_json_dict(),
            "coordinate_system":
            CoordinateSystem.from_user_input(vertical_cs).to_json_dict(),
        }
        if geoid_model is not None:
            vert_crs_json["geoid_model"] = {"name": geoid_model}

        super().__init__(vert_crs_json)
示例#5
0
def test_compund_crs():
    vertcrs = VerticalCRS(
        name="NAVD88 height",
        datum="North American Vertical Datum 1988",
        vertical_cs=VerticalCS(),
        geoid_model="GEOID12B",
    )
    projcrs = ProjectedCRS(
        name="NAD83 / Pennsylvania South",
        conversion=LambertConformalConic2SPConversion(
            latitude_false_origin=39.3333333333333,
            longitude_false_origin=-77.75,
            latitude_first_parallel=40.9666666666667,
            latitude_second_parallel=39.9333333333333,
            easting_false_origin=600000,
            northing_false_origin=0,
        ),
        geodetic_crs=GeographicCRS(datum="North American Datum 1983"),
        cartesian_cs=Cartesian2DCS(),
    )
    compcrs = CompoundCRS(
        name="NAD83 / Pennsylvania South + NAVD88 height", components=[projcrs, vertcrs]
    )
    assert compcrs.name == "NAD83 / Pennsylvania South + NAVD88 height"
    assert compcrs.type_name == "Compound CRS"
    assert compcrs.sub_crs_list[0].type_name == "Projected CRS"
    assert compcrs.sub_crs_list[1].type_name == "Vertical CRS"
示例#6
0
def test_vertical_crs():
    vc = VerticalCRS(
        name="NAVD88 height",
        datum="North American Vertical Datum 1988",
        geoid_model="GEOID12B",
    )
    assert vc.name == "NAVD88 height"
    assert vc.type_name == "Vertical CRS"
    assert vc.coordinate_system == VerticalCS()
    assert vc.to_json_dict()["geoid_model"]["name"] == "GEOID12B"
def test_vertical_cs(axis, direction, unit_name):
    vcs = VerticalCS(axis=axis)
    assert len(vcs.axis_list) == 1
    assert vcs.axis_list[0].direction == direction
    assert vcs.axis_list[0].unit_name == unit_name