pds4_utils
Utilities for working with NASA Planetary Data System v4 (PDS4) data files
Dependencies
The following dependencies must be met:
- python 3
- pandas
- pyyaml
- lxml
- PDS4 tools
Installation
First, clone this repository. If you are using conda, the dependencies can be installed in a new environment using the provided environment file:
conda env create -f environment.yml
The newly created environment can be activated with:
conda activate pds4utils
Otherwise, please make sure the dependencies are installed with your system package manager, or a tool like pip. Use of a conda environment or virtualenv is recommended!
The package can then be installed with:
python setup.py install
Contents
The module contains a few simple functions and a class. A brief overview is given here:
read_table
- reads 2D tables from PDS4 products
- one level of group fields are supported
- returns a pandas dataframe
- group field data are returned as an array in each pandas cell
- if
table_nameis not given, the first table is returned - the DataFrame is indexed by the first time field, if any
- this can be set using the
index_colparameter
- this can be set using the
read_tables
- reads multiple tables using
read_table - useful for building a large dataframe from many similar data products
- set
add_filename=Trueto add the product name to each row, to track which product the data came from
index_products(directory='.', pattern='*.xml')
- searches for PDS4 labels recursively in
directorymatchingpattern - returns a pandas DataFrame with one row per product
- returned data include:
- LID + VID
- bundle, collection and product identifier
- start and stop time, if present
Database
- this class builds one or more DataFrames containing custom meta-data from a set of PDS4 products
- a YAML formatted configuration file is required to determine which attributes to read
- the Xpath to each attribute must be known
- see example.yml for more information
- if no config file is specified when instantiating the class, a default is looked for
pds_dbase.ymlin the user's home directory, or pointed to byAPPDATAorXDG_CONFIG_HOME
- each entry in the configuration file produces one database table (one Pandas dataframe)
- to see which tables have been loaded, use
list_tables() - to return a table, use
get_table(table) - to save or restore a database using
save_dbase()orload_dbase()
- to see which tables have been loaded, use
Example
The Jupyter notebook included with this repository shows an example of pds4_utils in use. To view the notebook, click here.
Metadata
Release files for pds4-utils 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pds4_utils-0.3.1.tar.gz | 17.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pds4_utils-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.1 kB
Release files / pds4_utils-0.3.1.tar.gz
| Download URL | pds4_utils-0.3.1.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4f049dfc751bc9707417e236b91535fe4864b688a7e4bea7440b3744a8db98e
|
|
BLAKE2b-256 checksum How to use checksums |
070348053786d9b713f6d8ff1014a024732614b586969770d989b29a80e4cadf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / pds4_utils-0.3.1-py3-none-any.whl
| Download URL | pds4_utils-0.3.1-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b915d43ccf70cbea91b9c50b090bfde3b848fb8ba0d3d0a71849e02176ec4ca5
|
|
BLAKE2b-256 checksum How to use checksums |
fe6ef724bfb6bca0f5ac49d1928f5cb53d7a29e2ef4de87858ad57a68b1d1013
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|