def test_lambert_cylindrical_equal_area_scale_operation():
    lceaop = LambertCylindricalEqualAreaScaleConversion(
        longitude_natural_origin=2,
        false_easting=3,
        false_northing=4,
        scale_factor_natural_origin=0.999,
    )
    if LooseVersion(proj_version_str) >= LooseVersion("6.3.1"):
        assert lceaop.name == "unknown"
        assert lceaop.method_name == "Lambert Cylindrical Equal Area"
        op_dict = _to_dict(lceaop)
        assert_almost_equal(op_dict.pop("Latitude of 1st standard parallel"),
                            2.57,
                            decimal=2)
        assert op_dict == {
            "Longitude of natural origin": 2.0,
            "False easting": 3.0,
            "False northing": 4.0,
        }
    else:
        assert lceaop.name == "PROJ-based coordinate operation"
        assert lceaop.method_name == (
            "PROJ-based operation method: +proj=cea +lon_0=2 +x_0=3 +y_0=4 +k_0=0.999"
        )
        assert _to_dict(lceaop) == {}
Beispiel #2
0
def test_lambert_cylindrical_equal_area_scale_operation__defaults():
    lceaop = LambertCylindricalEqualAreaScaleConversion()
    assert lceaop.name == "unknown"
    assert lceaop.method_name == "Lambert Cylindrical Equal Area"
    assert _to_dict(lceaop) == {
        "Latitude of 1st standard parallel": 0.0,
        "Longitude of natural origin": 0.0,
        "False easting": 0.0,
        "False northing": 0.0,
    }
def test_lambert_cylindrical_equal_area_scale_operation__defaults():
    lceaop = LambertCylindricalEqualAreaScaleConversion()
    if LooseVersion(proj_version_str) >= LooseVersion("6.3.1"):
        assert lceaop.name == "unknown"
        assert lceaop.method_name == "Lambert Cylindrical Equal Area"
        assert _to_dict(lceaop) == {
            "Latitude of 1st standard parallel": 0.0,
            "Longitude of natural origin": 0.0,
            "False easting": 0.0,
            "False northing": 0.0,
        }
    else:
        assert lceaop.name == "PROJ-based coordinate operation"
        assert lceaop.method_name == (
            "PROJ-based operation method: +proj=cea +lon_0=0.0 "
            "+x_0=0.0 +y_0=0.0 +k_0=1.0")
        assert _to_dict(lceaop) == {}
Beispiel #4
0
def test_lambert_cylindrical_equal_area_scale_operation():
    lceaop = LambertCylindricalEqualAreaScaleConversion(
        longitude_natural_origin=2,
        false_easting=3,
        false_northing=4,
        scale_factor_natural_origin=0.999,
    )
    assert lceaop.name == "unknown"
    assert lceaop.method_name == "Lambert Cylindrical Equal Area"
    op_dict = _to_dict(lceaop)
    assert_almost_equal(op_dict.pop("Latitude of 1st standard parallel"),
                        2.57,
                        decimal=2)
    assert op_dict == {
        "Longitude of natural origin": 2.0,
        "False easting": 3.0,
        "False northing": 4.0,
    }
def _lambert_cylindrical_equal_area(cf_params):
    """
    http://cfconventions.org/cf-conventions/cf-conventions.html#_lambert_cylindrical_equal_area
    """
    if "scale_factor_at_projection_origin" in cf_params:
        return LambertCylindricalEqualAreaScaleConversion(
            scale_factor_natural_origin=cf_params["scale_factor_at_projection_origin"],
            longitude_natural_origin=cf_params.get(
                "longitude_of_central_meridian", 0.0
            ),
            false_easting=cf_params.get("false_easting", 0.0),
            false_northing=cf_params.get("false_northing", 0.0),
        )
    return LambertCylindricalEqualAreaConversion(
        latitude_first_parallel=cf_params.get("standard_parallel", 0.0),
        longitude_natural_origin=cf_params.get("longitude_of_central_meridian", 0.0),
        false_easting=cf_params.get("false_easting", 0.0),
        false_northing=cf_params.get("false_northing", 0.0),
    )