Skip to content

Commit 1370cc0

Browse files
authored
Merge pull request #180 from podaac/feature/PODAAC-6305
[Feature/podaac-6305] Fix issue with collections without perfect matching file names with granule ur's
2 parents c52fcf6 + 39787e4 commit 1370cc0

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1212
### Fixed
1313
- **PODAAC-6303 (issues/167)**
1414
- Fixed issue where -gr and -sd/-ed (temporal) cannot be used together as a query
15+
- **PODAAC-6305 (issues/160)**
16+
- Fixed issue when -gr and cycle are used together, and when sometimes the granule name is a subset of what's found in CMR (`SWOT_GPR_2PfP474_001_20230328_220206_20230328_225311` in `SWOT_GPR_2PfP474_002_20230328_225311_20230328_234417_swot`)
1517
### Removed
1618
- Removed python 3.7 from supported builds
1719

18-
1920
## [1.15.2]
2021
### Fixed
2122
- Fixed bug where --subset in combination with the subscriber caused errors

subscriber/podaac_access.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,15 @@ def prepare_time_output(times, prefix, file, args, ts_shift):
293293

294294

295295
def prepare_cycles_output(data_cycles, prefix, file):
296-
""""
296+
"""
297297
Create output directory using OUTPUT_DIR/CYCLE_NUMBER
298298
.update stored in OUTPUT_DIR/
299299
300300
Parameters
301301
----------
302302
data_cycles : list
303303
list of tuples consisting of granule names and cycle numbers
304-
prefix : string
304+
prefix : string
305305
prefix for output path, either custom output -d or short name
306306
file : string
307307
granule file name
@@ -311,8 +311,12 @@ def prepare_cycles_output(data_cycles, prefix, file):
311311
write_path : string
312312
string path to where granules will be written
313313
"""
314+
'''
315+
for each 'data_cycles', build a list that contains the substring 'file' in the granule column,
316+
and get the first tuple
317+
'''
314318
cycle_match = [
315-
cycle for cycle in data_cycles if cycle[0] == splitext(basename(file))[0]
319+
cycle for cycle in data_cycles if splitext(basename(file))[0] in cycle[0]
316320
][0]
317321
cycle_dir = "c" + cycle_match[1].zfill(4)
318322
check_dir(join(prefix, cycle_dir))

tests/test_downloader_regression.py

-1
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,3 @@ def test_downloader_temporal_and_granule_together():
123123
assert len([name for name in os.listdir('./TMP') if
124124
os.path.isfile('./TMP/' + name) and "citation.txt" not in name]) == 2
125125
shutil.rmtree('./TMP')
126-
assert True

0 commit comments

Comments
 (0)