Library Reference

pds.peppi is the main module containing all Peppi classes and functions.

pds.peppi.client

PDS Registry Client related classes.

class pds.peppi.client.PDSRegistryClient(base_url='https://pds.nasa.gov/api/search/1')[source]

Used to connect and interface with the PDS Registry.

Attributes

api_clientpds.api_client.ApiClient

Object used to interact with the PDS Registry API

__init__(base_url='https://pds.nasa.gov/api/search/1')[source]

Creates a new instance of PDSRegistryClient.

Parameters

base_url: str, optional
The base endpoint URL of the PDS Registry API. The default value is

the official production server, can be specified otherwise.

__weakref__

list of weak references to the object (if defined)

Main class of the library in this module.

class pds.peppi.products.Products(client: PDSRegistryClient)[source]

Bases: ResultSet

Use to access any class of planetary products via the PDS Registry API.

This class is both a query_builder.QueryBuilder which carries methods to subset the products and a result_set.ResultSet which can be iterated on or converted to for example a pandas DataFrame

__init__(client: PDSRegistryClient)[source]

Constructor of the products.

Attributes

clientPDSRegistryClient

Client defining the connexion with the PDS Search API

Module for the QueryBuilder.

Contains all the methods use to elaborate the PDS4 Information Model queries through the PDS Search API.

class pds.peppi.query_builder.QueryBuilder[source]

QueryBuilder provides method to elaborate complex PDS queries.

__init__()[source]

Creates a new instance of the QueryBuilder class.

__str__()[source]

Returns a formatted string representation of the current query.

__weakref__

list of weak references to the object (if defined)

after(dt: datetime)[source]

Adds a query clause selecting products with an end date after the given datetime.

Parameters

dtdatetime.datetime

Datetime object containing the desired time.

Returns

This Products instance with the “before” filter applied.

before(dt: datetime)[source]

Adds a query clause selecting products with a start date before the given datetime.

Parameters

dtdatetime.datetime

Datetime object containing the desired time.

Returns

This Products instance with the “before” filter applied.

bundles()[source]

Adds a query clause selecting only “Bundle” type products on the current filter.

Returns

This Products instance with the “Product Bundle” filter applied.

collections(collection_type: str | None = None)[source]

Adds a query clause selecting only “Product Collection” type products on the current filter.

Parameters

collection_typestr, optional

Collection type to filter on. If not provided, all collection types are included.

Returns

This Products instance with the “Product Collection” filter applied.

fields(fields: list)[source]

Reduce the list of fields returned, for improved efficiency.

filter(clause: str)[source]

Selects products that match the provided query clause.

Parameters

clausestr

A custom query clause.

Returns

This Products instance with the provided filtering clause applied.

get(identifier: str)[source]

Adds a query clause selecting the product with a LIDVID matching the provided value.

Parameters

identifierstr

LIDVID of the product to filter for.

Returns

This Products instance with the “LIDVID identifier” filter applied.

has_instrument(identifier: str)[source]

Adds a query clause selecting products having an instrument matching the provided identifier.

Parameters

identifierstr

Identifier (LIDVID) of the instrument.

Returns

This Products instance with the “has instrument” filter applied.

has_instrument_host(identifier: str)[source]

Adds a query clause selecting products having an instrument host matching the provided identifier.

Parameters

identifierstr

Identifier (LIDVID) of the instrument host.

Returns

This Products instance with the “has instrument host” filter applied.

has_investigation(identifier: str)[source]

Adds a query clause selecting products having a given investigation identifier.

Parameters

identifierstr

Identifier (LIDVID) of the target.

Returns

This Products instance with the “has investigation” query filter applied.

has_processing_level(processing_level: Literal['telemetry', 'raw', 'partially-processed', 'calibrated', 'derived'] = 'raw')[source]

Adds a query clause selecting products with a specific processing level.

Parameters

processing_levelstr, optional

The processing level to filter on. Must be one of “telemetry”, “raw”, “partially-processed”, “calibrated”, or “derived”. Defaults to “raw”.

Returns

This Products instance with the “has processing level” filter applied.

has_target(identifier: str)[source]

Adds a query clause selecting products having a given target identifier.

Parameters

identifierstr

Identifier (LIDVID) of the target.

Returns

This Products instance with the “has target” query filter applied.

observationals()[source]

Adds a query clause selecting only “Product Observational” type products on the current filter.

Returns

This Products instance with the “Observational Product” filter applied.

of_collection(identifier: str)[source]

Adds a query clause selecting products belonging to the given Parent Collection identifier.

Parameters

identifierstr

Identifier (LIDVID) of the Collection.

Returns

This Products instance with the “Parent Collection” filter applied.

within_bbox(lat_min: float, lat_max: float, lon_min: float, lon_max: float)[source]

Adds a query clause selecting products which fall within the bounds of the provided bounding box.

Notes

This method should be implemented by product-specific inheritors that support the notion of bounding box to filter results by.

Parameters

lat_minfloat

Minimum latitude boundary.

lat_maxfloat

Maximum latitude boundary.

lon_minfloat

Minimum longitude boundary.

lon_maxfloat

Maximum longitude boundary.

Raises

NotImplementedError

within_range(range_in_km: float)[source]

Adds a query clause selecting products within the provided range value.

Notes

This method should be implemented by product-specific inheritors that support the notion of range to a given target.

Parameters

range_in_kmfloat

The range in kilometers to use with the query.

Raises

NotImplementedError

Module of the ResultSet.

class pds.peppi.result_set.ResultSet(client: PDSRegistryClient)[source]

Bases: QueryBuilder

ResultSet of products on which a query has been applied. Iterable.

__init__(client: PDSRegistryClient)[source]

Constructor of the ResultSet.

__iter__()[source]

Iterates over all products returned by the current query filter applied to this Products instance.

This method handles pagination automatically by fetching additional pages from the PDS Registry API as needed. Once all available pages and results have been yielded, this method will reset this Products instance to a default state which can be used to perform a new query.

Yields

productpds.api_client.models.pds_product.PDSProduct

The next product within the current page fetched from the PDS Registry API.

__str__()[source]

Returns a string representation of the ResultSet, including the current query string.

as_dataframe(max_rows: int | None = None)[source]

Returns the found products as a pandas DataFrame.

Loops on the products found and returns a pandas DataFrame with the product properties as columns and their identifier as index.

Parameters

max_rowsint

Optional limit in the number of products returned in the dataframe. Convenient for test while developing. Default is no limit (None)

Returns

The products as a pandas dataframe.

reset()[source]

Resets internal pagination state to default.

This method should be called before making any modifications to the query clause stored by this Products instance while still paginating through the results of a previous query.

Main class of the Osiris Rex (OREX) Peppi package.

class pds.peppi.orex.products.OrexProducts(client: PDSRegistryClient)[source]

Bases: OrexResultSet

Specialized Products class used to query specfically for Osiris Rex (OREX) products.

__init__(client: PDSRegistryClient)[source]

Creates a new instance of OrexProducts.

Parameters

clientPDSRegistryClient

Client defining the connection with the PDS Search API.

Module containing the Osiris Rex (OREX) tailored ResultSet class.

class pds.peppi.orex.result_set.OrexResultSet(client: PDSRegistryClient)[source]

Bases: ResultSet

Inherits the functionality of the ResultSet class, but adds implementations for stubs in QueryBuilder.

__init__(client: PDSRegistryClient)[source]

Creates a new instance of OrexResultSet.

Parameters

clientPDSRegistryClient

Client defining the connection with the PDS Search API.

has_instrument(identifier: str)[source]

Adds a query clause selecting products having an instrument matching the provided identifier.

Notes

For OrexResultsSet, this method is not impemented since the instrument is implicitly always fixed to Osiris Rex.

Parameters

identifierstr

Identifier (LIDVID) of the instrument.

Raises

NotImplementedError

within_bbox(lat_min: float, lat_max: float, lon_min: float, lon_max: float)[source]

Adds a query clause selecting products which fall within the bounds of the provided bounding box.

Parameters

lat_minfloat

Minimum latitude boundary.

lat_maxfloat

Maximum latitude boundary.

lon_minfloat

Minimum longitude boundary.

lon_maxfloat

Maximum longitude boundary.

Returns

This OrexResultSet instance with the “within bounding box” filter applied.

within_range(range_in_km: float)[source]

Adds a query clause selecting products within the provided range value.

Parameters

range_in_kmfloat

The range in kilometers to use with the query.

Returns

This OrexResultSet instance with the “within range” filter applied.