Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add input validation of directory paths given to satip #245

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

jsbaasi
Copy link
Contributor

@jsbaasi jsbaasi commented Mar 26, 2024

…ries

Pull Request

Description

This change adds a function to utils.py that checks whether a provided path leads to a directory or just a file

The aforementioned function is then added to the top of app.py to check whether save_dir and/or save_dir_native are valid paths

I want to add this change because this will save resources in case you input a bad path. Otherwise the script proceeds to make expensive API calls to EUMETSAT etc. to then fail at the very end when it tries pushing files to the provided save_dir and/or save_dir_native paths.

This has not been put on the issues page

How Has This Been Tested?

The following list shows the 3 save_dir paths that been given as arguments and their results after this PR's changes:

  1. A save_dir path that leads to a directory, satip continues executing
  2. A save_dir path that leads to a file, satip logs the error and halts execution
  3. A save_dir path that doesn't lead to a file or directory, satip logs the error and halts execution

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@jsbaasi
Copy link
Contributor Author

jsbaasi commented Mar 26, 2024

Apologies, the name of the branch does not detail what this PR does!

@jsbaasi jsbaasi changed the title Dircheck Add input validation of directory paths given to satip Mar 28, 2024
@jacobbieker jacobbieker merged commit 63e1c60 into openclimatefix:main Apr 2, 2024
2 of 3 checks passed
@peterdudfield
Copy link
Collaborator

@all-contributors please add @jsbaasi for code

Copy link
Contributor

@peterdudfield

I've put up a pull request to add @jsbaasi! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants