Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# End of a datablock
if line.strip() == "\\begintext":
datablock = False
continue
# Variable extraction
if datablock and line.strip().lower().startswith("body"):
# retrieval of body ID, parameter name and value
line = line.strip().lower().lstrip("body")
body_id, _, param = line.partition("_")
key, _, value = param.partition("=")
# If possible, retrieval of the name of the body
# if not, use the ID as name
name = target_names.get(int(body_id), body_id).title().strip()
# If already existing, check out the dictionary describing the body
# characteristics
body_dict = self.setdefault(name, {})
# Extraction of interesting data
value = value.strip()
# List of value scattered on multiple lines
if not value.endswith(")"):
for next_line in lines[i + 1 :]:
value += " " + next_line.strip()
if next_line.strip().endswith(")"):
break
value = [self.parse_float(v) for v in value[1:-2].split()]
if __name__ == "__main__": # pragma: no cover
import sys
config.update({"eop": {"missing_policy": "pass"}})
for file in sys.argv[1:]:
print(file)
print("*" * len(file))
for segment in SPK.open(file).segments:
start = Date(segment.start_jd - Date.JD_MJD)
end = Date(segment.end_jd - Date.JD_MJD)
center = target_names.get(segment.center, "Unknown")
target = target_names.get(segment.target, "Unknown")
print(
"from {start:{fmt}} to {end:{fmt}} : {center} -> {target}".format(
start=start, end=end, center=center, target=target, fmt="%Y-%m-%d"
)
)
print()
if __name__ == "__main__": # pragma: no cover
import sys
config.update({"eop": {"missing_policy": "pass"}})
for file in sys.argv[1:]:
print(file)
print("*" * len(file))
for segment in SPK.open(file).segments:
start = Date(segment.start_jd - Date.JD_MJD)
end = Date(segment.end_jd - Date.JD_MJD)
center = target_names.get(segment.center, "Unknown")
target = target_names.get(segment.target, "Unknown")
print(
"from {start:{fmt}} to {end:{fmt}} : {center} -> {target}".format(
start=start, end=end, center=center, target=target, fmt="%Y-%m-%d"
)
)
print()