pylunar 0.7.4__tar.gz → 0.9.0__tar.gz

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.
Files changed (42) hide show
  1. {pylunar-0.7.4 → pylunar-0.9.0}/.pre-commit-config.yaml +4 -4
  2. {pylunar-0.7.4 → pylunar-0.9.0}/CONTRIBUTING.rst +2 -3
  3. {pylunar-0.7.4 → pylunar-0.9.0}/HISTORY.rst +40 -0
  4. {pylunar-0.7.4 → pylunar-0.9.0}/Makefile +1 -0
  5. {pylunar-0.7.4 → pylunar-0.9.0}/PKG-INFO +6 -7
  6. {pylunar-0.7.4 → pylunar-0.9.0}/docs/usage.rst +4 -4
  7. {pylunar-0.7.4 → pylunar-0.9.0}/pyproject.toml +14 -10
  8. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar/__init__.py +2 -0
  9. pylunar-0.9.0/src/pylunar/altitude_dict.py +56 -0
  10. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar/lunar_feature.py +1 -1
  11. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar/lunar_feature_container.py +3 -3
  12. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar/moon_info.py +25 -2
  13. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar/pkg_types.py +7 -7
  14. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar.egg-info/PKG-INFO +6 -7
  15. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar.egg-info/SOURCES.txt +2 -0
  16. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar.egg-info/requires.txt +4 -13
  17. pylunar-0.9.0/tests/test_altitude_dict.py +31 -0
  18. {pylunar-0.7.4 → pylunar-0.9.0}/tests/test_moon_info.py +17 -0
  19. {pylunar-0.7.4 → pylunar-0.9.0}/AUTHORS.rst +0 -0
  20. {pylunar-0.7.4 → pylunar-0.9.0}/LICENSE +0 -0
  21. {pylunar-0.7.4 → pylunar-0.9.0}/MANIFEST.in +0 -0
  22. {pylunar-0.7.4 → pylunar-0.9.0}/README.rst +0 -0
  23. {pylunar-0.7.4 → pylunar-0.9.0}/docs/Makefile +0 -0
  24. {pylunar-0.7.4 → pylunar-0.9.0}/docs/authors.rst +0 -0
  25. {pylunar-0.7.4 → pylunar-0.9.0}/docs/conf.py +0 -0
  26. {pylunar-0.7.4 → pylunar-0.9.0}/docs/contributing.rst +0 -0
  27. {pylunar-0.7.4 → pylunar-0.9.0}/docs/history.rst +0 -0
  28. {pylunar-0.7.4 → pylunar-0.9.0}/docs/index.rst +0 -0
  29. {pylunar-0.7.4 → pylunar-0.9.0}/docs/installation.rst +0 -0
  30. {pylunar-0.7.4 → pylunar-0.9.0}/docs/make.bat +0 -0
  31. {pylunar-0.7.4 → pylunar-0.9.0}/renovate.json +0 -0
  32. {pylunar-0.7.4 → pylunar-0.9.0}/scripts/startup.py +0 -0
  33. {pylunar-0.7.4 → pylunar-0.9.0}/setup.cfg +0 -0
  34. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar/data/lunar.db +0 -0
  35. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar/helpers.py +0 -0
  36. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar.egg-info/dependency_links.txt +0 -0
  37. {pylunar-0.7.4 → pylunar-0.9.0}/src/pylunar.egg-info/top_level.txt +0 -0
  38. {pylunar-0.7.4 → pylunar-0.9.0}/tests/__init__.py +0 -0
  39. {pylunar-0.7.4 → pylunar-0.9.0}/tests/test_helpers.py +0 -0
  40. {pylunar-0.7.4 → pylunar-0.9.0}/tests/test_lunar_feature.py +0 -0
  41. {pylunar-0.7.4 → pylunar-0.9.0}/tests/test_lunar_feature_container.py +0 -0
  42. {pylunar-0.7.4 → pylunar-0.9.0}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v4.6.0
3
+ rev: v5.0.0
4
4
  hooks:
5
5
  - id: check-merge-conflict
6
6
  - id: check-toml
@@ -8,21 +8,21 @@ repos:
8
8
  - id: trailing-whitespace
9
9
 
10
10
  - repo: https://github.com/astral-sh/ruff-pre-commit
11
- rev: v0.6.8
11
+ rev: v0.8.2
12
12
  hooks:
13
13
  - id: ruff
14
14
  args: [--fix, --exit-non-zero-on-fix]
15
15
  - id: ruff-format
16
16
 
17
17
  - repo: https://github.com/pre-commit/mirrors-mypy
18
- rev: v1.11.2
18
+ rev: v1.13.0
19
19
  hooks:
20
20
  - id: mypy
21
21
  args: [--strict]
22
22
  additional_dependencies: [types-pytz==2024.2.0.20240913]
23
23
 
24
24
  - repo: https://github.com/numpy/numpydoc
25
- rev: v1.6.0
25
+ rev: v1.8.0
26
26
  hooks:
27
27
  - id: numpydoc-validation
28
28
 
@@ -93,9 +93,8 @@ Pull Request Guidelines
93
93
  Before you submit a pull request, check that it meets these guidelines:
94
94
 
95
95
  #. The pull request should include tests.
96
- #. If the pull request adds functionality, the docs should be updated. Put
97
- your new functionality into a function with a docstring, and add the
98
- feature to the list in HISTORY.rst.
96
+ #. If the pull request adds functionality, put your new functionality into a
97
+ function with a docstring. Run ``scriv create`` to add a changelog fragment and fill out the appropriate section for the change. Add that to the commits for the pull request.
99
98
  #. The pull request should work for the supported range of Python versions.
100
99
  The pull request will run GitHub actions to perform those checks.
101
100
  Check https://github.com/mareuter/pylunar/pulls
@@ -2,6 +2,46 @@
2
2
 
3
3
  History
4
4
  -------
5
+ .. scriv-insert-here
6
+
7
+ .. _changelog-0.9.0:
8
+
9
+ 0.9.0 (2024-12-10)
10
+ ++++++++++++++++++
11
+
12
+ Changed
13
+ ^^^^^^^
14
+
15
+ - Remove Python 3.8 support.
16
+ - Add Python 3.13 support.
17
+
18
+ Fixed
19
+ ^^^^^
20
+
21
+ - Issues from pre-commit config version updates.
22
+
23
+ .. _changelog-0.8.0:
24
+
25
+ 0.8.0 (2024-11-09)
26
+ ++++++++++++++++++
27
+
28
+ Added
29
+ ^^^^^
30
+
31
+ - Solar altitude over lunar feature calculation
32
+ - AltitudeDict class to provide solar altitude for Lunar II features
33
+ - Use scriv for history generation
34
+
35
+ Changed
36
+ ^^^^^^^
37
+
38
+ - OS version for readthedocs build
39
+ - Updated CONTRIBUTING.rst to add scriv usage
40
+
41
+ Fixed
42
+ ^^^^^
43
+
44
+ - Internal class cross-references in docs
5
45
 
6
46
  0.7.4 (2024-10-27)
7
47
  ++++++++++++++++++
@@ -17,6 +17,7 @@ help:
17
17
  init:
18
18
  pip install --editable .[dev]
19
19
  pre-commit install
20
+ mkdir changelog.d
20
21
 
21
22
  clean: clean-build clean-docs clean-pyc
22
23
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylunar
3
- Version: 0.7.4
3
+ Version: 0.9.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
@@ -10,11 +10,11 @@ Classifier: Intended Audience :: Developers
10
10
  Classifier: License :: OSI Approved :: BSD License
11
11
  Classifier: Natural Language :: English
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.8
14
13
  Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
18
  Description-Content-Type: text/x-rst
19
19
  License-File: LICENSE
20
20
  License-File: AUTHORS.rst
@@ -24,20 +24,19 @@ Requires-Dist: typing-extensions==4.12.2; python_version < "3.10"
24
24
  Requires-Dist: pytz==2024.2
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: pylunar[build,docs,lint,test]; extra == "dev"
27
+ Requires-Dist: scriv==1.5.1; extra == "dev"
27
28
  Requires-Dist: tox==4.23.2; extra == "dev"
28
29
  Provides-Extra: test
29
- Requires-Dist: coverage[toml]==7.6.1; python_version < "3.9" and extra == "test"
30
- Requires-Dist: coverage[toml]==7.6.4; python_version >= "3.9" and extra == "test"
30
+ Requires-Dist: coverage[toml]==7.6.9; extra == "test"
31
31
  Requires-Dist: pytest==8.3.3; extra == "test"
32
32
  Provides-Extra: lint
33
- Requires-Dist: pre-commit==3.5.0; python_version < "3.9" and extra == "lint"
34
- Requires-Dist: pre-commit==3.8.0; python_version >= "3.9" and extra == "lint"
33
+ Requires-Dist: pre-commit==4.0.1; extra == "lint"
35
34
  Provides-Extra: build
36
35
  Requires-Dist: build==1.2.2.post1; extra == "build"
37
36
  Requires-Dist: twine==5.1.1; extra == "build"
38
37
  Provides-Extra: docs
39
38
  Requires-Dist: sphinx~=7.1; extra == "docs"
40
- Requires-Dist: sphinx_rtd_theme==2.0.0; extra == "docs"
39
+ Requires-Dist: sphinx_rtd_theme==3.0.2; extra == "docs"
41
40
 
42
41
  =============================
43
42
  Python Lunar
@@ -22,22 +22,22 @@ API requires UTC, so add 4 hours since on Daylight Savings (changes day)
22
22
  >>> mi.phase_name()
23
23
  'WAXING_GIBBOUS'
24
24
 
25
- This package also contains the :py:class:`.LunarFeatureContainer` class which holds features on the moon for the Astronomical League's Lunar Club and Lunar II observing programs. To create a container for the Lunar Club program, do.
25
+ This package also contains the :py:class:`pylunar.LunarFeatureContainer` class which holds features on the moon for the Astronomical League's Lunar Club and Lunar II observing programs. To create a container for the Lunar Club program, do.
26
26
 
27
27
  >>> lc = pylunar.LunarFeatureContainer("Lunar")
28
28
  >>> lc.load()
29
29
  >>> len(lc)
30
30
  90
31
31
 
32
- There are 90 features available to this observing program. The container allows one to filter those features based on the position of the lunar terminator with respect to a given feature. The :py:meth:`.LunarFeatureContainer.load` method can be passed a :py:class:`.MoonInfo` instance to perform that filtering.
32
+ There are 90 features available to this observing program. The container allows one to filter those features based on the position of the lunar terminator with respect to a given feature. The :py:meth:`pylunar.LunarFeatureContainer.load` method can be passed a :py:class:`pylunar.MoonInfo` instance to perform that filtering.
33
33
 
34
34
  >>> lc.load(mi)
35
35
  >>> len(lc)
36
36
  12
37
37
 
38
- A container for Lunar II can be created by passing the `LunarII` string to the constructor of :py:class:`.LunarFeatureContainer`.
38
+ A container for Lunar II can be created by passing the `LunarII` string to the constructor of :py:class:`pylunar.LunarFeatureContainer`.
39
39
 
40
- Feature instances (:py:class:`.LunarFeature`) can be obtained from the container in usual manner.
40
+ Feature instances (:py:class:`pylunar.LunarFeature`) can be obtained from the container in usual manner.
41
41
 
42
42
  >>> for feature in lc:
43
43
  ... print(feature)
@@ -20,11 +20,11 @@ classifiers = [
20
20
  "License :: OSI Approved :: BSD License",
21
21
  "Natural Language :: English",
22
22
  "Programming Language :: Python :: 3",
23
- "Programming Language :: Python :: 3.8",
24
23
  "Programming Language :: Python :: 3.9",
25
24
  "Programming Language :: Python :: 3.10",
26
25
  "Programming Language :: Python :: 3.11",
27
26
  "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
28
  ]
29
29
  dependencies = [
30
30
  "ephem==4.1.6",
@@ -40,16 +40,15 @@ Repository = "https://github.com/mareuter/pylunar"
40
40
  [project.optional-dependencies]
41
41
  dev = [
42
42
  "pylunar[build,docs,lint,test]",
43
+ "scriv==1.5.1",
43
44
  "tox==4.23.2"
44
45
  ]
45
46
  test = [
46
- "coverage[toml]==7.6.1;python_version<'3.9'",
47
- "coverage[toml]==7.6.4;python_version>='3.9'",
47
+ "coverage[toml]==7.6.9",
48
48
  "pytest==8.3.3",
49
49
  ]
50
50
  lint = [
51
- "pre-commit==3.5.0;python_version<'3.9'",
52
- "pre-commit==3.8.0;python_version>='3.9'"
51
+ "pre-commit==4.0.1"
53
52
  ]
54
53
  build = [
55
54
  "build==1.2.2.post1",
@@ -57,7 +56,7 @@ build = [
57
56
  ]
58
57
  docs = [
59
58
  "sphinx~=7.1",
60
- "sphinx_rtd_theme==2.0.0"
59
+ "sphinx_rtd_theme==3.0.2"
61
60
  ]
62
61
 
63
62
  [tool.setuptools_scm]
@@ -68,11 +67,11 @@ exclude = [
68
67
  "scripts/startup.py"
69
68
 
70
69
  ]
71
- ignore = [
70
+ lint.ignore = [
72
71
  "D104"
73
72
  ]
74
73
  line-length = 110
75
- select = [
74
+ lint.select = [
76
75
  "B",
77
76
  "D",
78
77
  "E",
@@ -83,7 +82,7 @@ select = [
83
82
  "W"
84
83
  ]
85
84
 
86
- [tool.ruff.per-file-ignores]
85
+ [tool.ruff.lint.per-file-ignores]
87
86
  "src/pylunar/__init__.py" = [
88
87
  "E402",
89
88
  "F401",
@@ -95,7 +94,7 @@ select = [
95
94
  "D103",
96
95
  ]
97
96
 
98
- [tool.ruff.isort]
97
+ [tool.ruff.lint.isort]
99
98
  force-sort-within-sections = true
100
99
 
101
100
  [tool.ruff.lint.pydocstyle]
@@ -122,3 +121,8 @@ exclude = [
122
121
  "conf",
123
122
  "startup"
124
123
  ]
124
+
125
+ [tool.scriv]
126
+ entry_title_template = "{{ version }} ({{ date.strftime('%Y-%m-%d') }})"
127
+ output_file = "HISTORY.${config:format}"
128
+ rst_header_chars = "+^"
@@ -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
@@ -0,0 +1,56 @@
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
+
17
+ if sys.version_info >= (3, 10):
18
+ from importlib.resources import files
19
+ else:
20
+ from importlib_resources import files
21
+
22
+ import sqlite3
23
+
24
+ from .lunar_feature import LunarFeature
25
+ from .moon_info import MoonInfo
26
+
27
+ __all__ = ["AltitudeDict"]
28
+
29
+
30
+ class AltitudeDict(dict[str, float]):
31
+ """Dictionary for the Lunar II features requiring solar altitude."""
32
+
33
+ def load(self, moon_info: MoonInfo) -> None:
34
+ """Provide solar altitude for the Lunar II features.
35
+
36
+ Parameters
37
+ ----------
38
+ moon_info : :class:`pylunar.MoonInfo`
39
+ Instance of the Lunar information class.
40
+ """
41
+ features = ["Byrgius A", "Proclus", "Rupes Recta", "Tycho"]
42
+ dbname = str(files("pylunar.data").joinpath("lunar.db"))
43
+ conn = sqlite3.connect(dbname)
44
+ cur = conn.cursor()
45
+
46
+ sql = f"select * from Features where Name in {str(tuple(features))}"
47
+ cur.execute(sql)
48
+
49
+ feature_list = []
50
+ for row in cur:
51
+ feature_list.append(LunarFeature.from_row(row))
52
+
53
+ for feature in sorted(feature_list, key=lambda x: x.name):
54
+ self[feature.name] = moon_info.solar_altitude(feature)
55
+
56
+ cur.close()
@@ -108,7 +108,7 @@ class LunarFeature:
108
108
 
109
109
  Returns
110
110
  -------
111
- :class:`.LunarFeature`
111
+ :class:`pylunar.LunarFeature`
112
112
  Class initialized from database row.
113
113
  """
114
114
  return cls(*row[1:])
@@ -15,8 +15,8 @@ from __future__ import annotations
15
15
  __all__ = ["LunarFeatureContainer"]
16
16
 
17
17
  import collections
18
+ from collections.abc import Generator
18
19
  import sys
19
- from typing import Generator
20
20
 
21
21
  if sys.version_info >= (3, 10):
22
22
  from importlib.resources import files
@@ -52,7 +52,7 @@ class LunarFeatureContainer:
52
52
 
53
53
  Yields
54
54
  ------
55
- :class:`.LunarFeature`
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:`.MoonInfo`, optional
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.
@@ -266,7 +266,7 @@ class MoonInfo:
266
266
 
267
267
  Parameters
268
268
  ----------
269
- feature : :class:`.LunarFeature`
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:`.LunarFeature`
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
 
@@ -19,13 +19,13 @@ if sys.version_info >= (3, 10):
19
19
  else:
20
20
  from typing_extensions import TypeAlias
21
21
 
22
- from typing import List, Tuple, Union
22
+ from typing import Union
23
23
 
24
- DateTimeTuple: TypeAlias = Tuple[int, int, int, int, int, Union[int, float]]
25
- MoonPhases: TypeAlias = List[Tuple[str, Union[DateTimeTuple, str]]]
26
- DmsCoordinate: TypeAlias = Tuple[int, int, int]
27
- Range: TypeAlias = Tuple[float, float]
28
- LunarFeatureList: TypeAlias = Tuple[
24
+ DateTimeTuple: TypeAlias = Union[tuple[int, ...], tuple[int, int, int, int, int, float]]
25
+ MoonPhases: TypeAlias = list[tuple[str, Union[DateTimeTuple, str]]]
26
+ DmsCoordinate: TypeAlias = tuple[int, int, int]
27
+ Range: TypeAlias = tuple[float, float]
28
+ LunarFeatureList: TypeAlias = tuple[
29
29
  str, float, float, float, float, float, str, str, str, str, Union[str, None]
30
30
  ]
31
- FeatureRow: TypeAlias = Tuple[int, str, float, float, float, float, float, str, str, str, str, str]
31
+ FeatureRow: TypeAlias = tuple[int, str, float, float, float, float, float, str, str, str, str, str]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylunar
3
- Version: 0.7.4
3
+ Version: 0.9.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
@@ -10,11 +10,11 @@ Classifier: Intended Audience :: Developers
10
10
  Classifier: License :: OSI Approved :: BSD License
11
11
  Classifier: Natural Language :: English
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.8
14
13
  Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
18
  Description-Content-Type: text/x-rst
19
19
  License-File: LICENSE
20
20
  License-File: AUTHORS.rst
@@ -24,20 +24,19 @@ Requires-Dist: typing-extensions==4.12.2; python_version < "3.10"
24
24
  Requires-Dist: pytz==2024.2
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: pylunar[build,docs,lint,test]; extra == "dev"
27
+ Requires-Dist: scriv==1.5.1; extra == "dev"
27
28
  Requires-Dist: tox==4.23.2; extra == "dev"
28
29
  Provides-Extra: test
29
- Requires-Dist: coverage[toml]==7.6.1; python_version < "3.9" and extra == "test"
30
- Requires-Dist: coverage[toml]==7.6.4; python_version >= "3.9" and extra == "test"
30
+ Requires-Dist: coverage[toml]==7.6.9; extra == "test"
31
31
  Requires-Dist: pytest==8.3.3; extra == "test"
32
32
  Provides-Extra: lint
33
- Requires-Dist: pre-commit==3.5.0; python_version < "3.9" and extra == "lint"
34
- Requires-Dist: pre-commit==3.8.0; python_version >= "3.9" and extra == "lint"
33
+ Requires-Dist: pre-commit==4.0.1; extra == "lint"
35
34
  Provides-Extra: build
36
35
  Requires-Dist: build==1.2.2.post1; extra == "build"
37
36
  Requires-Dist: twine==5.1.1; extra == "build"
38
37
  Provides-Extra: docs
39
38
  Requires-Dist: sphinx~=7.1; extra == "docs"
40
- Requires-Dist: sphinx_rtd_theme==2.0.0; extra == "docs"
39
+ Requires-Dist: sphinx_rtd_theme==3.0.2; extra == "docs"
41
40
 
42
41
  =============================
43
42
  Python Lunar
@@ -20,6 +20,7 @@ docs/make.bat
20
20
  docs/usage.rst
21
21
  scripts/startup.py
22
22
  src/pylunar/__init__.py
23
+ src/pylunar/altitude_dict.py
23
24
  src/pylunar/helpers.py
24
25
  src/pylunar/lunar_feature.py
25
26
  src/pylunar/lunar_feature_container.py
@@ -32,6 +33,7 @@ src/pylunar.egg-info/requires.txt
32
33
  src/pylunar.egg-info/top_level.txt
33
34
  src/pylunar/data/lunar.db
34
35
  tests/__init__.py
36
+ tests/test_altitude_dict.py
35
37
  tests/test_helpers.py
36
38
  tests/test_lunar_feature.py
37
39
  tests/test_lunar_feature_container.py
@@ -11,25 +11,16 @@ twine==5.1.1
11
11
 
12
12
  [dev]
13
13
  pylunar[build,docs,lint,test]
14
+ scriv==1.5.1
14
15
  tox==4.23.2
15
16
 
16
17
  [docs]
17
18
  sphinx~=7.1
18
- sphinx_rtd_theme==2.0.0
19
+ sphinx_rtd_theme==3.0.2
19
20
 
20
21
  [lint]
21
-
22
- [lint:python_version < "3.9"]
23
- pre-commit==3.5.0
24
-
25
- [lint:python_version >= "3.9"]
26
- pre-commit==3.8.0
22
+ pre-commit==4.0.1
27
23
 
28
24
  [test]
25
+ coverage[toml]==7.6.9
29
26
  pytest==8.3.3
30
-
31
- [test:python_version < "3.9"]
32
- coverage[toml]==7.6.1
33
-
34
- [test:python_version >= "3.9"]
35
- coverage[toml]==7.6.4
@@ -0,0 +1,31 @@
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
+ """Tests for AltitudeDict class."""
12
+
13
+ from pylunar import AltitudeDict, MoonInfo
14
+
15
+
16
+ class TestAltitudeDict:
17
+ def setup_class(self) -> None:
18
+ self.ad = AltitudeDict()
19
+
20
+ def test_basic_information_after_creation(self) -> None:
21
+ assert len(self.ad) == 0
22
+
23
+ def test_information_after_load(self) -> None:
24
+ location = ((35, 58, 10), (-84, 19, 0))
25
+ mi = MoonInfo(location[0], location[1])
26
+ mi.update((2013, 10, 12, 18, 0, 0))
27
+
28
+ self.ad.load(mi)
29
+ assert len(self.ad) == 4
30
+ assert list(self.ad.keys()) == ["Byrgius A", "Proclus", "Rupes Recta", "Tycho"]
31
+ assert self.ad["Rupes Recta"] == 1.3038753306292297
@@ -251,3 +251,20 @@ class TestMoonInfo:
251
251
  assert self.mi.is_libration_ok(feature1) is False
252
252
  assert self.mi.is_libration_ok(feature2) is False
253
253
  assert self.mi.is_libration_ok(feature3) is True
254
+
255
+ def test_solar_altitude(self) -> None:
256
+ self.mi.update((1992, 4, 12, 0, 0, 0))
257
+ feature = LunarFeature(
258
+ "Copernicus",
259
+ 96.0699,
260
+ 9.62094521642403,
261
+ -20.078620508253,
262
+ 3.1684722900391,
263
+ 3.21326828003004,
264
+ "Crater",
265
+ "Copernicus",
266
+ "LAC-58",
267
+ "Lunar",
268
+ "Binocular",
269
+ )
270
+ assert self.mi.solar_altitude(feature) == 1.9649120982751562
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes