pylunar 0.7.4__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pylunar/__init__.py +2 -0
- pylunar/altitude_dict.py +57 -0
- pylunar/lunar_feature.py +1 -1
- pylunar/lunar_feature_container.py +2 -2
- pylunar/moon_info.py +25 -2
- {pylunar-0.7.4.dist-info → pylunar-0.8.0.dist-info}/METADATA +2 -1
- pylunar-0.8.0.dist-info/RECORD +14 -0
- {pylunar-0.7.4.dist-info → pylunar-0.8.0.dist-info}/WHEEL +1 -1
- pylunar-0.7.4.dist-info/RECORD +0 -13
- {pylunar-0.7.4.dist-info → pylunar-0.8.0.dist-info}/AUTHORS.rst +0 -0
- {pylunar-0.7.4.dist-info → pylunar-0.8.0.dist-info}/LICENSE +0 -0
- {pylunar-0.7.4.dist-info → pylunar-0.8.0.dist-info}/top_level.txt +0 -0
pylunar/__init__.py
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
# license that can be found in the LICENSE file.
|
10
10
|
|
11
11
|
__all__ = [
|
12
|
+
"AltitudeDict",
|
12
13
|
"__author__",
|
13
14
|
"__email__",
|
14
15
|
"__version__",
|
@@ -36,6 +37,7 @@ version_info = __version__.split(".")
|
|
36
37
|
Use this for version comparison.
|
37
38
|
"""
|
38
39
|
|
40
|
+
from .altitude_dict import AltitudeDict
|
39
41
|
from .helpers import mjd_to_date_tuple, tuple_to_string
|
40
42
|
from .lunar_feature import LunarFeature
|
41
43
|
from .lunar_feature_container import LunarFeatureContainer
|
pylunar/altitude_dict.py
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# This file is part of pylunar.
|
2
|
+
#
|
3
|
+
# Developed by Michael Reuter.
|
4
|
+
#
|
5
|
+
# See the LICENSE file at the top-level directory of this distribution
|
6
|
+
# for details of code ownership.
|
7
|
+
#
|
8
|
+
# Use of this source code is governed by a 3-clause BSD-style
|
9
|
+
# license that can be found in the LICENSE file.
|
10
|
+
|
11
|
+
"""Module for the AltitudeDict class."""
|
12
|
+
|
13
|
+
from __future__ import annotations
|
14
|
+
|
15
|
+
import sys
|
16
|
+
from typing import Dict
|
17
|
+
|
18
|
+
if sys.version_info >= (3, 10):
|
19
|
+
from importlib.resources import files
|
20
|
+
else:
|
21
|
+
from importlib_resources import files
|
22
|
+
|
23
|
+
import sqlite3
|
24
|
+
|
25
|
+
from .lunar_feature import LunarFeature
|
26
|
+
from .moon_info import MoonInfo
|
27
|
+
|
28
|
+
__all__ = ["AltitudeDict"]
|
29
|
+
|
30
|
+
|
31
|
+
class AltitudeDict(Dict[str, float]):
|
32
|
+
"""Dictionary for the Lunar II features requiring solar altitude."""
|
33
|
+
|
34
|
+
def load(self, moon_info: MoonInfo) -> None:
|
35
|
+
"""Provide solar altitude for the Lunar II features.
|
36
|
+
|
37
|
+
Parameters
|
38
|
+
----------
|
39
|
+
moon_info : :class:`pylunar.MoonInfo`
|
40
|
+
Instance of the Lunar information class.
|
41
|
+
"""
|
42
|
+
features = ["Byrgius A", "Proclus", "Rupes Recta", "Tycho"]
|
43
|
+
dbname = str(files("pylunar.data").joinpath("lunar.db"))
|
44
|
+
conn = sqlite3.connect(dbname)
|
45
|
+
cur = conn.cursor()
|
46
|
+
|
47
|
+
sql = f"select * from Features where Name in {str(tuple(features))}"
|
48
|
+
cur.execute(sql)
|
49
|
+
|
50
|
+
feature_list = []
|
51
|
+
for row in cur:
|
52
|
+
feature_list.append(LunarFeature.from_row(row))
|
53
|
+
|
54
|
+
for feature in sorted(feature_list, key=lambda x: x.name):
|
55
|
+
self[feature.name] = moon_info.solar_altitude(feature)
|
56
|
+
|
57
|
+
cur.close()
|
pylunar/lunar_feature.py
CHANGED
@@ -52,7 +52,7 @@ class LunarFeatureContainer:
|
|
52
52
|
|
53
53
|
Yields
|
54
54
|
------
|
55
|
-
:class
|
55
|
+
:class:`pylunar.LunarFeature`
|
56
56
|
The current lunar feature.
|
57
57
|
"""
|
58
58
|
yield from self.features.values()
|
@@ -72,7 +72,7 @@ class LunarFeatureContainer:
|
|
72
72
|
|
73
73
|
Parameters
|
74
74
|
----------
|
75
|
-
moon_info : :class
|
75
|
+
moon_info : :class:`pylunar.MoonInfo`, optional
|
76
76
|
Instance of the Lunar information class.
|
77
77
|
limit : int, optional
|
78
78
|
Restrict the number of features read to the given value.
|
pylunar/moon_info.py
CHANGED
@@ -266,7 +266,7 @@ class MoonInfo:
|
|
266
266
|
|
267
267
|
Parameters
|
268
268
|
----------
|
269
|
-
feature : :class
|
269
|
+
feature : :class:`pylunar.LunarFeature`
|
270
270
|
The lunar feature instance to check.
|
271
271
|
|
272
272
|
Returns
|
@@ -291,7 +291,7 @@ class MoonInfo:
|
|
291
291
|
|
292
292
|
Parameters
|
293
293
|
----------
|
294
|
-
feature : :class
|
294
|
+
feature : :class:`pylunar.LunarFeature`
|
295
295
|
The lunar feature instance to check.
|
296
296
|
|
297
297
|
Returns
|
@@ -556,6 +556,29 @@ class MoonInfo:
|
|
556
556
|
|
557
557
|
return sorted_times
|
558
558
|
|
559
|
+
def solar_altitude(self, feature: LunarFeature) -> float:
|
560
|
+
"""Find the altitude of the sun over a given feature.
|
561
|
+
|
562
|
+
Sunrise is near zero degrees, noon is near 90 degrees and sunset is
|
563
|
+
near 180 degrees.
|
564
|
+
|
565
|
+
Parameters
|
566
|
+
----------
|
567
|
+
feature : :class:`pylunar.LunarFeature`
|
568
|
+
Feature to calculate solar altitude.
|
569
|
+
|
570
|
+
Returns
|
571
|
+
-------
|
572
|
+
float
|
573
|
+
Solar altitude over feature in degrees.
|
574
|
+
"""
|
575
|
+
rad_ss_lat = math.radians(self.subsolar_lat())
|
576
|
+
rad_feature_lat = math.radians(feature.latitude)
|
577
|
+
term1 = math.sin(rad_ss_lat) * math.sin(rad_feature_lat)
|
578
|
+
term2a = math.cos(rad_ss_lat) * math.cos(rad_feature_lat)
|
579
|
+
term2b = math.sin(math.radians(self.colong() + feature.longitude))
|
580
|
+
return math.degrees(math.asin(term1 + term2a * term2b))
|
581
|
+
|
559
582
|
def subsolar_lat(self) -> float:
|
560
583
|
"""Latitude in degress on the moon where the sun is overhead.
|
561
584
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pylunar
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.8.0
|
4
4
|
Summary: Information for completing the Astronomical League's Lunar and Lunar II observing programs.
|
5
5
|
Author-email: Michael Reuter <mareuternh@gmail.com>
|
6
6
|
Project-URL: Documentation, http://pylunar.readthedocs.io
|
@@ -27,6 +27,7 @@ Requires-Dist: build==1.2.2.post1; extra == "build"
|
|
27
27
|
Requires-Dist: twine==5.1.1; extra == "build"
|
28
28
|
Provides-Extra: dev
|
29
29
|
Requires-Dist: pylunar[build,docs,lint,test]; extra == "dev"
|
30
|
+
Requires-Dist: scriv==1.5.1; extra == "dev"
|
30
31
|
Requires-Dist: tox==4.23.2; extra == "dev"
|
31
32
|
Provides-Extra: docs
|
32
33
|
Requires-Dist: sphinx~=7.1; extra == "docs"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
pylunar/__init__.py,sha256=1HgvGZdShUOeanMLMf2vNzdtyvcyAGtjvsytGxbaW00,1116
|
2
|
+
pylunar/altitude_dict.py,sha256=NEpnNvKmnOFlEF9VxXBANbsf1ks7G7xnu6ul_DfMpAo,1582
|
3
|
+
pylunar/helpers.py,sha256=UgEFvBGGZxTBaKx16-CjOO8hkqPA_GLRZN8SOgshZFs,1327
|
4
|
+
pylunar/lunar_feature.py,sha256=cqNFA7ED-u13H1rayo029GrQfPR3g1cYL-m_Q0zYNuQ,5532
|
5
|
+
pylunar/lunar_feature_container.py,sha256=dcV9Thd7AdQTllhkIKJ_lYGWW5jsj7a1ZpqTjq7BQ6Y,2810
|
6
|
+
pylunar/moon_info.py,sha256=n9sMgk8lDM18_D6hbC8AG0I9yQ7-FfwwQccah-LrqCs,20833
|
7
|
+
pylunar/pkg_types.py,sha256=DbPCc9_kzRuSOxOfeKaLJdWfykdbzRPnOTY-EN2xrsc,973
|
8
|
+
pylunar/data/lunar.db,sha256=y2u5wR_DpHjPYH7fuR-T_q0nbPzN1GuP8_OXorjVr14,28672
|
9
|
+
pylunar-0.8.0.dist-info/AUTHORS.rst,sha256=mqGQzrJPFGm44DZxZFs0d080QDWXdtfFlv1i_fdJerg,332
|
10
|
+
pylunar-0.8.0.dist-info/LICENSE,sha256=EF_CKfNhkKjEynpn9Msb6HaGNIBN9VfeGyrJFJQ5FYk,1479
|
11
|
+
pylunar-0.8.0.dist-info/METADATA,sha256=uafi1dvpjSpMogwlBYmbf2ch-0v9YaWfHY4Fktrh4gk,3277
|
12
|
+
pylunar-0.8.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
13
|
+
pylunar-0.8.0.dist-info/top_level.txt,sha256=vEQZCgYlUuoq6D4q99Kj5fSpNs2Mo-jW8vKV3dnpI-U,8
|
14
|
+
pylunar-0.8.0.dist-info/RECORD,,
|
pylunar-0.7.4.dist-info/RECORD
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
pylunar/__init__.py,sha256=-I-kK_YCtnOkwYPs2Qe9mCaanU5XJLnXxhHzNbKJpAk,1056
|
2
|
-
pylunar/helpers.py,sha256=UgEFvBGGZxTBaKx16-CjOO8hkqPA_GLRZN8SOgshZFs,1327
|
3
|
-
pylunar/lunar_feature.py,sha256=7geZ5cY_JPOS3F2Zyr4qutQi_fHzl-wXTCNEy80ox8w,5525
|
4
|
-
pylunar/lunar_feature_container.py,sha256=ud8-B_CqQ_0x9FSbkj2eHMPRT5PAwSai6D6tU9dGkQY,2796
|
5
|
-
pylunar/moon_info.py,sha256=fD6r0zcX2Q990zqHpYZt7I14HJOPEZyOBqmJx6FKjxI,19962
|
6
|
-
pylunar/pkg_types.py,sha256=DbPCc9_kzRuSOxOfeKaLJdWfykdbzRPnOTY-EN2xrsc,973
|
7
|
-
pylunar/data/lunar.db,sha256=y2u5wR_DpHjPYH7fuR-T_q0nbPzN1GuP8_OXorjVr14,28672
|
8
|
-
pylunar-0.7.4.dist-info/AUTHORS.rst,sha256=mqGQzrJPFGm44DZxZFs0d080QDWXdtfFlv1i_fdJerg,332
|
9
|
-
pylunar-0.7.4.dist-info/LICENSE,sha256=EF_CKfNhkKjEynpn9Msb6HaGNIBN9VfeGyrJFJQ5FYk,1479
|
10
|
-
pylunar-0.7.4.dist-info/METADATA,sha256=KVJo7EM7lIj-W4x0TLY7BwV5JvSQ4-3Wx1qQMmhFxB0,3233
|
11
|
-
pylunar-0.7.4.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
12
|
-
pylunar-0.7.4.dist-info/top_level.txt,sha256=vEQZCgYlUuoq6D4q99Kj5fSpNs2Mo-jW8vKV3dnpI-U,8
|
13
|
-
pylunar-0.7.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|