-
Notifications
You must be signed in to change notification settings - Fork 26
Feature dtcenter/METbaseimage#30 changes to support py3.12 #3091
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
Conversation
… python 3.10 to 3.12.0
…json to prevent error handling float32 values
…2 calls to json.dump
…ed in fire weather use case moving to numpy 2.X
…ogic are backwards compatible
@hsoh-u , @DanielAdriaansen , just following up on this open PR |
@georgemccabe I reviewed the changes here, but I don't quite understand the nuances fully. @hsoh-u would be best to comment on the actual changes to the Python layer in MET that are included here (as you note by suggesting for reviewers "Review code changes, advise on better locations for the shared python logic.") I don't feel concerned about the differences in lat/lon that these changes introduced. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve the changes.
The python packages "met" were designed as the base package for the python embedding. The dependency from the met
package to the pyembed
package is expected, but not for the opposite direction. So read_tmp_data_plane.py
imports met.dataplane
and read_tmp_point_nc.py
imports met.point
. So the same class at the python_embedding.py
can import NumpyTypeEncoder from met.logger.
…port it from the other location
Thanks, @hsoh-u. I just pushed a commit to remove the duplicate class and instead import it from met.logger. If all of the tests pass, I will merge this PR. |
…stead import it from the other location" This reverts commit b489e79.
@hsoh-u , importing met.logger from python_embedding.py resulted in an import error: https://github.com/dtcenter/MET/actions/runs/13818134931/job/38657704489?pr=3091#step:5:150 |
Sorry for the trouble. Let's keep it simple with revert. |
These are changes that were required to get the MET unit tests to pass when I switched to using Python 3.12.0. I reverted the changes that use Python 3.12.0 to ensure that these changes don't break the current environment that uses Python 3.10.
Note: I defined the NumpyTypeEncoder in 2 places because I wasn't sure how the imports work and which directories are available to import in each file. The copy defined in scripts/python/met/logger.py is used in 2 places, but it is also needed in scripts/python/pyembed/python_embedding.py. I wasn't sure if logger.py was the appropriate file to include this, but it looks like that file contains other shared logic besides logging, so I added it there.
These changes should result in no differences in the MET unit tests and METplus use cases.
The changes appears to cause rounding differences in the NetCDF lat/lon fields when using Python 3.12.0. See this GHA run to view those differences: https://github.com/dtcenter/METplus/actions/runs/13419641478
Example:
Once this PR and the METbaseimage PR are merged, we can apply the updates from branch feature_baseimage_30_py3.12.0 to switch to actually using Python 3.12.0.
Expected Differences
Do these changes introduce new tools, command line arguments, or configuration file options? [No]
If yes, please describe:
Do these changes modify the structure of existing or add new output data types (e.g. statistic line types or NetCDF variables)? [No]
If yes, please describe:
Pull Request Testing
Tested that all MET unit tests and METplus use cases succeed using these changes and Python 3.12.0. Reverted the Python version back to 3.10 and tested again to ensure that these changes do not break anything in the current version.
Review code changes, advise on better locations for the shared python logic.
Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes]
Do these changes include sufficient testing updates? [Yes]
Will this PR result in changes to the MET test suite? [No]
If yes, describe the new output and/or changes to the existing output:
Will this PR result in changes to existing METplus Use Cases? [No]
If yes, create a new Update Truth METplus issue to describe them.
Do these changes introduce new SonarQube findings? [No]
If yes, please describe:
Please complete this pull request review by 2/27/2025.
Pull Request Checklist
See the METplus Workflow for details.
Select: Reviewer(s) and Development issue
Select: Milestone as the version that will include these changes
Select: Coordinated METplus-X.Y Support project for bugfix releases or MET-X.Y.Z Development project for official releases