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:
QueryBuilder
Use to access any class of planetary products via the PDS Registry API.
This class is an inheritor of
query_builder.QueryBuilder
, which carries methods to subset the products, and which can be iterated on or converted to 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(client: PDSRegistryClient)[source]
QueryBuilder provides method to elaborate complex PDS queries.
- __init__(client: PDSRegistryClient)[source]
Creates a new instance of the QueryBuilder class.
- __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)
- 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 instance with the “before” filter applied.
- 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.
- 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 instance with the “before” filter applied.
- bundles()[source]
Adds a query clause selecting only “Bundle” type products on the current filter.
Returns
This 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 instance with the “Product Collection” filter applied.
- contexts(keyword: str | None = None)[source]
Adds a query clause selecting only “Context” type products (targets, investigations, instruments, etc…).
Parameters
- keywordstr, optional
Title of the context products. Automatically search for “cannonicalized” variations (uppercase, lowercase, etc.) to cast a wider search across target names.
Returns
This instance with the “Product Context” filter applied.
- filter(clause: str)[source]
Selects products that match the provided query clause.
Parameters
- clausestr
A query clause using the PDS API query syntax
Returns
This 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 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 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 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 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 instance with the “has processing level” filter applied.
- has_target(target: str)[source]
Adds a query clause selecting products having a given target as a lid or a keyword.
Adds a query clause selecting products having a given target as a lid (for example urn:nasa:pds:context:target:planet.mercury) or a keyword, for example Mercury.
Parameters
- targetstr
Identifier (LID) of the target or a keyword matching the title of the target. The provided keyword is “cannonicalized” into several variations (uppercase, lowercase, etc.) to cast a wider search across target names.
Returns
This 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 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 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 QueryBuilder instance while still paginating through the results of a previous query.
- 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:
object
ResultSet of products on which a query has been applied.
- __init__(client: PDSRegistryClient)[source]
Constructor of the ResultSet.
- __weakref__
list of weak references to the object (if defined)
- init_new_page(query_string='', fields=None)[source]
Queries 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.
Parameters
- query_stringstr, optional
The query string to submit to the PDS API.
- fieldsiterable, optional
Additional fields to include with the query parameters.
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.
Main class of the Osiris Rex (OREX) Peppi package.
- class pds.peppi.orex.products.OrexProducts(client: PDSRegistryClient)[source]
Bases:
OrexQueryBuilder
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.