Fix Windows path compatibility for data loading#106
Open
fbattini wants to merge 1 commit intoopenclimatefix:mainfrom
Open
Fix Windows path compatibility for data loading#106fbattini wants to merge 1 commit intoopenclimatefix:mainfrom
fbattini wants to merge 1 commit intoopenclimatefix:mainfrom
Conversation
--- ## Problem
The `metoffice load` command failed on Windows with two issues:
1. Incorrect path structure: The archive path was missing year/month/day
subdirectories, causing 404 errors when downloading from HuggingFace.
- Expected: `data/2023/12/01/2023-12-01-00.zarr.zip`
- Actual: `data/2023-12-01-00.zarr.zip`
2. Windows path separators: On Windows, `Path` objects use backslashes (`\`)
which broke HuggingFace URLs when converted to strings.
- Expected: `data/2023/12/01/...`
- Actual: `data\2023\12\01\...`
## Changes
- `main.py`: Added year/month/day subdirectories to archive_path (line 115)
- `data_downloader.py`: Convert backslashes to forward slashes in download_from_hf()
## Testing
- Tested on Windows 11
- Successfully downloads and loads Met Office UK data
- All 53 existing tests pass
---
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.
Problem
The
metoffice loadcommand failed on Windows with two issues:Incorrect path structure: The archive path was missing year/month/day subdirectories, causing 404 errors when downloading from HuggingFace.
data/2023/12/01/2023-12-01-00.zarr.zipdata/2023-12-01-00.zarr.zipWindows path separators: On Windows,
Pathobjects use backslashes (\) which broke HuggingFace URLs when converted to strings.data/2023/12/01/...data\2023\12\01\...Changes
main.py: Added year/month/day subdirectories to archive_path (line 115)data_downloader.py: Convert backslashes to forward slashes in download_from_hf()How Has This Been Tested?
Tested
metoffice loadcommand on Windows 11Successfully downloads and loads Met Office UK data from HuggingFace
All 53 existing tests pass (
pytest)Yes
Checklist: