예제 #1
0
파일: geod.py 프로젝트: wenzeslaus/pyproj
    def fwd(self, lons, lats, az, dist, radians=False):
        """
        forward transformation - Returns longitudes, latitudes and back
        azimuths of terminus points given longitudes (lons) and
        latitudes (lats) of initial points, plus forward azimuths (az)
        and distances (dist).
        latitudes (lats) of initial points, plus forward azimuths (az)
        and distances (dist).

        Works with numpy and regular python array objects, python
        sequences and scalars.

        if radians=True, lons/lats and azimuths are radians instead of
        degrees. Distances are in meters.
        """
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(lons)
        iny, yisfloat, yislist, yistuple = _copytobuffer(lats)
        inz, zisfloat, zislist, zistuple = _copytobuffer(az)
        ind, disfloat, dislist, distuple = _copytobuffer(dist)
        self._fwd(inx, iny, inz, ind, radians=radians)
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(xisfloat, xislist, xistuple, inx)
        outy = _convertback(yisfloat, yislist, xistuple, iny)
        outz = _convertback(zisfloat, zislist, zistuple, inz)
        return outx, outy, outz
예제 #2
0
    def __call__(self, *args, **kw):
        # ,lon,lat,inverse=False,errcheck=False):
        """
        Calling a Proj class instance with the arguments lon, lat will
        convert lon/lat (in degrees) to x/y native map projection
        coordinates (in meters).  If optional keyword 'inverse' is True
        (default is False), the inverse transformation from x/y to
        lon/lat is performed. If optional keyword 'errcheck' is True (default is
        False) an exception is raised if the transformation is invalid.
        If errcheck=False and the transformation is invalid, no
        exception is raised and 1.e30 is returned.

        Inputs should be doubles (they will be cast to doubles if they
        are not, causing a slight performance hit).

        Works with numpy and regular python array objects, python
        sequences and scalars, but is fastest for array objects.
        """
        inverse = kw.get("inverse", False)
        errcheck = kw.get("errcheck", False)
        lon, lat = args
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(lon)
        iny, yisfloat, yislist, yistuple = _copytobuffer(lat)
        # call PROJ functions. inx and iny modified in place.
        if inverse:
            self._inv(inx, iny, errcheck=errcheck)
        else:
            self._fwd(inx, iny, errcheck=errcheck)
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(xisfloat, xislist, xistuple, inx)
        outy = _convertback(yisfloat, yislist, xistuple, iny)
        return outx, outy
예제 #3
0
    def __call__(
        self,
        longitude: Any,
        latitude: Any,
        inverse: bool = False,
        errcheck: bool = False,
        radians: bool = False,
    ) -> Tuple[Any, Any]:
        """
        Calling a Proj class instance with the arguments lon, lat will
        convert lon/lat (in degrees) to x/y native map projection
        coordinates (in meters).

        Inputs should be doubles (they will be cast to doubles if they
        are not, causing a slight performance hit).

        Works with numpy and regular python array objects, python
        sequences and scalars, but is fastest for array objects.

        Parameters
        ----------
        longitude: scalar or array (numpy or python)
            Input longitude coordinate(s).
        latitude: scalar or array (numpy or python)
            Input latitude coordinate(s).
        inverse: boolean, optional
            If inverse is True the inverse transformation from x/y to
            lon/lat is performed. Default is False.
        radians: boolean, optional
            If True, will expect input data to be in radians and will return radians
            if the projection is geographic. Default is False (degrees).
            This does not work with pyproj 2 and is ignored. It will be enabled again
            in pyproj 3.
        errcheck: boolean, optional
            If True an exception is raised if the errors are found in the process.
            By default errcheck=False and ``inf`` is returned.

        Returns
        -------
        Tuple[Any, Any]:
            The transformed coordinates.
        """
        if radians:
            warnings.warn(
                "radian input is currently not supported in pyproj 2. "
                "Support for radian input will be added in pyproj 3.")
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(longitude)
        iny, yisfloat, yislist, yistuple = _copytobuffer(latitude)
        # call PROJ functions. inx and iny modified in place.
        if inverse:
            self._inv(inx, iny, errcheck=errcheck)
        else:
            self._fwd(inx, iny, errcheck=errcheck)
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(xisfloat, xislist, xistuple, inx)
        outy = _convertback(yisfloat, yislist, xistuple, iny)
        return outx, outy
예제 #4
0
    def transform(self, xx, yy, zz=None, radians=False):
        """
        Transform points between two coordinate systems.

        Parameters
        ----------
        xx: scalar or array (numpy or python)
            Input x coordinate(s).
        yy: scalar or array (numpy or python)
            Input y coordinate(s).
        zz: scalar or array (numpy or python), optional
            Input z coordinate(s).
        radians: boolean, optional
            If True, will expect input data to be in radians and will return radians
            if the projection is geographic. Default is False (degrees).


        Example:

        >>> from pyproj import Transformer
        >>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857")
        >>> x3, y3 = transformer.transform(33, 98)
        >>> "%.3f  %.3f" % (x3, y3)
        '10909310.098  3895303.963'
        >>> pipeline_str = "+proj=pipeline +step +proj=longlat +ellps=WGS84 +step +proj=unitconvert +xy_in=rad +xy_out=deg"
        >>> pipe_trans = Transformer.from_pipeline(pipeline_str)
        >>> xt, yt = pipe_trans.transform(2.1, 0.001)
        >>> "%.3f  %.3f" % (xt, yt)
        '120.321  0.057'
        >>> transproj = Transformer.from_proj({"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'}, '+init=EPSG:4326')
        >>> xpj, ypj, zpj = transproj.transform(-2704026.010, -4253051.810, 3895878.820, radians=True)
        >>> "%.3f %.3f %.3f" % (xpj, ypj, zpj)
        '-2.137 0.661 -20.531'
        >>> transprojr = Transformer.from_proj('+init=EPSG:4326', {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'})
        >>> xpjr, ypjr, zpjr = transprojr.transform(xpj, ypj, zpj, radians=True)
        >>> "%.3f %.3f %.3f" % (xpjr, ypjr, zpjr)
        '-2704026.010 -4253051.810 3895878.820'

        """
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(xx)
        iny, yisfloat, yislist, yistuple = _copytobuffer(yy)
        if zz is not None:
            inz, zisfloat, zislist, zistuple = _copytobuffer(zz)
        else:
            inz = None
        # call pj_transform.  inx,iny,inz buffers modified in place.
        self._transformer._transform(inx, iny, inz, radians)
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(xisfloat, xislist, xistuple, inx)
        outy = _convertback(yisfloat, yislist, xistuple, iny)
        if inz is not None:
            outz = _convertback(zisfloat, zislist, zistuple, inz)
            return outx, outy, outz
        else:
            return outx, outy
예제 #5
0
    def fwd(  # pylint: disable=invalid-name
            self,
            lons: Any,
            lats: Any,
            az: Any,
            dist: Any,
            radians=False) -> Tuple[Any, Any, Any]:
        """
        Forward transformation

        Determine longitudes, latitudes and back azimuths of terminus
        points given longitudes and latitudes of initial points,
        plus forward azimuths and distances.

        Parameters
        ----------
        lons: array, :class:`numpy.ndarray`, list, tuple, or scalar
            Longitude(s) of initial point(s)
        lats: array, :class:`numpy.ndarray`, list, tuple, or scalar
            Latitude(s) of initial point(s)
        az: array, :class:`numpy.ndarray`, list, tuple, or scalar
            Forward azimuth(s)
        dist: array, :class:`numpy.ndarray`, list, tuple, or scalar
            Distance(s) between initial and terminus point(s)
            in meters
        radians: bool, default=False
            If True, the input data is assumed to be in radians.
            Otherwise, the data is assumed to be in degrees.

        Returns
        -------
        array, :class:`numpy.ndarray`, list, tuple, or scalar:
            Longitude(s) of terminus point(s)
        array, :class:`numpy.ndarray`, list, tuple, or scalar:
            Latitude(s) of terminus point(s)
        array, :class:`numpy.ndarray`, list, tuple, or scalar:
            Back azimuth(s)
        """
        # process inputs, making copies that support buffer API.
        inx, x_data_type = _copytobuffer(lons)
        iny, y_data_type = _copytobuffer(lats)
        inz, z_data_type = _copytobuffer(az)
        ind = _copytobuffer(dist)[0]
        self._fwd(inx, iny, inz, ind, radians=radians)
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(x_data_type, inx)
        outy = _convertback(y_data_type, iny)
        outz = _convertback(z_data_type, inz)
        return outx, outy, outz
예제 #6
0
파일: geod.py 프로젝트: snowman2/pyproj
    def inv(
        self,
        lons1: Any,
        lats1: Any,
        lons2: Any,
        lats2: Any,
        radians: bool = False,
    ) -> Tuple[Any, Any, Any]:
        """
        Inverse transformation

        Determine forward and back azimuths, plus distances
        between initial points and terminus points.

        Parameters
        ----------
        lons1: array, :class:`numpy.ndarray`, list, tuple, or scalar
            Longitude(s) of initial point(s)
        lats1: array, :class:`numpy.ndarray`, list, tuple, or scalar
            Latitude(s) of initial point(s)
        lons2: array, :class:`numpy.ndarray`, list, tuple, or scalar
            Longitude(s) of terminus point(s)
        lats2: array, :class:`numpy.ndarray`, list, tuple, or scalar
            Latitude(s) of terminus point(s)
        radians: bool, default=False
            If True, the input data is assumed to be in radians.
            Otherwise, the data is assumed to be in degrees.

        Returns
        -------
        array, :class:`numpy.ndarray`, list, tuple, or scalar:
            Forward azimuth(s)
        array, :class:`numpy.ndarray`, list, tuple, or scalar:
            Back azimuth(s)
        array, :class:`numpy.ndarray`, list, tuple, or scalar:
            Distance(s) between initial and terminus point(s)
            in meters
        """
        # process inputs, making copies that support buffer API.
        inx, x_data_type = _copytobuffer(lons1)
        iny, y_data_type = _copytobuffer(lats1)
        inz, z_data_type = _copytobuffer(lons2)
        ind = _copytobuffer(lats2)[0]
        self._inv(inx, iny, inz, ind, radians=radians)
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(x_data_type, inx)
        outy = _convertback(y_data_type, iny)
        outz = _convertback(z_data_type, inz)
        return outx, outy, outz
예제 #7
0
    def line_lengths(self, lons: Any, lats: Any, radians: bool = False) -> Any:
        """
        .. versionadded:: 2.3.0

        Calculate the distances between points along a line.

        >>> from pyproj import Geod
        >>> geod = Geod(ellps="WGS84")
        >>> lats = [-72.9, -71.9, -74.9]
        >>> lons = [-74, -102, -102]
        >>> for line_length in geod.line_lengths(lons, lats):
        ...     f"{line_length:.3f}"
        '943065.744'
        '334805.010'

        Parameters
        ----------
        lons: array, :class:`numpy.ndarray`, list, tuple, or scalar
            The longitude points along a line.
        lats: array, :class:`numpy.ndarray`, list, tuple, or scalar
            The latitude points along a line.
        radians: bool, optional
            If True, the input data is assumed to be in radians.

        Returns
        -------
        array, :class:`numpy.ndarray`, list, tuple, or scalar:
            The total length of the line.
        """
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(lons)
        iny, yisfloat, yislist, yistuple = _copytobuffer(lats)
        self._line_length(inx, iny, radians=radians)
        line_lengths = _convertback(xisfloat, xislist, xistuple, inx)
        return line_lengths if xisfloat else line_lengths[:-1]
예제 #8
0
파일: proj.py 프로젝트: micahcochran/pyproj
    def __call__(self, *args, **kw):
        # ,lon,lat,inverse=False,errcheck=False):
        """
        Calling a Proj class instance with the arguments lon, lat will
        convert lon/lat (in degrees) to x/y native map projection
        coordinates (in meters).  If optional keyword 'inverse' is True
        (default is False), the inverse transformation from x/y to
        lon/lat is performed. If optional keyword 'errcheck' is True (default is
        False) an exception is raised if the transformation is invalid.
        If errcheck=False and the transformation is invalid, no
        exception is raised and 1.e30 is returned.

        Inputs should be doubles (they will be cast to doubles if they
        are not, causing a slight performance hit).

        Works with numpy and regular python array objects, python
        sequences and scalars, but is fastest for array objects.
        """
        inverse = kw.get("inverse", False)
        errcheck = kw.get("errcheck", False)
        # if len(args) == 1:
        #    latlon = np.array(args[0], copy=True,
        #                      order='C', dtype=float, ndmin=2)
        #    if inverse:
        #        _proj.Proj._invn(self, latlon, radians=radians, errcheck=errcheck)
        #    else:
        #        _proj.Proj._fwdn(self, latlon, radians=radians, errcheck=errcheck)
        #    return latlon
        lon, lat = args
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(lon)
        iny, yisfloat, yislist, yistuple = _copytobuffer(lat)
        # call proj4 functions. inx and iny modified in place.
        if inverse:
            self._inv(inx, iny, errcheck=errcheck)
        else:
            self._fwd(inx, iny, errcheck=errcheck)
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(xisfloat, xislist, xistuple, inx)
        outy = _convertback(yisfloat, yislist, xistuple, iny)
        return outx, outy
예제 #9
0
파일: geod.py 프로젝트: wenzeslaus/pyproj
    def inv(self, lons1, lats1, lons2, lats2, radians=False):
        """
        inverse transformation - Returns forward and back azimuths, plus
        distances between initial points (specified by lons1, lats1) and
        terminus points (specified by lons2, lats2).

        Works with numpy and regular python array objects, python
        sequences and scalars.

        if radians=True, lons/lats and azimuths are radians instead of
        degrees. Distances are in meters.
        """
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(lons1)
        iny, yisfloat, yislist, yistuple = _copytobuffer(lats1)
        inz, zisfloat, zislist, zistuple = _copytobuffer(lons2)
        ind, disfloat, dislist, distuple = _copytobuffer(lats2)
        self._inv(inx, iny, inz, ind, radians=radians)
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(xisfloat, xislist, xistuple, inx)
        outy = _convertback(yisfloat, yislist, xistuple, iny)
        outz = _convertback(zisfloat, zislist, zistuple, inz)
        return outx, outy, outz
예제 #10
0
    def transform(
        self,
        xx,
        yy,
        zz=None,
        tt=None,
        radians=False,
        errcheck=False,
        direction=TransformDirection.FORWARD,
    ):
        """
        Transform points between two coordinate systems.

        .. versionadded:: 2.1.1 errcheck
        .. versionadded:: 2.2.0 direction

        Parameters
        ----------
        xx: scalar or array (numpy or python)
            Input x coordinate(s).
        yy: scalar or array (numpy or python)
            Input y coordinate(s).
        zz: scalar or array (numpy or python), optional
            Input z coordinate(s).
        tt: scalar or array (numpy or python), optional
            Input time coordinate(s).
        radians: boolean, optional
            If True, will expect input data to be in radians and will return radians
            if the projection is geographic. Default is False (degrees). Ignored for
            pipeline transformations.
        errcheck: boolean, optional (default False)
            If True an exception is raised if the transformation is invalid.
            By default errcheck=False and an invalid transformation
            returns ``inf`` and no exception is raised.
        direction: ~pyproj.enums.TransformDirection, optional
            The direction of the transform.
            Default is :attr:`~pyproj.enums.TransformDirection.FORWARD`.


        Example:

        >>> from pyproj import Transformer
        >>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857")
        >>> x3, y3 = transformer.transform(33, 98)
        >>> "%.3f  %.3f" % (x3, y3)
        '10909310.098  3895303.963'
        >>> pipeline_str = (
        ...     "+proj=pipeline +step +proj=longlat +ellps=WGS84 "
        ...     "+step +proj=unitconvert +xy_in=rad +xy_out=deg"
        ... )
        >>> pipe_trans = Transformer.from_pipeline(pipeline_str)
        >>> xt, yt = pipe_trans.transform(2.1, 0.001)
        >>> "%.3f  %.3f" % (xt, yt)
        '120.321  0.057'
        >>> transproj = Transformer.from_crs(
        ...     {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'},
        ...     "EPSG:4326",
        ...     always_xy=True,
        ... )
        >>> xpj, ypj, zpj = transproj.transform(
        ...     -2704026.010,
        ...     -4253051.810,
        ...     3895878.820,
        ...     radians=True,
        ... )
        >>> "%.3f %.3f %.3f" % (xpj, ypj, zpj)
        '-2.137 0.661 -20.531'
        >>> transprojr = Transformer.from_crs(
        ...     "EPSG:4326",
        ...     {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'},
        ...     always_xy=True,
        ... )
        >>> xpjr, ypjr, zpjr = transprojr.transform(xpj, ypj, zpj, radians=True)
        >>> "%.3f %.3f %.3f" % (xpjr, ypjr, zpjr)
        '-2704026.010 -4253051.810 3895878.820'
        >>> transformer = Transformer.from_proj("epsg:4326", 4326, skip_equivalent=True)
        >>> xeq, yeq = transformer.transform(33, 98)
        >>> "%.0f  %.0f" % (xeq, yeq)
        '33  98'

        """
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(xx)
        iny, yisfloat, yislist, yistuple = _copytobuffer(yy)
        if zz is not None:
            inz, zisfloat, zislist, zistuple = _copytobuffer(zz)
        else:
            inz = None
        if tt is not None:
            intime, tisfloat, tislist, tistuple = _copytobuffer(tt)
        else:
            intime = None
        # call pj_transform.  inx,iny,inz buffers modified in place.
        self._transformer._transform(
            inx,
            iny,
            inz=inz,
            intime=intime,
            direction=direction,
            radians=radians,
            errcheck=errcheck,
        )
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(xisfloat, xislist, xistuple, inx)
        outy = _convertback(yisfloat, yislist, xistuple, iny)
        return_data = (outx, outy)
        if inz is not None:
            return_data += (_convertback(zisfloat, zislist, zistuple, inz), )
        if intime is not None:
            return_data += (_convertback(tisfloat, tislist, tistuple,
                                         intime), )
        return return_data
예제 #11
0
    def transform(  # pylint: disable=invalid-name
        self,
        xx,
        yy,
        zz=None,
        tt=None,
        radians=False,
        errcheck=False,
        direction=TransformDirection.FORWARD,
        inplace=False,
    ):
        """
        Transform points between two coordinate systems.

        .. versionadded:: 2.1.1 errcheck
        .. versionadded:: 2.2.0 direction
        .. versionadded:: 3.2.0 inplace

        Parameters
        ----------
        xx: scalar or array (numpy or python)
            Input x coordinate(s).
        yy: scalar or array (numpy or python)
            Input y coordinate(s).
        zz: scalar or array (numpy or python), optional
            Input z coordinate(s).
        tt: scalar or array (numpy or python), optional
            Input time coordinate(s).
        radians: bool, default=False
            If True, will expect input data to be in radians and will return radians
            if the projection is geographic. Otherwise, it uses degrees.
            Ignored for pipeline transformations with pyproj 2,
            but will work in pyproj 3.
        errcheck: bool, default=False
            If True, an exception is raised if the errors are found in the process.
            If False, ``inf`` is returned for errors.
        direction: pyproj.enums.TransformDirection, optional
            The direction of the transform.
            Default is :attr:`pyproj.enums.TransformDirection.FORWARD`.
        inplace: bool, default=False
            If True, will attempt to write the results to the input array
            instead of returning a new array. This will fail if the input
            is not an array in C order with the double data type.

        Example
        --------

        >>> from pyproj import Transformer
        >>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857")
        >>> x3, y3 = transformer.transform(33, 98)
        >>> f"{x3:.3f}  {y3:.3f}"
        '10909310.098  3895303.963'
        >>> pipeline_str = (
        ...     "+proj=pipeline +step +proj=longlat +ellps=WGS84 "
        ...     "+step +proj=unitconvert +xy_in=rad +xy_out=deg"
        ... )
        >>> pipe_trans = Transformer.from_pipeline(pipeline_str)
        >>> xt, yt = pipe_trans.transform(2.1, 0.001)
        >>> f"{xt:.3f}  {yt:.3f}"
        '2.100  0.001'
        >>> transproj = Transformer.from_crs(
        ...     {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'},
        ...     "EPSG:4326",
        ...     always_xy=True,
        ... )
        >>> xpj, ypj, zpj = transproj.transform(
        ...     -2704026.010,
        ...     -4253051.810,
        ...     3895878.820,
        ...     radians=True,
        ... )
        >>> f"{xpj:.3f} {ypj:.3f} {zpj:.3f}"
        '-2.137 0.661 -20.531'
        >>> transprojr = Transformer.from_crs(
        ...     "EPSG:4326",
        ...     {"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'},
        ...     always_xy=True,
        ... )
        >>> xpjr, ypjr, zpjr = transprojr.transform(xpj, ypj, zpj, radians=True)
        >>> f"{xpjr:.3f} {ypjr:.3f} {zpjr:.3f}"
        '-2704026.010 -4253051.810 3895878.820'
        >>> transformer = Transformer.from_proj("epsg:4326", 4326)
        >>> xeq, yeq = transformer.transform(33, 98)
        >>> f"{xeq:.0f}  {yeq:.0f}"
        '33  98'

        """
        # process inputs, making copies that support buffer API.
        inx, x_data_type = _copytobuffer(xx, inplace=inplace)
        iny, y_data_type = _copytobuffer(yy, inplace=inplace)
        if zz is not None:
            inz, z_data_type = _copytobuffer(zz, inplace=inplace)
        else:
            inz = None
        if tt is not None:
            intime, t_data_type = _copytobuffer(tt, inplace=inplace)
        else:
            intime = None
        # call pj_transform.  inx,iny,inz buffers modified in place.
        self._transformer._transform(
            inx,
            iny,
            inz=inz,
            intime=intime,
            direction=direction,
            radians=radians,
            errcheck=errcheck,
        )
        # if inputs were lists, tuples or floats, convert back.
        outx = _convertback(x_data_type, inx)
        outy = _convertback(y_data_type, iny)
        return_data: Tuple[Any, ...] = (outx, outy)
        if inz is not None:
            return_data += (_convertback(z_data_type, inz), )
        if intime is not None:
            return_data += (_convertback(t_data_type, intime), )
        return return_data
예제 #12
0
    def get_factors(
        self, longitude, latitude, radians=False, errcheck=False,
    ):
        """
        .. versionadded:: 2.6.0

        Calculate various cartographic properties, such as scale factors, angular
        distortion and meridian convergence. Depending on the underlying projection
        values will be calculated either numerically (default) or analytically.

        The function also calculates the partial derivatives of the given
        coordinate.

        Parameters
        ----------
        longitude: scalar or array (numpy or python)
            Input longitude coordinate(s).
        latitude: scalar or array (numpy or python)
            Input latitude coordinate(s).
        radians: boolean, optional
            If True, will expect input data to be in radians.
            Default is False (degrees).
        errcheck: boolean, optional (default False)
            If True an exception is raised if the errors are found in the process.
            By default errcheck=False and ``inf`` is returned.

        Returns
        -------
        Factors
        """
        # process inputs, making copies that support buffer API.
        inx, xisfloat, xislist, xistuple = _copytobuffer(longitude)
        iny, yisfloat, yislist, yistuple = _copytobuffer(latitude)

        # calculate the factors
        factors = self._get_factors(inx, iny, radians=radians, errcheck=errcheck)

        # if inputs were lists, tuples or floats, convert back.
        return Factors(
            meridional_scale=_convertback(
                xisfloat, xislist, xistuple, factors.meridional_scale
            ),
            parallel_scale=_convertback(
                xisfloat, xislist, xistuple, factors.parallel_scale
            ),
            areal_scale=_convertback(xisfloat, xislist, xistuple, factors.areal_scale),
            angular_distortion=_convertback(
                xisfloat, xislist, xistuple, factors.angular_distortion
            ),
            meridian_parallel_angle=_convertback(
                xisfloat, xislist, xistuple, factors.meridian_parallel_angle
            ),
            meridian_convergence=_convertback(
                xisfloat, xislist, xistuple, factors.meridian_convergence
            ),
            tissot_semimajor=_convertback(
                xisfloat, xislist, xistuple, factors.tissot_semimajor
            ),
            tissot_semiminor=_convertback(
                xisfloat, xislist, xistuple, factors.tissot_semiminor
            ),
            dx_dlam=_convertback(xisfloat, xislist, xistuple, factors.dx_dlam),
            dx_dphi=_convertback(xisfloat, xislist, xistuple, factors.dx_dphi),
            dy_dlam=_convertback(xisfloat, xislist, xistuple, factors.dy_dlam),
            dy_dphi=_convertback(xisfloat, xislist, xistuple, factors.dy_dphi),
        )