On the way to a core PlanetaryPy Package

Author

Michael Aye

Published

June 26, 2023

What is this?

  • PlanetaryPy organization is community effort to
    • develop a core Python package for planetary science
    • help other planetary science Python programmers to disseminate their work
  • This talk is about the core package status only.

Core package work plan

  • I am since long working on a core package draft.
  • Nothing is especially clever, the structured unification is the clue!
  • Shall be submitted (done?) to the community members for review.
  • After successful review open for public pull requests and hackathons.

Core package focal points

  • Easier access, download, and local management of
    • PDS data
    • SPICE kernels
  • Removing need to learn various web interfaces for different data
  • Working easier with collections of PDS data
  • Easy basic SPICE calculations with human readable I/F
  • Some web and time related utilities

PDS Indexes

PDS Indexes

  • PDS Indexes contain useful meta-data for PDS datasets
  • planetarypy provides access to these via a config file
    • pull requests to config file will add more findable indices!
  • config file tells planetarypy where to find index
  • planetarypy downloads index file and
  • stored as parquet file, ready for pandas based analysis.
  • tells user when new index is available

Example use

from planetarypy.pds.apps import get_index

df = get_index("cassini.iss", "index")
print(df.info())
df.head(3)["FILE_NAME IMAGE_MID_TIME IMAGE_OBSERVATION_TYPE".split()]
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 407299 entries, 0 to 407298
Columns: 140 entries, FILE_NAME to STANDARD_DATA_PRODUCT_ID
dtypes: Float64(70), Int64(20), datetime64[ns](7), string(43)
memory usage: 470.0 MB
None
FILE_NAME IMAGE_MID_TIME IMAGE_OBSERVATION_TYPE
0 N1454725799_1.IMG 2004-02-06 02:07:06.458 OPNAV
1 N1454726579_1.IMG 2004-02-06 02:20:06.362 OPNAV
2 N1454727359_1.IMG 2004-02-06 02:33:06.397 OPNAV

Instrument data

Instrument data

  • Meant to serve as basic data access, read, and access classes
    • to be boosted in the future by the GOAT PDS reader pdr by Million, Inc.
  • config file controls what data levels are accessible
    • and how they are stored locally
  • currently CTX, HiRISE, UVIS, CISS are supported (Diviner in the works)

Example use HiRISE

from planetarypy.hirise import ProductPathfinder as PPF

ppf = PPF("PSP_003092_0985_RED")

print(ppf.jp2_path)
print(ppf.homepage)
print(ppf.abrowse_path)
print(ppf.nomap_thumbnail_path)
RDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED.JP2
https://uahirise.org/PSP_003092_0985
EXTRAS/RDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED.abrowse.jpg
EXTRAS/RDR/PSP/ORB_003000_003099/PSP_003092_0985/PSP_003092_0985_RED.NOMAP.thumb.jpg

Example use CTXCollection

from planetarypy.ctx import CTXCollection

coll = CTXCollection.by_month("F01")
print(coll.n_items)
print(len(coll.get_corrupted()))
1321
35

Archived SPICE kernels

Archived SPICE kernel sets

  • NAIF offers archived mission kernel sets for 33 missions:
  • Kernels can be subset by time window using Subset link.
  • planetarypy offers programmatic wrapper around subset feature.
  • Zip file unpacked.
  • Kernel files stored locally and logically.
  • Meta-kernel edited appropriately and immediately loadable.

Example use

from planetarypy.spice import kernels

kernels.datasets.drop("path", axis=1).head()
Mission Name PDS3 or PDS4 Data Size (GB) Start Time Stop Time
shorthand
bc BepiColombo 4 2.3 2018-10-20 2023-06-21
cassini Cassini Orbiter 3 62.5 1997-10-15 2017-09-15
clementine Clementine 3 0.8 1994-01-26 1994-05-07
dart DART 4 10.0 2021-11-09 2050-01-01
dawn DAWN 3 86.4 2007-09-27 2018-10-31

Two main user functions:

  • get_metakernel_and_files
    • will check if the kernel files are already locally available
    • if not, download kernels
    • returns the path to the edited meta-kernel
  • list_kernels_for_day
    • will only list kernel filenames valid for the given day

Generic kernels for illumination calculations

Generic kernels

  • Manages a minimal set for basic illumination calculations
  • Currently slightly biased for Mars but many other bodies work
  • Kernels are automatically downloaded and loaded when needed.

Example use

from planetarypy.spice.spicer import MoonSpicer

moon = MoonSpicer("2022-02-22")
print(f"Sol. const: {moon.solar_constant:.1f}")
moon.set_spoint_by(lat=0, lon=0)
moon.aspect = 180
moon.tilt = 30
print(f"Irradiance on tilted surface element: {moon.F_tilt:.1f}")
Sol. const: 1388.4 W / m2
Irradiance on tilted surface element: 412.5 W / m2

Come to the demo session!