DHI / DHI/HydroEO

download_PLD crashes with FileNotFoundError due to hardcoded double-nested zip path

Open
#61 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3
Forks
1
Avg merge
8m
Merged PRs (30d)
1

Description

`Project.initialize()` crashes for reservoir configs during PLD download:

```
File ".../HydroEO/downloaders/hydroweb.py", line 161, in download_PLD
downloaded_files = os.listdir(extracted_dir)
FileNotFoundError: [Errno 2] No such file or directory: '.../aux/PLD/PLD_temp/SWOT_PRIOR_LAKE_DATABASE/SWOT_PRIOR_LAKE_DATABASE'
```

`download_PLD` in `HydroEO/downloaders/hydroweb.py` assumed the hydroweb.next PLD zip always extracts to a doubly-nested `SWOT_PRIOR_LAKE_DATABASE/SWOT_PRIOR_LAKE_DATABASE/` folder (hardcoded in three places: the initial `extracted_dir` default, the user-provided-directory branch, and the post-extraction fallback). In practice, a live download extracts to only a single `SWOT_PRIOR_LAKE_DATABASE/` level, so `os.listdir()` hit a directory that never existed.

Fixed in 92e6fe0 (merged to main locally, not yet pushed/PR'd) by adding a `_resolve_pld_dir` helper that checks direct, single-nested, and double-nested layouts and uses whichever actually contains `.sqlite`/`.gpkg` files, raising a clear `FileNotFoundError` only if none of them do. Added a regression test (`test_download_pld_handles_single_level_nested_zip_extraction`) covering the single-nested case.

Co-Authored-By: Claude Sonnet 5

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in HydroEO/downloaders/hydroweb.py at download_PLD and inspect the extraction-directory handling. Run test_download_pld_handles_single_level_nested_zip_extraction and verify that single-nested archives are found while unsupported layouts produce a clear FileNotFoundError; the issue notes that a local fix already exists in commit 92e6fe0.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.