Esempio n. 1
0
def test_make_derived_geographic_crs(tmp_path):
    conversion = RotatedLatitudeLongitudeConversion(o_lat_p=0, o_lon_p=0)
    dgc = DerivedGeographicCRS(base_crs=GeographicCRS(), conversion=conversion)
    assert dgc.name == "undefined"
    assert dgc.type_name == "Derived Geographic 2D CRS"
    assert dgc.coordinate_operation == conversion
    assert dgc.is_derived
    assert_can_pickle(dgc, tmp_path)
Esempio n. 2
0
def test_derived_geographic_crs__from_methods():
    crs_str = "+proj=ob_tran +o_proj=longlat +o_lat_p=0 +o_lon_p=0 +lon_0=0"
    with pytest.raises(CRSError, match="Invalid type Geographic 2D CRS"):
        DerivedGeographicCRS.from_epsg(4326)
    assert_maker_inheritance_valid(DerivedGeographicCRS.from_string(crs_str),
                                   DerivedGeographicCRS)
    assert_maker_inheritance_valid(DerivedGeographicCRS.from_proj4(crs_str),
                                   DerivedGeographicCRS)
    assert_maker_inheritance_valid(
        DerivedGeographicCRS.from_user_input(
            DerivedGeographicCRS.from_string(crs_str)),
        DerivedGeographicCRS,
    )
    assert_maker_inheritance_valid(
        DerivedGeographicCRS.from_json(CRS(crs_str).to_json()),
        DerivedGeographicCRS)
    assert_maker_inheritance_valid(
        DerivedGeographicCRS.from_json_dict(CRS(crs_str).to_json_dict()),
        DerivedGeographicCRS,
    )