diff --git a/CHANGELOG.md b/CHANGELOG.md index 6918aef..d8ca5d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +## [1.14.0] +### Added +- Added support for wildcard search patterns in podaac-data-downloader when executed with the -gr option (i.e. search/download by CMR Granule Ur/Id). Also, added usage details to Downloader.md to describe this new feature [138](https://github.com/podaac/data-subscriber/pull/138). + ## 1.13.1 ### Fixed - Fixed an issue where a required library wasn't being included in the installation. diff --git a/Downloader.md b/Downloader.md index ebe0dd2..3b15e0d 100644 --- a/Downloader.md +++ b/Downloader.md @@ -32,7 +32,7 @@ optional arguments: -e EXTENSIONS, --extensions EXTENSIONS Regexps of extensions of products to download. Default is [.nc, .h5, .zip, .tar.gz, .tiff] -gr GRANULENAME, --granule-name GRANULENAME - Flag to download specific granule from a collection. This parameter can only be used if you know the granule name. Only one granule name can be supplied + Flag to download specific granule from a collection. This parameter can only be used if you know the granule name. Only one granule name can be supplied. Supports wildcard search patterns allowing the user to identify multiple granules for download by using `?` for single- and `*` for multi-character expansion. --process PROCESS_CMD Processing command to run on each downloaded file (e.g., compression). Can be specified multiple times. --version Display script version information and exit. @@ -131,6 +131,7 @@ The `-gr` option works by taking the file name, removing the suffix and searchin Because of this behavior, granules without data suffixes and granules where the the UR does not directly follow this convention may not work as anticipated. We will be adding the ability to download by granuleUR in a future enhancement. +The -gr option supports wildcard search patterns (using `?` for single- and `*` for multi-character expansion) to select and download multiple granules based on the filename pattern. This feature is supported through wildcard search functionality provided through CMR, which is described in the [CMR Search API documentation](https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#parameter-options). ### Download data by cycle diff --git a/pyproject.toml b/pyproject.toml index 78dcce4..8c68790 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "podaac-data-subscriber" -version = "1.13.1" +version = "1.14.0" description = "PO.DAAC Data Subscriber Command Line Tool" authors = ["PO.DAAC "] readme = "README.md" diff --git a/subscriber/podaac_access.py b/subscriber/podaac_access.py index 8742141..827a6ac 100644 --- a/subscriber/podaac_access.py +++ b/subscriber/podaac_access.py @@ -30,7 +30,7 @@ import tenacity from datetime import datetime -__version__ = "1.13.1" +__version__ = "1.14.0" extensions = ["\\.nc", "\\.h5", "\\.zip", "\\.tar.gz", "\\.tiff"] edl = "urs.earthdata.nasa.gov" cmr = "cmr.earthdata.nasa.gov" diff --git a/subscriber/podaac_data_downloader.py b/subscriber/podaac_data_downloader.py index 6334f68..4651f44 100755 --- a/subscriber/podaac_data_downloader.py +++ b/subscriber/podaac_data_downloader.py @@ -93,7 +93,7 @@ def create_parser(): # Get specific granule from the search # https://github.com/podaac/data-subscriber/issues/109 parser.add_argument("-gr", "--granule-name", dest="granulename", - help="Flag to download specific granule from a collection. This parameter can only be used if you know the granule name. Only one granule name can be supplied", + help="Flag to download specific granule from a collection. This parameter can only be used if you know the granule name. Only one granule name can be supplied. Supports wildcard search patterns allowing the user to identify multiple granules for download by using `?` for single- and `*` for multi-character expansion.", default=None) parser.add_argument("--process", dest="process_cmd", @@ -190,6 +190,9 @@ def run(args=None): ('GranuleUR[]', cmr_granule), ('token', token), ] + #jmcnelis, 2023/06/14 - provide for wildcards in granuleur-based search + if '*' in cmr_granule or '?' in cmr_granule: + params.append(('options[GranuleUR][pattern]', 'true')) if args.verbose: logging.info("Granule: " + str(cmr_granule))