Beispiel #1
0
def test_geostationary_operation():
    geop = GeostationarySatelliteConversion(
        sweep_angle_axis="y",
        satellite_height=11,
        latitude_natural_origin=1,
        longitude_natural_origin=2,
        false_easting=3,
        false_northing=4,
    )
    assert geop.name == "unknown"
    assert geop.method_name == "Geostationary Satellite (Sweep Y)"
    assert _to_dict(geop) == {
        "Latitude of natural origin": 1.0,
        "Longitude of natural origin": 2.0,
        "False easting": 3.0,
        "False northing": 4.0,
        "Satellite height": 11.0,
    }
Beispiel #2
0
def _geostationary(cf_params):
    """
    http://cfconventions.org/cf-conventions/cf-conventions.html#_geostationary_projection
    """
    try:
        sweep_angle_axis = cf_params["sweep_angle_axis"]
    except KeyError:
        sweep_angle_axis = {
            "x": "y",
            "y": "x"
        }[cf_params["fixed_angle_axis"].lower()]
    return GeostationarySatelliteConversion(
        sweep_angle_axis=sweep_angle_axis,
        satellite_height=cf_params["perspective_point_height"],
        latitude_natural_origin=cf_params.get("latitude_of_projection_origin",
                                              0.0),
        longitude_natural_origin=cf_params.get(
            "longitude_of_projection_origin", 0.0),
        false_easting=cf_params.get("false_easting", 0.0),
        false_northing=cf_params.get("false_northing", 0.0),
    )
def test_geostationary_operation__invalid_sweep():
    with pytest.raises(CRSError):
        GeostationarySatelliteConversion(sweep_angle_axis="P",
                                         satellite_height=10)