Refactor: Replace hardcoded paths with argparse and os.path.join for cross-platform support#69
Open
Codingbysid wants to merge 2 commits intofwitmer:masterfrom
Open
Refactor: Replace hardcoded paths with argparse and os.path.join for cross-platform support#69Codingbysid wants to merge 2 commits intofwitmer:masterfrom
Codingbysid wants to merge 2 commits intofwitmer:masterfrom
Conversation
…cross-platform support - batchprocess.py: Replace all string concatenation with os.path.join() for cross-platform compatibility - process_snap_data.py: Remove hardcoded absolute paths, add argparse for configurable paths - Add --snap_data_dir, --transect_file, --output_dir, --output_prefix arguments - Default to relative paths (./data/snap_data, etc.) - Add directory existence checks with helpful error messages - Fix path concatenation in read_data() function This improves portability and makes the code work on Windows, macOS, and Linux without modification.
- Replace string concatenation with os.path.join() in augment_tiles() - Add argparse for configurable input/output directories - Make make_tiles() accept configurable output_dir parameter - Add directory existence checks with helpful error messages - Add --augment flag to optionally run tile augmentation - Add additional command-line options for tile dimensions and processing This improves cross-platform compatibility and makes the script more flexible.
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
This PR refactors path handling across multiple files to improve cross-platform compatibility and make the codebase more maintainable.
Changes Made
batchprocess.py
os.path.join()for cross-platform compatibilityprocess_snap_data.py
/usr/local/coastal/...)--snap_data_dir,--transect_file,--output_dir,--output_prefixarguments./data/snap_data, etc.)read_data()functiondata_preprocessing.py
os.path.join()inaugment_tiles()make_tiles()accept configurableoutput_dirparameter--augmentflag to optionally run tile augmentationBenefits
Testing
os.path.join()for cross-platform compatibility