-
Notifications
You must be signed in to change notification settings - Fork 64
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
Update master from gmtb/develop 2019/10/16 #230
Update master from gmtb/develop 2019/10/16 #230
Conversation
…INTERNAL_VARIABLE_DEFINITON_FILE to common.py, correct typo
… on metadata2html.py
…_batchconvert gmtb/develop: metadata2html batch processing
…call to check_fortran_type, but do not throw an error in case a DDT is not registered
…myj_with_dom_mods
…into myj_with_dom_mods
gmtb/develop: update from master, address issues from previous commit
…ntation for TRANSITION mode
gmtb/develop: remove TRANSITION mode
- Documentation has been moved to the NCAR/ccpp-doc repository.
Remove CCPPtechnical directory, new home in NCAR/ccpp-doc repo
…ired for parallel cmake builds in NEMSfv3gfs
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.
Most of my comments / requested changes are suggestions but I am worried about the commented-out code in parse_checkers.py.
scripts/common.py
Outdated
@@ -14,6 +15,16 @@ | |||
|
|||
CCPP_TYPE = 'ccpp_t' | |||
|
|||
# SCRIPTDIR is the directory where ccpp_prebuild.py and its Python modules are located | |||
SCRIPTDIR = os.path.abspath(os.path.split(__file__)[0]) |
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.
Any reason to not use os.path.dirname
instead of split
here? That function gets enhancements (e.g., support path-like objects) that I am not sure are guaranteed to work with split.
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.
Out of curiosity, are these enhancements for Python 3? I read on the web (Python 2, https://docs.python.org/2/library/os.path.html and other sources) that os.path.dirname as well as os.path.basename internally use os.path.split to return the first/second part.
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.
Yes, it seems that python 3 has more functionality for these functions (and probably a different internal implementation although I have not looked into that).
scripts/common.py
Outdated
SCRIPTDIR = os.path.abspath(os.path.split(__file__)[0]) | ||
|
||
# SRCDIR is the directory where the CCPP framework source code (C, Fortran) is located | ||
SRCDIR = os.path.abspath(os.path.join(SCRIPTDIR, '..', 'src')) |
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.
Use os.pardir
in place of ..
.
scripts/metadata2html.py
Outdated
|
||
# Import the host-model specific CCPP prebuild config; | ||
# split into path and module name for import | ||
configpath = os.path.abspath(os.path.split(configfile)[0]) |
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.
Another place to use os.path.dirname
?
scripts/metadata2html.py
Outdated
# Import the host-model specific CCPP prebuild config; | ||
# split into path and module name for import | ||
configpath = os.path.abspath(os.path.split(configfile)[0]) | ||
configmodule = os.path.split(configfile)[1].rstrip('.py') |
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 would prefer os.path.basename(configfile).rstrip('.py')
Also, is there enforcement somewhere of the .py
suffix? If not, why not just strip off any suffix?
re.sub('[.]+[^.]*$', '', os.path.basename(configfile))
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.
Will use os.path.basename(configfile).rstrip('.py')
for now. Not sure, but if I use __import__
or importlib.import_module
afterwards, isn't Python looking for configfile + .py
?
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.
Actually, I am going to use
configpath = os.path.abspath(os.path.dirname(configfile))
configmodule = os.path.splitext(os.path.basename(configfile))[0]
because this relies on existing functionality of the os
module only.
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 like that.
scripts/metadata2html.py
Outdated
configpath = os.path.abspath(os.path.split(configfile)[0]) | ||
configmodule = os.path.split(configfile)[1].rstrip('.py') | ||
sys.path.append(configpath) | ||
ccpp_prebuild_config = __import__(configmodule) |
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.
Is there a particular reason why importlib.import_module
cannot be used here? __import__
is discouraged unless necessary.
# DH* 20190913 - skip checking if a DDT is registered at this time | ||
#if match is None: | ||
# if error: | ||
# raise CCPPError("'{}' is not a valid{} Fortran type".format(typestr, dt)) | ||
# else: | ||
# typestr = None | ||
# # End if | ||
## End if | ||
# *DH 20190913 |
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.
This sort of change is going to make it difficult to keep the capgen development branch up to date with master. Can we find some other technique (e.g., some variable test) to ensure that this clause is not triggered for master but is active for feature/capgen?
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'd suggest to worry about this once capgen is merged into master - until then, the logic in the master-version of the scripts that capgen would be using would require this change as well, because it assumes that (a) all DDTs used are defined in the same metadata file (which is certainly not going to be the case) and that they are defined in the metadata file before they are used. I understand that the feature/capgen version completes the analysis phase and then knows about all DDTs, but the current version in the master branch does not.
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 will accept that, however, this means that master and feature/capgen will diverge until then. Adding more logic to keep the if statement from being triggered in master, will allow updates to feature/capgen.
…dard libraries instead of deprecated or manual tools
Codecov Report
@@ Coverage Diff @@
## master #230 +/- ##
=======================================
Coverage 47.28% 47.28%
=======================================
Files 14 14
Lines 1343 1343
=======================================
Hits 635 635
Misses 708 708 Continue to review full report at Codecov.
|
…m/climbfuji/ccpp-framework into update_master_from_gmtb_develop_20191016
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.
Looks OK to me.
Associated PRs:
#230
NCAR/ccpp-physics#340
NOAA-EMC/GFDL_atmos_cubed_sphere#5
NOAA-EMC/fv3atm#1
ufs-community/ufs-weather-model#1
NOAA-EMC/NEMS#11 (merged)
NOAA-EMC/NEMS#12
See ufs-community/ufs-weather-model#1 for a description and regression testing information.
This PR for ccpp-framework merges the previously approved changes made for the gmtb/develop branch into the master branch.
Changes specific to ccpp-framework: