Пример #1
0
 def __init__(
     self,
     name: str = "undefined",
     datum: Any = "urn:ogc:def:datum:EPSG::6326",
     ellipsoidal_cs: Any = None,
 ) -> None:
     """
     Parameters
     ----------
     name: str, optional
         Name of the CRS. Default is undefined.
     datum: Any, optional
         Anything accepted by :meth:`pyproj.crs.Datum.from_user_input` or
         a :class:`pyproj.crs.datum.CustomDatum`.
     ellipsoidal_cs: Any, optional
         Input to create an Ellipsoidal Coordinate System.
         Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
         or an Ellipsoidal Coordinate System created from :ref:`coordinate_system`.
     """
     geographic_crs_json = {
         "$schema":
         "https://proj.org/schemas/v0.2/projjson.schema.json",
         "type":
         "GeographicCRS",
         "name":
         name,
         "datum":
         Datum.from_user_input(datum).to_json_dict(),
         "coordinate_system":
         CoordinateSystem.from_user_input(
             ellipsoidal_cs or Ellipsoidal2DCS()).to_json_dict(),
     }
     super().__init__(geographic_crs_json)
Пример #2
0
 def __init__(
     self, base_crs, conversion, ellipsoidal_cs=Ellipsoidal2DCS(), name="undefined",
 ):
     """
     Parameters
     ----------
     base_crs: Any
         Input to create the Geodetic CRS, a :class:`GeographicCRS` or
         anything accepted by :meth:`pyproj.crs.CRS.from_user_input`.
     conversion: Any
         Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
         or a conversion from :ref:`coordinate_operation`.
     ellipsoidal_cs: Any, optional
         Input to create an Ellipsoidal Coordinate System.
         Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
         or an Ellipsoidal Coordinate System created from :ref:`coordinate_system`.
     name: str, optional
         Name of the CRS. Default is undefined.
     """
     derived_geographic_crs_json = {
         "$schema": "https://proj.org/schemas/v0.2/projjson.schema.json",
         "type": "DerivedGeographicCRS",
         "name": name,
         "base_crs": CRS.from_user_input(base_crs).to_json_dict(),
         "conversion": CoordinateOperation.from_user_input(
             conversion
         ).to_json_dict(),
         "coordinate_system": CoordinateSystem.from_user_input(
             ellipsoidal_cs
         ).to_json_dict(),
     }
     super().__init__(derived_geographic_crs_json)
def test_ellipsoidal_2d_cs(axis, name_0, direction_0, name_1, direction_1):
    vcs = Ellipsoidal2DCS(axis=axis)
    assert len(vcs.axis_list) == 2
    assert vcs.axis_list[0].direction == direction_0
    assert vcs.axis_list[0].name == name_0
    assert vcs.axis_list[0].unit_name == "degree"
    assert vcs.axis_list[1].direction == direction_1
    assert vcs.axis_list[1].name == name_1
    assert vcs.axis_list[1].unit_name == "degree"
def test_ellipsoidal2dcs_to_cf():
    ecs = Ellipsoidal2DCS(axis=Ellipsoidal2DCSAxis.LATITUDE_LONGITUDE)
    assert ecs.to_cf() == [
        {
            "standard_name": "latitude",
            "long_name": "latitude coordinate",
            "units": "degrees_north",
            "axis": "Y",
        },
        {
            "standard_name": "longitude",
            "long_name": "longitude coordinate",
            "units": "degrees_east",
            "axis": "X",
        },
    ]