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

Fix updating metadata format #35

Merged
merged 3 commits into from
Jun 5, 2021
Merged

Conversation

yoda-vid
Copy link
Collaborator

@yoda-vid yoda-vid commented Jun 3, 2021

Fixes #34.

This PR fixes loading metadata loaded in the prior, NPZ file format, when loaded directly, using the --meta command-line argument. File not found and Unicode errors are integrated directly into the YML load wrapper, and the file resaving as YML format is integrated into the metadata loader. Profiles loaded as YML files also catch load errors.

yoda-vid added 3 commits June 3, 2021 15:55
…iles

Loading metadata first attempts to load the file as YML format. If the metadata has not been updated to YML format, the load typically results in a file not found error because main image reader formats the metadata path as a `.yml` file. When the user specifies metadata directly through the `--meta` flag, however, the YML loader attempts to read the NPZ file and gives a Unicode decode error. Catch both file not found and unicode errors in the main YML loader function, raising a single file not found error, which the metadata loader already catches. Additionally, remove the unused Numpy import statement in the YML I/O module.
Image metadata loaded through the main reader as NPZ files have been automatically resaved in YML format, but metadata loaded outside of this reader are not resaved. Integrate the YML saving into the metadata loader to resave the metadata whenever it is loaded as NPZ format, even if the file will be resaved later after any metadata updates. Also, convert warning calls to logger calls for consistency.
Catch YML load errors when attempting to load profile files. Also, convert debugging print calls to logging calls.
@yoda-vid yoda-vid added the bug Something isn't working label Jun 3, 2021
@yoda-vid yoda-vid added this to the v1.5.0 milestone Jun 3, 2021
@yoda-vid yoda-vid merged commit a0ab61c into master Jun 5, 2021
@yoda-vid yoda-vid deleted the fix_updating_metadata_format branch June 5, 2021 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when NPZ format metadata files are loaded with --meta flag
1 participant