Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Rink
python
Commits
ed1a52fa
"...geosphere/geosphere-deploy.git" did not exist on "ca2eba30048ff1839b47da71b9121a36acb9439a"
Commit
ed1a52fa
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
minor...
parent
7aa4639b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/icing/moon_phase.py
+11
-6
11 additions, 6 deletions
modules/icing/moon_phase.py
with
11 additions
and
6 deletions
modules/icing/moon_phase.py
+
11
−
6
View file @
ed1a52fa
...
@@ -2,27 +2,32 @@ from skyfield import api
...
@@ -2,27 +2,32 @@ from skyfield import api
from
skyfield
import
almanac
from
skyfield
import
almanac
from
util.util
import
get_time_tuple_utc
from
util.util
import
get_time_tuple_utc
t
s
=
api
.
load
.
timescale
()
t
ime_scale
=
api
.
load
.
timescale
()
eph
=
api
.
load
(
'
de421.bsp
'
)
eph
=
api
.
load
(
'
de421.bsp
'
)
def
convert_time
(
epoch_time
):
def
convert_time
(
epoch_time
):
dt_obj
,
dt_tup
=
get_time_tuple_utc
(
epoch_time
)
dt_obj
,
dt_tup
=
get_time_tuple_utc
(
epoch_time
)
t
=
t
s
.
from_datetime
(
dt_obj
)
t
=
t
ime_scale
.
from_datetime
(
dt_obj
)
t
=
t
s
.
utc
(
dt_tup
[
0
],
dt_tup
[
1
],
dt_tup
[
2
],
dt_tup
[
3
])
t
=
t
ime_scale
.
utc
(
dt_tup
[
0
],
dt_tup
[
1
],
dt_tup
[
2
],
dt_tup
[
3
])
return
t
return
t
def
moon_phase
(
epoch_time
,
phs_deg
=
70
):
phase
=
almanac
.
moon_phase
(
eph
,
convert_time
(
epoch_time
))
return
(
phase
.
degrees
>
phs_deg
)
&
(
phase
.
degrees
<
360
-
phs_deg
)
def
convert_times
(
epoch_time_s
):
def
convert_times
(
epoch_time_s
):
dt_obj_s
=
[]
dt_obj_s
=
[]
for
et
in
epoch_time_s
:
for
et
in
epoch_time_s
:
dt_obj_s
.
append
(
get_time_tuple_utc
(
et
)[
0
])
dt_obj_s
.
append
(
get_time_tuple_utc
(
et
)[
0
])
t
=
t
s
.
from_datetimes
(
dt_obj_s
)
t
=
t
ime_scale
.
from_datetimes
(
dt_obj_s
)
return
t
return
t
def
moon_phase
(
dt_obj_s
,
phs_deg
=
70
):
def
moon_phase
s
(
dt_obj_s
,
phs_deg
=
70
):
t
=
t
s
.
from_datetimes
(
dt_obj_s
)
t
=
t
ime_scale
.
from_datetimes
(
dt_obj_s
)
phase
=
almanac
.
moon_phase
(
eph
,
t
)
phase
=
almanac
.
moon_phase
(
eph
,
t
)
return
(
phase
.
degrees
>
phs_deg
)
&
(
phase
.
degrees
<
360
-
phs_deg
)
return
(
phase
.
degrees
>
phs_deg
)
&
(
phase
.
degrees
<
360
-
phs_deg
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment