jgdtrans package#

Submodules#

Module contents#

Coordinate Transformer by Gridded Correction Parameter (par file).

class jgdtrans.Parameter(latitude: float, longitude: float, altitude: float)#

Bases: NamedTuple

The parameter triplet.

We emphasize that the unit of latitude and longitude is [sec], not [deg].

It should fill by 0.0 instead of nan when the parameter does not exist, as parsers does.

altitude: float#

The altitude parameter [m].

property horizontal: float#

\(\sqrt{\text{latitude}^2 + \text{longitude}^2}\) [sec].

latitude: float#

The latitude parameter [sec].

longitude: float#

The latitude parameter [sec].

class jgdtrans.ParData(format: _types.FormatType, parameter: dict[int, Parameter], description: str | None = None)#

Bases: object

Par data obj.

description: str | None = None#

The description.

classmethod from_dict(obj: _types.ParDataLikeMappingType) Self#

Makes a ParData obj from Mapping obj.

This parses meshcode, the key of parameter, into int.

See FormatType for detail of 'PatchJGD_HV'.

Parameters:

obj – the Mapping of the format, the parameters, and the description (optional)

Returns:

the ParData obj

Raises:

DeserializeError – when fail to parse the meshcode

Examples

>>> mapping = {
...     'format': 'SemiDynaEXE',
...     'parameter': {
...         12345678: {
...             'latitude': 0.1
...             'longitude': 0.2
...             'altitude': 0.3
...         },
...         ...
...     },
...     'description': 'important my param',  # optional
... }
>>> data = ParData.from_dict(mapping)
>>> data.format
'SemiDynaEXE'
>>> data.parameter
{12345678: Parameter(0.1, 0.2, 0.3), ...}
>>> data.description
'important my param'
>>> mapping = {
...     'format': 'SemiDynaEXE',
...     'parameter': {
...         '12345678': {
...             'latitude': 0.1
...             'longitude': 0.2
...             'altitude': 0.3
...         },
...         ...
...     },
... }
>>> data = ParData.from_dict(mapping)
>>> data.format
'SemiDynaEXE'
>>> data.parameter
{12345678: Parameter(0.1, 0.2, 0.3), ...}
>>> data.description
None
get(meshcode: int) Parameter | None#

Returns Parameter associated with meshcode, otherwise None.

mesh_unit() Literal[1, 5]#

Returns a mesh unit.

statistics() Statistics#

Returns the statistics of the parameter.

See StatisticData for details of result’s components.

Returns:

the statistics of the parameter

Examples

From SemiDynaEXE2023.par

>>> data = ParData(
...     format='SemiDynaEXE'
...     parameter={
...         54401005: Parameter(-0.00622, 0.01516, 0.0946),
...         54401055: Parameter(-0.0062, 0.01529, 0.08972),
...         54401100: Parameter(-0.00663, 0.01492, 0.10374),
...         54401150: Parameter(-0.00664, 0.01506, 0.10087),
...     }
... )
>>> data.statistics()
StatisticalSummary(
    latitude=Statistics(
        count=4,
        mean=-0.006422499999999999,
        std=0.00021264700797330775,
        abs=0.006422499999999999,
        min=-0.00664,
        max=-0.0062
    ),
    longitude=Statistics(
        count=4,
        mean=0.0151075,
        std=0.00013553136168429814,
        abs=0.0151075,
        min=0.01492,
        max=0.01529
    ),
    altitude=Statistics(
        count=4,
        mean=0.0972325,
        std=0.005453133846697696,
        abs=0.0972325,
        min=0.08972,
        max=0.10374
    )
)
to_dict() _types.ParDataDictType#

Returns a dict which represents self.

This method is an inverse of ParData.from_dict().

Returns:

the dict obj which typed as TransformerDict

Examples

>>> data = ParData(
...     description="my param",
...     format="SemiDynaEXE",
...     parameter={12345678: Parameter(0.1, 0.2, 0.3)},
... )
>>> data.to_dict()
{
    'format': 'SemiDynaEXE',
    'parameter': {
        12345678: {
            'latitude': 0.1,
            'longitude': 0.2,
            'altitude': 0.3,
        }
    },
    'description': 'my param',
}
format: _types.FormatType#

The format of par file.

See FormatType for detail of 'PatchJGD_HV'.

parameter: dict[int, Parameter]#

The transformation parameter.

The entry represents single line of the par file’s parameter section, the key is meshcode, and the value is a Parameter (a triplet of latitude [sec], longitude [sec] and altitude [m]).

class jgdtrans.Transformer(data: ParameterSet)#

Bases: object

The coordinate Transformer, and represents a deserializing result of par file.

If the parameters is zero, such as the unsupported components, the transformations are identity transformation on such components. For example, the transformation by the TKY2JGD and the PatchJGD par is identity transformation on altitude, and by the PatchJGD(H) par is so on latitude and longitude.

Examples

From SemiDynaEXE2023.par

>>> tf = Transformer(
...     data=ParData(
...         format="SemiDynaEXE",
...         parameter={
...             54401005: Parameter(-0.00622, 0.01516, 0.0946),
...             54401055: Parameter(-0.0062, 0.01529, 0.08972),
...             54401100: Parameter(-0.00663, 0.01492, 0.10374),
...             54401150: Parameter(-0.00664, 0.01506, 0.10087),
...         },
...     )
... )

Forward transformation

>>> tf.forward(36.10377479, 140.087855041, 2.34)
Point(latitude=36.103773017086695, longitude=140.08785924333452, altitude=2.4363138578103)

Backward transformation

>>> tf.backward(36.103773017086695, 140.08785924333452, 2.4363138578103)
Point(latitude=36.10377479, longitude=140.087855041, altitude=2.34)

Backward transformation compatible to GIAJ web app/APIs

>>> tf.backward_compat(36.103773017086695, 140.08785924333452, 2.4363138578103)
Point(latitude=36.10377479000002, longitude=140.087855041, altitude=2.339999999578243)
MAX_ERROR: ClassVar[float] = 5e-14#

Max error of Transformer.backward() and Transformer.backward_corr().

backward(latitude: float, longitude: float, altitude: float = 0.0)#

Returns the backward-transformed position.

The result’s error from an exact solution is suppressed under Transformer::ERROR_MAX.

Notes, the error is less than 1e-9 deg, which is error of GIAJ latitude and longitude parameter. This implies that altitude’s error is (practically) less than 1e-5 [m], which is error of the GIAJ altitude parameter.

Notes, this is not compatible to GIAJ web app/APIs (but more accurate).

Parameters:
  • latitude – the latitude [deg] of the point which satisfies 0.0 <= and <= 66.666…

  • longitude – the longitude [deg] of the point which satisfies 100.0 <= and <= 180.0

  • altitude – the altitude [m] of the point

Returns:

the transformed point

Raises:

Examples

From SemiDynaEXE2023.par

Notes, the exact solution is Point(36.10377479, 140.087855041, 2.34). In this case, no error remains.

>>> tf = Transformer(
...     data=ParData(
...         format="SemiDynaEXE",
...         parameter={
...             54401005: Parameter(-0.00622, 0.01516, 0.0946),
...             54401055: Parameter(-0.0062, 0.01529, 0.08972),
...             54401100: Parameter(-0.00663, 0.01492, 0.10374),
...             54401150: Parameter(-0.00664, 0.01506, 0.10087),
...         },
...     )
... )
>>> tf.backward(36.103773017086695, 140.08785924333452, 2.4363138578103)
Point(latitude=36.10377479, longitude=140.087855041, altitude=2.34)
backward_compat(latitude: float, longitude: float, altitude: float = 0.0) Point#

Returns the backward-transformed position compatible to GIAJ web app/APIs.

This is compatible to GIAJ web app/APIs, and is not exact as the original as.

Parameters:
  • latitude – the latitude [deg] of the point which satisfies 0.00333… <= and <= 66.666…

  • longitude – the longitude [deg] of the point which satisfies 100.0 <= and <= 180.0

  • altitude – the altitude [m] of the point

Returns:

the transformed point

Raises:

Examples

From SemiDynaEXE2023.par

Notes, the exact solution is Point(36.10377479, 140.087855041, 2.34).

>>> tf = Transformer(
...     data=ParData(
...         format="SemiDynaEXE",
...         parameter={
...             54401005: Parameter(-0.00622, 0.01516, 0.0946),
...             54401055: Parameter(-0.0062, 0.01529, 0.08972),
...             54401100: Parameter(-0.00663, 0.01492, 0.10374),
...             54401150: Parameter(-0.00664, 0.01506, 0.10087),
...         },
...     )
... )
>>> tf.backward_compat(36.103773017086695, 140.08785924333452, 2.4363138578103)
Point(latitude=36.10377479000002, longitude=140.087855041, altitude=2.339999999578243)
backward_compat_corr(latitude: float, longitude: float) Correction#

Return the correction on backward-transformation compatible to GIAJ web app/APIs.

Used by Transformer.backward_compat().

Parameters:
  • latitude – the latitude [deg] of the point which satisfies 0.00333… <= and <= 66.666…

  • longitude – the longitude [deg] of the point which satisfies 100.0 <= and <= 180.0

Returns:

the correction on backward transformation

Raises:

Examples

From SemiDynaEXE2023.par

>>> tf = Transformer(
...     data=ParData(
...         format="SemiDynaEXE",
...         parameter={
...             54401005: Parameter(-0.00622, 0.01516, 0.0946),
...             54401055: Parameter(-0.0062, 0.01529, 0.08972),
...             54401100: Parameter(-0.00663, 0.01492, 0.10374),
...             54401150: Parameter(-0.00664, 0.01506, 0.10087),
...         },
...     )
... )
>>> tf.backward_compat_corr(36.103773017086695, 140.08785924333452)
Correction(latitude=1.7729133219831587e-06, longitude=-4.202334509042613e-06, altitude=-0.0963138582320569)
backward_corr(latitude: float, longitude: float) Correction#

Return the correction on backward-transformation.

Used by Transformer.backward().

Parameters:
  • latitude – the latitude [deg] of the point which satisfies 0.0 <= and <= 66.666…

  • longitude – the longitude [deg] of the point which satisfies 100.0 <= and <= 180.0

Returns:

the correction on backward transformation

Raises:

Examples

From SemiDynaEXE2023.par

>>> tf = Transformer(
...     data=ParData(
...         format="SemiDynaEXE",
...         parameter={
...             54401005: Parameter(-0.00622, 0.01516, 0.0946),
...             54401055: Parameter(-0.0062, 0.01529, 0.08972),
...             54401100: Parameter(-0.00663, 0.01492, 0.10374),
...             54401150: Parameter(-0.00664, 0.01506, 0.10087),
...         },
...     )
... )
>>> tf.backward_corr(36.103773017086695, 140.08785924333452)
Correction(latitude=1.7729133100878255e-06, longitude=-4.202334510058886e-06, altitude=-0.09631385781030007)
forward(latitude: float, longitude: float, altitude: float = 0.0) Point#

Returns the forward-transformed position.

Parameters:
  • latitude – the latitude [deg] of the point which satisfies 0.0 <= and <= 66.666…

  • longitude – the longitude [deg] of the point which satisfies 100.0 <= and <= 180.0

  • altitude – the altitude [m] of the point

Returns:

the transformed point

Raises:

Examples

From SemiDynaEXE2023.par

>>> tf = Transformer(
...     data=ParData(
...         format="SemiDynaEXE",
...         parameter={
...             54401005: Parameter(-0.00622, 0.01516, 0.0946),
...             54401055: Parameter(-0.0062, 0.01529, 0.08972),
...             54401100: Parameter(-0.00663, 0.01492, 0.10374),
...             54401150: Parameter(-0.00664, 0.01506, 0.10087),
...         },
...     )
... )
>>> tf.forward(36.10377479, 140.087855041, 2.34)
Point(latitude=36.103773017086695, longitude=140.08785924333452, altitude=2.4363138578103)
forward_corr(latitude: float, longitude: float) Correction#

Return the correction on forward-transformation.

Used by Transformer.forward().

Parameters:
  • latitude – the latitude [deg] of the point which satisfies 0.0 <= and <= 66.666…

  • longitude – the longitude [deg] of the point which satisfies 100.0 <= and <= 180.0

Returns:

the correction on forward transformation

Raises:

Examples

From SemiDynaEXE2023.par

>>> tf = Transformer(
...     data=ParData(
...         format="SemiDynaEXE",
...         parameter={
...             54401005: Parameter(-0.00622, 0.01516, 0.0946),
...             54401055: Parameter(-0.0062, 0.01529, 0.08972),
...             54401100: Parameter(-0.00663, 0.01492, 0.10374),
...             54401150: Parameter(-0.00664, 0.01506, 0.10087),
...         },
...     )
... )
>>> tf.forward_corr(36.10377479, 140.087855041)
Correction(latitude=-1.7729133100878255e-06, longitude=4.202334510058886e-06, altitude=0.09631385781030007)
classmethod from_dict(obj: _types.ParDataLikeMappingType) Self#

Makes a Transformer obj from Mapping obj.

This parses meshcode, the key of parameter, into int.

See FormatType for detail of 'PatchJGD_HV'.

Parameters:

obj – the Mapping of the format, the parameters, and the description (optional)

Returns:

the Transformer obj

Raises:

DeserializeError – when fail to parse the meshcode

Examples

>>> mapping = {
...     'format': 'SemiDynaEXE',
...     'parameter': {
...         12345678: {
...             'latitude': 0.1,
...             'longitude': 0.2,
...             'altitude': 0.3,
...         },
...         ...
...     },
...     'description': 'important my param',  # optional
... }
>>> tf = Transformer.from_dict(mapping)
>>> tf.data
ParData(
    format='SemiDynaEXE',
    parameter={
        12345678: Parameter('latitude': 0.1, 'longitude': 0.2, 'altitude': 0.3),
        ...
    },
    description='important my param'
)
>>> mapping = {
...     'format': 'SemiDynaEXE',
...     'parameter': {
...         '12345678': {
...             'latitude': 0.1,
...             'longitude': 0.2,
...             'altitude': 0.3,
...         },
...         ...
...     },
... }
>>> tf = Transformer.from_dict(mapping)
>>> tf.data
ParData(
    format='SemiDynaEXE',
    parameter={
        12345678: Parameter('latitude': 0.1, 'longitude': 0.2, 'altitude': 0.3),
        ...
    },
    description='important my param'
)
transform(latitude: float, longitude: float, altitude: float = 0.0, backward: bool = False) Point#

Returns the transformed position.

Parameters:
  • latitude – the latitude [deg] of the point which satisfies 0.00333… <= and <= 66.666…

  • longitude – the longitude [deg] of the point which satisfies 100.0 <= and <= 180.0

  • altitude – the altitude [m] of the point

  • backward – when True, this performs backward transformation

Returns:

the transformed point

Raises:
  • ParameterNotFoundError – when latitude and longitude points to an area where the parameter does not support

  • ValueError – when latitude or longitude is unsupported value

Examples

From SemiDynaEXE2023.par

>>> tf = Transformer(
...     data=Pardata(
...         format="SemiDynaEXE",
...         parameter={
...             54401005: Parameter(-0.00622, 0.01516, 0.0946),
...             54401055: Parameter(-0.0062, 0.01529, 0.08972),
...             54401100: Parameter(-0.00663, 0.01492, 0.10374),
...             54401150: Parameter(-0.00664, 0.01506, 0.10087),
...         },
...     )
... )
>>> tf.transform(36.10377479, 140.087855041, 2.34, backward=False)
Point(latitude=36.103773017086695, longitude=140.08785924333452, altitude=2.4363138578103)
>>> tf.transform(
...     36.103773017086695, 140.08785924333452, 2.4363138578102994, backward=True
... )
Point(latitude=36.10377479, longitude=140.087855041, altitude=2.34)

Following identities hold:

>>> tf.transform(*point, backward=False) == tf.forward(*point)
True
>>> tf.transform(*point, backward=True) == tf.backward(*point)
True
data: ParameterSet#
class jgdtrans.ParameterSet(*args, **kwargs)#

Bases: Protocol

Interface for Transformer.

get(meshcode: int) Parameter | None#

Returns Parameter associated with meshcode, otherwise None.

mesh_unit() Literal[1, 5]#

Returns a mesh unit.

jgdtrans.load(fp: TextIO, format: _types.FormatType, *, description: str | None = None) Transformer#

Deserialize a par-formatted file-like obj into a Transformer.

This fills by 0.0 for altituse parameter when 'TKY2JGD' or 'PatchJGD' given to format, and for latitude and longitude when 'PatchJGD_H' or 'HyokoRev' given.

See FormatType for detail of 'PatchJGD_HV'.

Parameters:
  • fp – a par-formatted file-like obj

  • format – the format of fp

  • description – the description of the parameter, defaulting the fp header

Returns:

the Transformer obj

Raises:

ParseParFileError – when invalid data found

Examples

>>> with open("SemiDyna2023.par") as fp:
...     tf = load(fp, format="SemiDynaEXE")
>>> result = tf.transform(35.0, 145.0)
>>> s = '''<15 lines>
... MeshCode dB(sec)  dL(sec) dH(m)
... 12345678   0.00001   0.00002   0.00003'''
>>> with io.StringIO(s) as fp:
...     tf = load(fp, format="SemiDynaEXE")
Parameter(latitude=0.00001, longitude=0.0002, altitude=0.0003)
jgdtrans.loads(s: str, format: _types.FormatType, *, description: str | None = None) Transformer#

Deserialize a par-formatted str into a Transformer.

This fills by 0.0 for altituse parameter when 'TKY2JGD' or 'PatchJGD' given to format, and for latitude and longitude when 'PatchJGD_H' or 'HyokoRev' given.

See FormatType for detail of 'PatchJGD_HV'.

Parameters:
  • s – a par-formatted text

  • format – the format of s

  • description – the description of the parameter, defaulting the s header

Returns:

the Transformer obj

Raises:

ParseParFileError – when invalid data found

Examples

>>> s = '''<15 lines>
... MeshCode dB(sec)  dL(sec) dH(m)
... 12345678   0.00001   0.00002   0.00003'''
>>> tf = loads(s, format="SemiDynaEXE")
>>> result = tf.transform(35.0, 145.0)
>>> s = '''<15 lines>
... MeshCode dB(sec)  dL(sec) dH(m)
... 12345678   0.00001   0.00002   0.00003'''
>>> loads(s, format="SemiDynaEXE").parameter[12345678]
Parameter(latitude=0.00001, longitude=0.0002, altitude=0.0003)
jgdtrans.from_dict(obj) Transformer#

Makes a Transformer obj from Mapping obj.

This parses meshcode, the key of parameter, into int.

See FormatType for detail of 'PatchJGD_HV'.

Parameters:

obj – the Mapping of the format, the parameters, and the description (optional)

Returns:

the Transformer obj

Raises:

DeserializeError – when fail to parse the meshcode

Examples

>>> mapping = {
...     'format': 'SemiDynaEXE',
...     'parameter': {
...         12345678: {
...             'latitude': 0.1,
...             'longitude': 0.2,
...             'altitude': 0.3,
...         },
...         ...
...     },
...     'description': 'important my param',  # optional
... }
>>> tf = from_dict(mapping)
>>> tf.data
ParData(
    format='SemiDynaEXE',
    parameter={
        12345678: Parameter('latitude': 0.1, 'longitude': 0.2, 'altitude': 0.3),
        ...
    },
    description='important my param'
)
>>> mapping = {
...     'format': 'SemiDynaEXE',
...     'parameter': {
...         '12345678': {
...             'latitude': 0.1,
...             'longitude': 0.2,
...             'altitude': 0.3,
...         },
...         ...
...     },
... }
>>> tf = from_dict(mapping)
>>> tf.data
ParData(
    format='SemiDynaEXE',
    parameter={
        12345678: Parameter('latitude': 0.1, 'longitude': 0.2, 'altitude': 0.3),
        ...
    },
    description=None
)
class jgdtrans.Point(latitude: float, longitude: float, altitude: float = 0.0)#

Bases: Sequence[float]

A triplet of latitude, longitude and altitude.

This is Sequence[float] of lengh 3.

We note that latitude and longitude is DD notation, use Point.to_dms() and Point.from_dms() for converting to/from DMS notation.

Examples

>>> Point(36.10377479, 140.087855041)
Point(latitude=36.10377479, longitude=140.087855041, altitude=0.0)
>>> Point(36.10377479, 140.087855041, 2.340)
Point(latitude=36.10377479, longitude=140.087855041, altitude=2.340)
>>> point = Point(36.10377479, 140.087855041)
>>> len(point)
3
>>> for v in point:
...     print(v)
36.10377479
140.087855041
0.0
>>> point[0], point[1], point[2]
(36.10377479, 140.087855041, 0.0)
>>> lat, lng, alt = point
>>> lat, lng, alt
(36.10377479, 140.087855041, 0.0)
add(corr: Correction) Point#

Returns a Point which is self plus corr for each component.

This is not inplace.

Returns:

a Point obj

Examples

>>> point = Point(0.0, 0.0, 0.0)
>>> point.add(Correction(1.0, 2.0, 3.0))
Point(latitude=1.0, longitude=2.0, altitude=3.0)
>>> point
Point(latitude=0.0, longitude=0.0, altitude=0.0)
altitude: float = 0.0#

The altitude [m] of the point, defaulting 0.0.

classmethod from_dms(latitude: _dms.DMS | str, longitude: _dms.DMS | str, altitude: float = 0.0) Self#

Makes a Point from DMS notation latitude and longitdue (and altitude).

Parameters:
  • latitude – the latitude in DMS notation

  • longitude – the longitude in DMS notation

  • altitude – the altitude [m], defaulting 0.0

Returns:

a Point obj with the DD notation latitude and longitude

Raises:

ValueError – when latitude and/or longitude is invalied

Examples

>>> Point.from_dms("360613.58925", "1400516.27815")
Point(latitude=36.10377479166667, longitude=140.08785504166664, altitude=0.0)
classmethod from_meshcode(meshcode: int) Self#

Makes a Point (the latitude and the longitude) of the node represented by code.

Parameters:

meshcode – the meshcode

Returns:

a Point obj

Raises:

ValueError – when invalid code given

Examples

>>> Point.from_meshcode(54401027)
Point(latitude=36.1, longitude=140.0875, altitude=0.0)
classmethod from_node(node: _mesh.MeshNode) Self#

Makes a Point which pointing a node represented by meshcode.

The resulting altitude is 0.0.

Parameters:

node – the mesh node

Returns:

the point (the altitude is 0.0)

Examples

>>> node = MeshNode(MeshCoord(54, 1, 2), MeshCoord(40, 0, 7))
>>> Point.from_node(node)
Point(latitude=36.1, longitude=140.0875, altitude=0.0)
mesh_cell(mesh_unit: _types.MeshUnitType) _mesh.MeshCell#

Returns the unit mesh cell containing self.

Parameters:

mesh_unit – The mesh unit, 1 or 5

Returns:

the unit mesh cell containing self

Raises:

ValueError – when latitude and/or longitude is negative, or such MeshCell is not found

Examples

>>> point = Point(36.10377479, 140.087855041)
>>> point.mesh_cell(mesh_unit=1)
MeshCell(
    south_west=MeshNode(MeshCoord(54, 1, 2), MeshCoord(40, 0, 7)),
    south_east=MeshNode(MeshCoord(54, 1, 2), MeshCoord(40, 0, 8)),
    north_west=MeshNode(MeshCoord(54, 1, 3), MeshCoord(40, 0, 7)),
    north_east=MeshNode(MeshCoord(54, 1, 3), MeshCoord(40, 0, 8)),
    unit=1,
)
>>> point.mesh_cell(mesh_unit=5)
MeshCell(
    south_west=MeshNode(MeshCoord(54, 1, 0), MeshCoord(40, 0, 5)),
    south_east=MeshNode(MeshCoord(54, 1, 0), MeshCoord(40, 1, 0)),
    north_west=MeshNode(MeshCoord(54, 1, 5), MeshCoord(40, 0, 5)),
    north_east=MeshNode(MeshCoord(54, 1, 5), MeshCoord(40, 1, 0)),
    unit=5,
)
mesh_node(mesh_unit: _types.MeshUnitType) _mesh.MeshNode#

Returns the nearest south-east mesh node of self.

We note that the result does not depend on the Point.altitude.

Parameters:

mesh_unit – The mesh unit, 1 or 5

Returns:

a MeshNode

Raises:

ValueError – when latitude and/or longitude is negative

Examples

>>> point = Point(36.103774791666666, 140.08785504166664, 10.0)
>>> point.mesh_node(point, 1)
MeshNode(MeshCode(54, 1, 2), MeshCode(40, 0, 7))
>>> point.mesh_node(point, 5)
MeshNode(MeshCode(54, 1, 0), MeshCode(40, 0, 5))
normalize() Point#

Returns a new normalized Point obj.

The resulting Point obj has normalized latitude and longitude which value -90.0 <= and <= 90.0, and -180.0 <= and <= 180.0 respectively.

Returns:

The normalized point, not null.

Examples

>>> Point(100.0, 200.0, 5.0).normalize()
Point(latitude=80.0, longitude=-160.0, altitude=5.0)
sub(corr: Correction) Point#

Returns a Point which is self substruct corr for each component.

This is not inplace.

Returns:

a Point obj

Examples

>>> point = Point(0.0, 0.0, 0.0)
>>> point.sub(Correction(1.0, 2.0, 3.0))
Point(latitude=-1.0, longitude=-2.0, altitude=-3.0)
>>> point
Point(latitude=0.0, longitude=0.0, altitude=0.0)
to_dms() tuple[str, str, float]#

Returns the point with the DMS notation latitude and longitude.

Returns:

a tuple of latitude, longtitude and altitude

Examples

>>> point = Point.from_dms("360613.58925", "1400516.27815")
>>> point.to_dms()
('360613.58925', '1400516.27815', 0.0)
to_meshcode(mesh_unit: _types.MeshUnitType) int#

Returns the meshcode of the nearest south-east mesh node of self.

Parameters:

mesh_unit – The mesh unit, 1 or 5

Returns:

the meshcode

Raises:

ValueError – when latitude and/or longitude is negative

Examples

>>> point = Point(36.103774791666666, 140.08785504166664, 10.0)
>>> point.to_meshcode(1)
54401027
>>> point = Point(36.103774791666666, 140.08785504166664, 10.0)
>>> point.to_meshcode(5)
54401005
latitude: float#

The latitude [deg] of the point which satisfies -90.0 <= and <= 90.0.

longitude: float#

The longitude [deg] of the point which satisfies -180.0 <= and <= 180.0.

exception jgdtrans.ParameterNotFoundError#

Bases: Error, LookupError

Parameter not found.

exception jgdtrans.CorrectionNotFoundError#

Bases: Error, ValueError

Error is greater than criteria.

exception jgdtrans.ParseParFileError#

Bases: Error, ValueError

Failed to parse par file.

exception jgdtrans.PointOutOfBoundsError#

Bases: Error, ValueError

Error is greater than criteria.