Skip to content

Commit

Permalink
Merge pull request #24 from mareuter/add_lunar2_feature
Browse files Browse the repository at this point in the history
Add lunar2 feature
  • Loading branch information
mareuter authored Nov 10, 2024
2 parents 85e466b + dfd158d commit 6dd5a1e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ requires-python = ">=3.11"
dependencies = [
"fastapi==0.115.2",
"uvicorn[standard]==0.31.1",
"pylunar==0.7.3",
"pylunar==0.8.0",
"tzdata==2024.2"
]

Expand Down
3 changes: 2 additions & 1 deletion src/lct_web/models/lunar_two_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from pydantic import BaseModel

from ..pkg_types import FeatureDict
from ..pkg_types import AltitudeDict, FeatureDict

__all__ = ["LunarTwoResponse"]

Expand All @@ -24,3 +24,4 @@ class LunarTwoResponse(BaseModel):

features: FeatureDict
landing_sites: FeatureDict
altitudes: AltitudeDict
3 changes: 2 additions & 1 deletion src/lct_web/pkg_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

from pylunar.pkg_types import DateTimeTuple, LunarFeatureList

__all__ = ["NextFourPhases", "RiseSetTimes"]
__all__ = ["AltitudeDict", "FeatureDict", "NextFourPhases", "RiseSetTimes"]

AltitudeDict = dict[str, float]
FeatureDict = dict[str, LunarFeatureList]
NextFourPhases = dict[str, dict[str, str | DateTimeTuple]]
RiseSetTimes = dict[str, dict[str, str | DateTimeTuple]]
7 changes: 5 additions & 2 deletions src/lct_web/routers/lunar_two.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from __future__ import annotations

from fastapi import APIRouter
from pylunar import LunarFeatureContainer, MoonInfo
from pylunar import AltitudeDict, LunarFeatureContainer, MoonInfo

from ..dependencies import DateLocDeps
from ..helpers import format_date_and_location
Expand All @@ -38,6 +38,9 @@ def lunar_two(params: DateLocDeps) -> LunarTwoResponse:
lfc = LunarFeatureContainer("LunarII")
lfc.load(moon_info)

ad = AltitudeDict()
ad.load(moon_info)

features = {}
landing_sites = {}
for i, feature in enumerate(lfc):
Expand All @@ -46,4 +49,4 @@ def lunar_two(params: DateLocDeps) -> LunarTwoResponse:
else:
features[str(i)] = feature.list_from_feature()

return LunarTwoResponse(features=features, landing_sites=landing_sites)
return LunarTwoResponse(features=features, landing_sites=landing_sites, altitudes=ad)
1 change: 1 addition & 0 deletions tests/test_lunar_two.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ def test_lunar_two() -> None:
lunar_two_info = response.json()
assert len(lunar_two_info["features"]) == 11
assert len(lunar_two_info["landing_sites"]) == 16
assert len(lunar_two_info["altitudes"]) == 4

0 comments on commit 6dd5a1e

Please sign in to comment.