Coverage for csvforwkt/__init__.py: 93%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# -*- coding: utf-8 -*-
2# csvForWKT - csvForWKT is a python script that creates a WKT-crs for some bodies from the solar system. The content that is filled in the WKT-crs comes from the report of IAU Working Group on Cartographic.
3# Copyright (C) 2022 - CNES (Jean-Christophe Malapert for Pôle Surfaces Planétaires)
4#
5# This file is part of csvForWKT.
6#
7# csvForWKT is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Lesser General Public License v3 as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# csvForWKT is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Lesser General Public License v3 for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License v3
18# along with csvForWKT. If not, see <https://www.gnu.org/licenses/>.
19"""csvForWKT is a python script that creates a WKT-crs for solar system bodies.
20The physical content of the WKT-crs comes from the IAU Working Group on
21Cartographic Coordinates and Rotational Elements report.
23The workflow to generate the WKTs is described as follows:
25.. uml::
27 start
29 :Skip records from IAU report;
30 :Split bodies;
31 if (biaxial?) then (yes)
32 :Compute planetocentric description for sphere using median radius\n for Interoperability case;
33 :Add this CRS in the list;
34 if (is a body a Sphere?) then (yes)
35 else (no)
36 :compute planetocentric CRS;
37 :Add this CRS in the list;
38 endif
39 if (is a body a Sphere and (historical reason or retrograde movement) ?) then (yes)
40 else (no)
41 :Compute planetographic CRS;
42 :Add this CRS in the list;
43 endif
44 else (no)
45 :Create planetocentric description for sphere using median radius\n for Interoperability case;
46 :Add this CRS in the list;
47 :compute planetocentric CRS;
48 :Add this CRS in the list;
49 :Compute planetographic CRS;
50 :Add this CRS in the list;
51 endif
52 :merge CRS;
53 :Compute projected CRS;
55 stop
56"""
57import logging.config
58import os
59from logging import debug
60from logging import getLogger
61from logging import NullHandler
62from logging import setLogRecordFactory
63from logging import warning
65from ._version import __author__
66from ._version import __author_email__
67from ._version import __copyright__
68from ._version import __description__
69from ._version import __license__
70from ._version import __name_soft__
71from ._version import __title__
72from ._version import __url__
73from ._version import __version__
74from .custom_logging import LogRecord
75from .custom_logging import UtilsLogs
77getLogger(__name__).addHandler(NullHandler())
79UtilsLogs.add_logging_level("TRACE", 15)
80try:
81 PATH_TO_CONF = os.path.dirname(os.path.realpath(__file__))
82 logging.config.fileConfig(
83 os.path.join(PATH_TO_CONF, "logging.conf"),
84 disable_existing_loggers=False,
85 )
86 debug(f"file {os.path.join(PATH_TO_CONF, 'logging.conf')} loaded")
87except Exception as exception: # pylint: disable=broad-except
88 warning(f"cannot load logging.conf : {exception}")
89setLogRecordFactory(LogRecord) # pylint: disable=no-member