peppi

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

pds.peppi.client

PDS Registry Client related classes.

pds.peppi.client.DEFAULT_API_BASE_URL = 'https://pds.nasa.gov/api/search/1'

Default URL used when querying PDS API

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)

pds.peppi.client.PROCESSING_LEVELS

Processing level values that can be used with has_processing_level()

alias of Literal[‘telemetry’, ‘raw’, ‘partially-processed’, ‘calibrated’, ‘derived’]

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

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

PAGE_SIZE = 100

Default number of results returned in each page fetch from the PDS API.

SORT_PROPERTY = 'ops:Harvest_Info.ops:harvest_date_time'

Default property to sort results of a query by.

__add_clause(clause)

Adds the provided clause to the query string to use on the next fetch of products from the Registry API.

Repeated calls to this method results in a joining with any previously added clauses via Logical AND.

Lazy evaluation is used to only apply the filter when one iterates on this Products instance. This way, multiple filters can be combined before the request is actually sent.

Notes

This method should not be called while there are still results to iterate over from a previous query, as this could affect the results of the next page fetch. The reset() method may be used to abandon a query in progress so that this method may be called safely again.

Parameters

clausestr

The query clause to append. Clause should match the domain language expected by the PDS Registry API

Raises

RuntimeError

If this method is called while there are still results to be iterated over from a previous query.

__init__(client: PDSRegistryClient)[source]

Creates a new instance of the Products class.

Parameters

client: PDSRegistryClient

The client object used to interact with the PDS Registry API.

__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.

__weakref__

list of weak references to the object (if defined)

_init_new_page()[source]

Quieries the PDS API for the next page of results.

Any query clauses associated to this Products instance are included here.

If there are results remaining from the previously acquired page, they are yieled on each subsequent call to this method.

Yields

productpds.api_client.models.pds_product.PDSProduct

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

Raises

StopIteration

Once all available pages of query results have been exhausted.

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.

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.

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.