Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

planetarypy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

planetarypy

Python Tools for Planetary Science

  • 0.32.1
  • PyPI
  • Socket score

Maintainers
1

PlanetaryPy

PlanetaryPy

Beta release: This will become (part of) the core package of the PlanetaryPy organisation.

Potential logo:image.png

Install

pip install planetarypy

This will pull in these other dependencies and their dependencies:

tomlkit pandas pvl numpy python-dateutil tqdm lxml yarl hirise-tools kalasiris

Suggested standard abbreviations:

  • Inside these docs the package will be called PLPY for brevity.
  • A standard Python import could be: plp or plpy
    • because the last p in plp can be pronounced out, we consider these equivalent for human conversation and pronounce these “plippy”.

General scope

First and foremost this package should provide support in working with planetary science data.

With working we mean:

  • locating
  • retrieving
  • reading
  • further processing

of data.

Locating

This library manages, via its PDS tools, multiple PDS3 index files per instrument that can be used for identifying data of interest. These index files are automatically downloaded and converted to the very performant (and cloud-ready) parquet file format. > Parquet is able to store advanced datatypes like nan-capable integer and full datetime objects, as opposed to HDF5.

Retrieving

The interface to getting data is via a path-retrieving function based on a PDS product-id. If that product-id is available locally, the path will be returned. If it is not, it will previously be downloaded, stored in a systematic fashion organized by mission and instrument, and then the local path will be returned.

Reading

For now, the library only returns the path to the object and the user needs to sort out the reading process. A recently funded NASA project Planetary Data Reader will be integrated here, so that basic reading into memory can be provided.

As such, we anticipate two classes of reading support: 1. basic reading into numpy and/or xarray 1. added reader functionality like basic plots and basic geospatial processing, as supported by interested parties

There will exist larger other packages that focus on working with a given instrument’s data, in which case that package could become an affiliated package with the planetarypy GitHub organization, if so desired.

Further processing

In the future, additional frequently used procedures will be added to this library, e.g. * frequently used GDAL/rasterio procedures * frequently used SPICE operations * like surface illumination on a given body

PDS tools

Look at the Apps docs to see what pds.apps exist for easily getting PDS indexes. The find_index app is specifically useful when you don’t know what index files exist.

So far, the following indexes are supported (but not necessarily all tested within PLPY):

  • Cassini
    • ISS (all)
    • UVIS (all)
  • MRO
    • CTX EDR
    • HiRISE
      • EDR, RDR, DTM
        • EDR index has a bug (as delivered by the team, reported), where I need to activate an existing fix for it.
  • LRO
    • Diviner (DLRE)
      • EDR, RDR
    • LOLA
      • EDR, RDR

More indexes

More indexes of other instruments can be easily added by following the existing structure of what has been copied into your config at ~/.planetarypy_config.toml.

Please consider submitting a pull request for adding further PDS index files into the config file at its source: https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/data/planetarypy_config.toml

Utils

Find something in Utils for working with NASA timestamps and a well working URL download function url_retrieve, among other stuff.

Experiment/Instrument Specific

So far, planetarypy supports CTX EDR and HiRISE RGB.NOMAP data. Look at the CTX and HiRISE pages for descriptions of classes for working with these data.

Bug reports

Please submit bug reports at https://github.com/michaelaye/nbplanetary/issues

How to use

Indexes

See PDS apps for more details.

from planetarypy.pds.apps import get_index
ctrindex = get_index("mro.ctx", "edr", refresh=False)
ctrindex.sample(5, random_state=42)  # setting random_state to always get same files for docs
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
VOLUME_IDFILE_SPECIFICATION_NAMEORIGINAL_PRODUCT_IDPRODUCT_IDIMAGE_TIMEINSTRUMENT_IDINSTRUMENT_MODE_IDLINE_SAMPLESLINESSPATIAL_SUMMING...SUB_SOLAR_LATITUDESUB_SPACECRAFT_LONGITUDESUB_SPACECRAFT_LATITUDESOLAR_DISTANCESOLAR_LONGITUDELOCAL_TIMEIMAGE_SKEW_ANGLERATIONALE_DESCDATA_QUALITY_DESCORBIT_NUMBER
86101MROX_2757DATA/J07_047671_1256_XN_54S338W.IMG4A_04_10F0036A00J07_047671_1256_XN_54S338W2016-09-27 00:24:54.682CTXNIFL252881921...-19.41338.09-54.43207762612.4230.5815.4890.1Crater in Noachis TerraOK47671
54420MROX_1819DATA/D10_031170_1808_XN_00N221W.IMG4A_04_109C017D00D10_031170_1808_XN_00N221W2013-03-21 06:58:09.892CTXNIFL505671681...-24.39221.520.88209925149.5286.1514.4990.1Ride-along with HiRISEOK31170
71053MROX_2331DATA/F10_039530_1470_XI_33S203W.IMG4A_04_10C9000F00F10_039530_1470_XI_33S203W2015-01-01 16:20:01.840CTXITL5056522241...-25.3203.96-33.12207070298.2263.9315.290.4Terrain in Terra CimmeriaOK39530
51385MROX_1742DATA/D04_028919_2026_XN_22N327W.IMG4A_04_109002A800D04_028919_2026_XN_22N327W2012-09-26 21:17:00.483CTXNIFL505661441...0.67327.0622.78219814412.3178.4415.5390.1Ride-along with HiRISEOK28919
51923MROX_1757DATA/D05_029283_1524_XN_27S180W.IMG4A_04_1092020B00D05_029283_1524_XN_27S180W2012-10-25 05:44:21.786CTXNIFL505692161...-6.28178.36-27.56214830233.7194.7215.5790.1Ride-along with HiRISEOK29283

5 rows × 51 columns

hirise_rdr = get_index("mro.hirise", "rdr")
hirise_rdr.sample(5, random_state=42)
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
VOLUME_IDFILE_NAME_SPECIFICATIONINSTRUMENT_HOST_IDINSTRUMENT_IDOBSERVATION_IDPRODUCT_IDPRODUCT_VERSION_IDTARGET_NAMEORBIT_NUMBERMISSION_PHASE_NAME...LINE_PROJECTION_OFFSETSAMPLE_PROJECTION_OFFSETCORNER1_LATITUDECORNER1_LONGITUDECORNER2_LATITUDECORNER2_LONGITUDECORNER3_LATITUDECORNER3_LONGITUDECORNER4_LATITUDECORNER4_LONGITUDE
144822MROHR_0001RDR/ESP/ORB_074100_074199/ESP_074107_1410/ESP_...MROHIRISEESP_074107_1410ESP_074107_1410_COLOR1MARS74107Extended Science Phase...-4568562.52009279.5-38.7446159.311-38.7465159.287-38.614159.269-38.6121159.293
22518MROHR_0001RDR/ESP/ORB_014000_014099/ESP_014080_1040/ESP_...MROHIRISEESP_014080_1040ESP_014080_1040_RED1MARS14080Extended Science Phase...-3193960.0-845180.0-76.0185165.215-76.0315164.858-75.6958164.658-75.6831165.005
86634MROHR_0001RDR/ESP/ORB_046300_046399/ESP_046395_1730/ESP_...MROHIRISEESP_046395_1730ESP_046395_1730_COLOR1MARS46395Extended Science Phase...-1584330.0-26573400.0-6.9957292.569-6.9979292.551-6.6838292.51-6.6815292.529
138163MROHR_0001RDR/ESP/ORB_069100_069199/ESP_069178_2345/ESP_...MROHIRISEESP_069178_2345ESP_069178_2345_RED1MARS69178Extended Science Phase...12762196.015708938.053.859876.759153.847476.60254.001376.567254.013776.7249
125490MROHR_0001RDR/ESP/ORB_063500_063599/ESP_063504_1995/ESP_...MROHIRISEESP_063504_1995ESP_063504_1995_COLOR1MARS63504Extended Science Phase...4638178.512794202.019.4523124.14919.45124.12819.5686124.11319.5709124.133

5 rows × 54 columns

Instrument tools

CTX

from planetarypy.ctx import CTX
pid = ctrindex.sample(random_state=42).squeeze().PRODUCT_ID
pid
'J07_047671_1256_XN_54S338W'
ctx = CTX(pid)
ctx
PRODUCT_ID: J07_047671_1256_XN_54S338W
URL: https://pds-imaging.jpl.nasa.gov/data/mro/mars_reconnaissance_orbiter/ctx/mrox_2757/data/J07_047671_1256_XN_54S338W.IMG
source_path: /remote/trove/geo/planet/Mars/CTX/pds/mrox_2757/J07_047671_1256_XN_54S338W.IMG
Shape: (8192, 2528)
ctx.source_path
Path('/remote/trove/geo/planet/Mars/CTX/pds/mrox_2757/J07_047671_1256_XN_54S338W.IMG')
ctx.download()
File exists. Use `overwrite=True` to download fresh.

Acknowledgements

The creation of this library was in part supported by:

  • NASA Cassini UVIS mission
  • NASA SSW grant NNX15AH36G
  • NASA PDART grant 80NSSC20K0875
  • NASA SSW grant 80NSSC20K0748
  • German Space Agency (DLR Bonn), grant 50 OO 2204, on behalf of the German Federal Ministry for Economic Affairs and Climate Action.
  • This research has made use of the USGS Integrated Software for Imagers and Spectrometers (ISIS)(Laura et al. 2022).

Laura, Jason, Alex Acosta, Travis Addair, Lauren Adoram-Kershner, James Alexander, Oleg Alexandrov, Stacey Alley, et al. 2022. Integrated Software for Imagers and Spectrometers (version 7.2.0_RC1). Zenodo. https://doi.org/10.5281/zenodo.7443567.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc