Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cesium-script
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🐍 Python packages 📦
cesium-script
Commits
61855921
Commit
61855921
authored
1 year ago
by
Rafael Andres
Browse files
Options
Downloads
Patches
Plain Diff
command line tool: generate_scene
parent
cf659fab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyproject.toml
+3
-0
3 additions, 0 deletions
pyproject.toml
src/cesium_script/scene_generator.py
+82
-0
82 additions, 0 deletions
src/cesium_script/scene_generator.py
with
85 additions
and
0 deletions
pyproject.toml
+
3
−
0
View file @
61855921
...
...
@@ -58,6 +58,9 @@ python-kacl = "*"
pyupgrade
=
"*"
tryceratops
=
"*"
[
tool.poetry.scripts
]
generate_scene
=
"cesium_script.scene_generator:cli"
[
build-system
]
requires
=
["poetry-core>
=
1.0
.
0
"]
build-backend
=
"poetry.core.masonry.api"
...
...
This diff is collapsed.
Click to expand it.
src/cesium_script/scene_generator.py
0 → 100644
+
82
−
0
View file @
61855921
"""
The script creates the contextual information of the S/C (position and attitude) including:
3D visualization
ground-track information
Sun illumination
in CZML format suitable for its visualizacion in the JUICE SOC cesium tool
"""
import
argparse
import
logging
import
spiceypy
as
sp
from
cesium_script.czml.scene
import
generate_czml
from
cesium_script.czml.utils
import
clean_utc
def
generate
(
mk_path
,
start_utc
,
end_utc
,
step
,
body
):
"""
_summary_
Args:
mk_path (str): path to the metakernel
start_utc (str): scene start using UTC scale and ISO format (e.g. 2032-07-02T14:22:25Z)
end_utc (str): scene end using UTC scale and ISO format (e.g. 2032-07-02T14:22:25Z)
step (int): step used for scene calculations
body (str): Orbiting body
Returns:
filename (str): the path of the CZML file
"""
sp
.
kclear
()
sp
.
furnsh
(
mk_path
)
doc
=
generate_czml
(
start_utc
,
end_utc
,
step
,
body
)
scene_id
=
f
"
jui_
{
body
.
lower
()[
:
3
]
}
_
{
clean_utc
(
start_utc
)
}
_
{
clean_utc
(
end_utc
)
}
"
filename
=
f
"
{
scene_id
}
.czml
"
with
open
(
filename
,
"
w
"
)
as
file
:
doc
.
dump
(
file
,
indent
=
2
)
message
=
f
"
{
filename
}
generated.
"
logging
.
info
(
message
)
return
filename
def
cli
(
args
=
None
):
"""
Process command line arguments.
"""
parser
=
argparse
.
ArgumentParser
(
description
=
"
Creates a CZML file containing the contextual information of the S/C (position and attitude)
"
)
parser
.
add_argument
(
"
-mk
"
,
"
--metakernel
"
,
type
=
str
,
help
=
"
the path to metakernel
"
,
required
=
True
)
parser
.
add_argument
(
"
-b
"
,
"
--body
"
,
type
=
str
,
help
=
"
Central body name. eg: Europa
"
,
required
=
True
)
parser
.
add_argument
(
"
-st
"
,
"
--start_utc
"
,
type
=
str
,
help
=
"
Scene start using UTC scale and ISO format (e.g. 2032-07-02T14:22:25Z)
"
,
required
=
True
,
)
parser
.
add_argument
(
"
-et
"
,
"
--end_utc
"
,
type
=
str
,
help
=
"
Scene end using UTC scale and ISO format (e.g. 2032-07-02T19:32:17Z)
"
,
required
=
True
,
)
parser
.
add_argument
(
"
-s
"
,
"
--step
"
,
type
=
int
,
help
=
"
Step size for SPICE calculations in seconds
"
,
required
=
True
,
)
args
=
parser
.
parse_args
()
logging
.
basicConfig
()
generate
(
args
.
metakernel
,
args
.
start_utc
,
args
.
end_utc
,
args
.
step
,
args
.
body
)
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