Fix forest cover fraction download for non-CONUS AOIs#79
Merged
Conversation
Three related bugs surfaced when running outside CONUS (Proba-V branch): - generate_dataarrays.py: misplaced `)` made `download_proba_v()` get called with no args; also `tempfile.gettempdir()` (a str) was being treated like a Path. Wrap in Path(...) and pass the file path into download_proba_v. - utils/download.py: download_proba_v passed the full filepath as `filename` to asf_search.download_url and omitted the required `path` argument. download_url returns None, so propagating its return value yielded None. Split out_fp into parent dir + filename and return out_fp ourselves. - processing/wet_snow.py: a stale `ts` from the inner loop was used after both loops exited, so the snowcover mask only applied to the final timestep. Apply it to the whole dataset like the surrounding lines. Also dropped a duplicate `melt_season` computation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
generate_dataarrays.py:340: misplaced)was callingdownload_proba_v()with no args; also wrappedtempfile.gettempdir()inPath(...)so.joinpath()works.utils/download.py:download_proba_v: was callingasf_search.download_url(url=..., filename=out_fp)— butdownload_urlrequires apath(directory) andfilenameis the basename only. Alsodownload_urlreturnsNone, so returning its result broke downstreamxr.open_dataarray. Splitout_fpinto parent dir + filename and returnout_fpourselves.processing/wet_snow.py:227: a staletsfrom the inner loop was being used outside both loops, applying the snowcover mask only to the final timestep instead of the whole dataset. Replaced with a dataset-widewhere.processing/wet_snow.py:174-177: removed a duplicatedmelt_seasoncomputation.Reproduces from a real run failure on
white_mtns 2024_2025(Fairbanks, AK — outside CONUS).Test plan
white_mtns 2024_2025) and confirmgenerate_forest_fraction_dataarrayreturns a valid FCF DataArray.pytest tests/.🤖 Generated with Claude Code