CMR Metadata Validation scripts for NASA Earth Science collections
Project description
NASA Earth Science Collections Metadata Validator
Description
This Python script automates the process of validating metadata for NASA Earth Science collections allowing users to set a collection date range between 2000-01-01 and present date. It fetches collection metadata from NASA's Common Metadata Repository (CMR) APIs, performs validation checks, assesses public accessibility, and retrieves granule counts for each collection. The results are compiled into a comprehensive CSV report with a calculated collection validation percentage.
Features
- Fetches collection metadata using NASA's CMR API
- Validates collection records using the CMR validation API
- Checks public accessibility of each record
- Retrieves granule counts for collections
- Processes collections in parallel for improved efficiency
- Generates a detailed CSV report with validation results
- Provides a calculated collection validation percentage in the CVS reports
Requirements
- Script package was developed under Python 3.13.X
- Required additional Python packages:
- requests
- jq
- Launchpad token using a PEM certificate file
- Permissions to CMR metadata providers' holdings
Installation
- Clone this repository or download the script.
- Install uv https://docs.astral.sh/uv/getting-started/installation/
- Run
uv init - Run
uv pip install -e .to install all dependencies in thepyproject.toml - Install the
jqdependency using OS package manager such asbrewfor MacOs - Ensure you have a valid
cert.pemfile in the same directory as the script for Launchpad authentication. - If you have the uv env already you may need to use
uv venvto initialize the virtual environment then source itsource .venv/bin/activate
Usage
Run the script from the command line, specifying either a provider or consortium:
uv run main.py -h, --help (Show this help message and exit)
or
uv run main.py --provider [PROVIDER_NAME]
or
uv run main.py --consortium [CONSORTIUM_NAME]
(note: under development.)
or
uv run main.py --provider [PROVIDER_NAME] --start_date [START_DATE]
or
uv run main.py --provider [PROVIDER_NAME] --end_date [END_DATE]
Command-line Arguments
-
--provider: Specify a NASA data provider (ASF, ASIPS, CDDIS, ESDIS, GES_DISC, GESDISCCLD, GHRC, GHRC_DAAC, LAADS, LANCEAMSR2, LANCEMODIS, LARC_ASDC, LARC_CLOUD, LARC, LPCLOUD, LPDAAC_ECS, NSIDC_CPRD, NSIDC_ECS, NSIDCV0, OB_CLOUD, OB_DAAC, OMINRT, ORNL_CLOUD, POCLOUD, PODAAC, SEDAC) -
--consortium: Specify a consortium (EOSDIS, CWIC, CEOS, GEOSS, FEDEO) -
--start_date: START_DATE Start date for the first metadata ingestion of collections (format: YYYY-MM-DD, default: 2000-01-01). -
--end_date: END_DATE End date for the last metadata ingestion of collections (format: YYYY-MM-DD, default: current date).
Authentication
The script requires Launchpad authentication. Ensure your cert.pem file is up-to-date and properly configured. What is a PEM certificate file?.
Output
The script generates a CSV file named [PROVIDER/CONSORTIUM]_collections_[TIMESTAMP].csv with the following columns:
- Provider
- Concept ID
- Native ID
- ShortName
- Version
- Collection Progress
- Granule Count
- Public/Private Status
- Issue Type (Error/Warning)
- Error/Warning Path
- Error/Warning Message
Adds the Provider's calculated collection validation percentage at the end of the file.
Running test suite
uv run pytest
To run a specific test use uv run pytest path/to/your/test_file.py
To run a specific test in the test file use uv run pytest tests/test_api_utils.py::MyTestClass::test_name replace the class if there is one with the test class and the test_name with the name of the test module
Important Notes
- This script interacts with NASA's CMR APIs. Ensure you have the necessary permissions.
- Processing time may vary based on the number of collections and API response times.
- Check console output for progress updates and any error messages.
Error Handling
The script includes error handling for API requests and data processing. Errors are logged to stderr.
Customization
You can modify the script to adjust:
- The number of concurrent workers in the thread pool
- The CMR query structure
- CSV output format
Distribution
- uv build creates the distribution and wheel in the
/distdirectory - You need to have an API token saved as an env var
UV_PUBLISH_TOKENto publish under the project - For new versions use the
uv version --bump patchat least depending on the extent of changes it may be aminorormajor - Use
uv publishto publish the package onhttps://pypi.org/
Note: You will want to likely use uv build --clear if you already have distribution files because the publish will publish all of them or target specific version
Contact
Michael Morahan Email: michael.p.morahan@nasa.gov
License
This work was supported by NASA/GSFC under Raytheon Technologies contract Earth Observing System Data and Information System (EOSDIS) Evolution and Development (EED-3) (contract number 80GSFC21CA001). All Rights Reserved.
Creation Date: 2025-08-08 Update date: 2025-11-14 Version: 1.1
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cmr_metadata_validator-0.1.3.tar.gz.
File metadata
- Download URL: cmr_metadata_validator-0.1.3.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cd720217a20e7c5a5aa3f518b5b23aee5f9c685a8bb004d484cbffa6b86eca3
|
|
| MD5 |
b67f3a31d8623fe25964511a5b647b3d
|
|
| BLAKE2b-256 |
ba88daaa771b8f63d3d12a85b2cbaad0252a60fd5b0a975382a23935a65eb1ab
|
File details
Details for the file cmr_metadata_validator-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cmr_metadata_validator-0.1.3-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0fb447eb17bdd9810825125101a1c18bef37bcd2647f361e16a29103eb932c7
|
|
| MD5 |
afd2207681e622ec51ce507928eb189b
|
|
| BLAKE2b-256 |
6c9e1bfd226f058e606e90bb2a52fb837acf80573d18bcaf554e68e36a605cda
|