solresol / solar-panel-astronomy

Doing lunar astronomy using domestic solar panels
The Unlicense
0 stars 0 forks source link

Sweep: moonpos.py observer #4

Closed solresol closed 10 months ago

solresol commented 10 months ago

Details

Update moonpos.py so that it gives the azimuth and altitude relevant to the location of the observer. So it will need an extra two arguments --latitude and --longitude

Checklist - [X] Modify `moonpos.py` ✓ https://github.com/solresol/lunar-astronomy/commit/a9cd4caa9415b6dc99d1dbf9a7eea9883aa993b1 [Edit](https://github.com/solresol/lunar-astronomy/edit/sweep/moonpospy_observer/moonpos.py#L13-L15) - [X] Running GitHub Actions for `moonpos.py` ✗ [Edit](https://github.com/solresol/lunar-astronomy/edit/sweep/moonpospy_observer/moonpos.py#L13-L15) - [X] Modify `moonpos.py` ✓ https://github.com/solresol/lunar-astronomy/commit/238d7cc0fafad51db7624336873f1da656fee7ae [Edit](https://github.com/solresol/lunar-astronomy/edit/sweep/moonpospy_observer/moonpos.py#L6-L10) - [X] Running GitHub Actions for `moonpos.py` ✗ [Edit](https://github.com/solresol/lunar-astronomy/edit/sweep/moonpospy_observer/moonpos.py#L6-L10) - [X] Modify `moonpos.py` ! No changes made [Edit](https://github.com/solresol/lunar-astronomy/edit/sweep/moonpospy_observer/moonpos.py#L17-L19) - [X] Running GitHub Actions for `moonpos.py` ✗ [Edit](https://github.com/solresol/lunar-astronomy/edit/sweep/moonpospy_observer/moonpos.py#L17-L19)
ifost-autodev[bot] commented 10 months ago

🚀 Here's the PR! #5

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: None)

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)

GitHub Actions✓

Here are the GitHub Actions logs prior to making any changes:

Sandbox logs for 4669a5e
Checking moonpos.py for syntax errors... ✅ moonpos.py has no syntax errors! 1/1 ✓
Checking moonpos.py for syntax errors...
✅ moonpos.py has no syntax errors!

Sandbox passed on the latest main, so sandbox checks will be enabled for this issue.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/solresol/lunar-astronomy/blob/4669a5e75a54f6d52d0067b8f25dfe083a629291/moonpos.py#L5-L21

Step 2: ⌨️ Coding

--- 
+++ 
@@ -12,6 +12,8 @@
 def main():
     parser = argparse.ArgumentParser()
     parser.add_argument('--when', required=True, help='ISO formatted date and time')
+    parser.add_argument('--latitude', required=True, help='Observers latitude')
+    parser.add_argument('--longitude', required=True, help='Observers longitude')
     args = parser.parse_args()

     alt, az, phase = calculate_moon_position_and_phase(args.when)

Ran GitHub Actions for a9cd4caa9415b6dc99d1dbf9a7eea9883aa993b1:
• build:

--- 
+++ 
@@ -3,18 +3,22 @@
 import ephem

-def calculate_moon_position_and_phase(date_time):
+def calculate_moon_position_and_phase(date_time, latitude, longitude):
     observer = ephem.Observer()
     observer.date = date_time
+    observer.lat = latitude
+    observer.lon = longitude
     moon = ephem.Moon(observer)
     return moon.alt, moon.az, moon.phase

 def main():
     parser = argparse.ArgumentParser()
     parser.add_argument('--when', required=True, help='ISO formatted date and time')
+    parser.add_argument('--latitude', required=True, help='Observers latitude')
+    parser.add_argument('--longitude', required=True, help='Observers longitude')
     args = parser.parse_args()

-    alt, az, phase = calculate_moon_position_and_phase(args.when)
+    alt, az, phase = calculate_moon_position_and_phase(args.when, args.latitude, args.longitude)
     print(f'Moon Position: Altitude = {alt}, Azimuth = {az}')
     print(f'Moon Phase: {phase}')

Ran GitHub Actions for 238d7cc0fafad51db7624336873f1da656fee7ae:
• build:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/moonpospy_observer.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord