-
Notifications
You must be signed in to change notification settings - Fork 26
Bugfix #3219 develop python #3222
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
…ath prior to calling Py_InitializeFromConfig() and then restore the Python path afterwards. For Python 3.10, the call to Py_InitializeFromConfig() resets the Python path while in Python 3.12 it does not.
…tion names, and log messages.
…orrection. I'm not positive we need it in the python path, but figure its safer to correct its location than it is to remove it.
…P.initialize() already adds it.
…on_pointdata.cc
The two files are different. Is this expected?
Compared directories:
|
@hsoh-u thanks for looking closely and comparing the outputs. Here's a screenshot of the differences you noted: Basically, the issue is that these derived diagnostics are not being computed, including shear and vorticity. I do recall this detail coming up during development for the TC-Diag tool. I believe this Python import statement is the issue.
The TC-Diagnostics library requires But I see that this is NOT MENTIONED in the MET User's Guide. I'll add a note about to the TC-Diag chapter and the Python appendix, and include that on this PR. Can you please test on your end with the following: TEST THE USER PYTHON EMBEDDING:
TEST THE MET PYTHON EMBEDDING:
Thanks! |
The difference was disappeared after installing the scipy package locally. This was before installing the scipy package.
|
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.
The difference was caused by missing scipy python package.
Thank you for refactoring codes and better naming
… computing diagnostics.
Thanks for the review @hsoh-u. FYI, I just added this note to the TC-Diag chapter of the MET User's Guide: I'll just go ahead and push through this PR based on your previous review because this is a doc-only update. |
Expected Differences
These are the same basic changes to fix #3219 that described in PR #3220 for the
main_v12.1
branch. However, these changes fordevelop
are extended in the following ways:GlobalPython::set_args()
signature to replace theWchar_Argv
argument withStringArray
to consolidate more common code. Also update the logic ofset_args
to automatically add the directory that contains the Python script to the system path to consolidate more code.data2d_python.cc
to pass the args as aStringArray
object rather than first parsing them into argc and argv. This avoid allocating/deallocating memory.met_python_...()
indicates that we're running MET's compile-time Python instance (previously calledstraight_
) anduser_python_...()
indicates that we're running a user-specified version of Python. Also write consistent log messages throughout to indicate which type of Python embedding is being performed.python3_util.h
, I renamedwrappers_dir
topyembed_dir
and replaced those references throughout. Thewrappers_dir
doesn't actually exist but those scripts were moved to thepyembed_dir
location a while ago. I'm not sure that it's necessary to include them in the Python system path, but figured that including it is safer than not.Opportunities for further consolidation and refinement of this code likely still exist, but I see this as incremental progress.
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
Describe testing already performed for these changes:
Ran unit test commands locally with Python 3.10 to confirm they run well.
Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:
/d1/projects/MET/MET_pull_requests/met-12.2.0/rc1/MET-bugfix_3219_develop_python
. The log from running all the unit tests can be found ininternal/test_unit/run_unit_test_py310.log
. And the log from diffing this output with that of the nightly build can be found ininternal/test_unit/run_comp_dir_py310.log
.Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [No]
None needed. The discussion of Python versions in Appendix F Python Embedding do not REQUIRE any change.
Do these changes include sufficient testing updates? [No]
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:
The SonarQube GHA fails because one existing code smell about "Cognitive Complexity" is flagged as
New Code
. But the overall number of code smells are reduced by 12 (from 15,241 in develop to 15,229 for this PR).Please complete this pull request review by [Fri Aug 15, 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: METplus-X.Y Support project for bugfix releases or MET-X.Y Development project for the next coordinated release