master: update from gmtb develop 2019/09/09#222
Conversation
…se, skip optional and intent attributes for variable/type definitions
…ormat and convert back into old format, currently tested for schemes and module variable definitions, not yet for DDTs
…ct answer when checking logicals
…ype and kind definitions when initializing from a metadata table
…riable names that denote the start of a new variable block
…y: define and export LITERAL, use in logical expressions for array references
…py: add capability to parse variable and type definition metadata tables in new metadata format on a per-file basis
…uard to prevent using multi-dimensional character arrays
…red, this only works if all DDTs are defined in the same file and in the correct order
…tments to convert type/variable definitions and fill in dimensions, array references, ...
…e tables one by one, filling in dimension information from type definitions
…into new_metadata_format_step1_20190725
…20190725 Migrate to new metadata format step 1
…, not for type definitions/module variables
…pment work for generating html table from metadata table
…version of metadata-to-html converter
… to specified output directory
…nk metadata tables
…if old metadata is found
TechDoc changes for new metadata format (target gmtb/develop)
…ger needed since we can parse the separate .meta files directly
…_20190904 Convert all schemes to new metadata, new unit conversion micrometer<->meter, merge gsd/develop
Codecov Report
@@ Coverage Diff @@
## master #222 +/- ##
=======================================
Coverage 47.28% 47.28%
=======================================
Files 14 14
Lines 1343 1343
=======================================
Hits 635 635
Misses 708 708
Continue to review full report at Codecov.
|
|
Associated PRs (GitHub) or changes (Vlab/gerrit): MISSING |
|
Associated pull requests (GitHub) or code review changes (Vlab/Gerrit): NEMSfv3gfs: https://vlab.ncep.noaa.gov/code-review/19568 (including update of submodule pointer for WW3) |
grantfirl
left a comment
There was a problem hiding this comment.
Approved to master since already reviewed/approved in gmtb/develop branch.
gold2718
left a comment
There was a problem hiding this comment.
Some questions, some concerns about NOAA-specific documentation, and some small change requests.
| * If the variables are already available, they can be invoked in the scheme’s metadata table and one can skip the rest of this subsection. If the variable required is not available, consider if it can be calculated from the existing variables in the CCPP. If so, an interstitial scheme (such as ``scheme_pre``; see more in :numref:`Chapter %s <CompliantPhysParams>`) can be created to calculate the variable. However, the variable must be defined but not initialized in the host model as the memory for this variable must be allocated on the host model side. Instructions for how to add variables to the host model side is described in :numref:`Chapter %s <Host-side Coding>`. | ||
| * If the variables are already available, they can be invoked in the scheme’s metadata file and one can skip the rest of this subsection. If the variable required is not available, consider if it can be calculated from the existing variables in the CCPP. If so, an interstitial scheme (such as ``scheme_pre``; see more in :numref:`Chapter %s <CompliantPhysParams>`) can be created to calculate the variable. However, the variable must be defined but not initialized in the host model as the memory for this variable must be allocated on the host model side. Instructions for how to add variables to the host model side is described in :numref:`Chapter %s <Host-side Coding>`. | ||
|
|
||
| * If new namelist variables need to be added, the ``GFS_control_type`` DDT should be used. In this case, it is also important to modify the namelist file ``input.nml`` to include the new variable. |
There was a problem hiding this comment.
This seems rather GFS specific. Is this really a framework item?
There was a problem hiding this comment.
We were discussing to move the technical documentation outside of ccpp-framework, or at least parts of it. Let's keep those changes for the moment and clean the documentation up when the move is made. Ok?
There was a problem hiding this comment.
Sure, let's keep an eye on this issue moving forwards.
|
|
||
| * ``<type>`` can be ``scheme``, ``module``, ``DDT``, or ``host``. | ||
|
|
||
| * For empty schemes, the three lines above are sufficient. For non-empty schemes, the metadata should |
There was a problem hiding this comment.
must - will change
| ============================== | ||
|
|
||
| The :term:`SDF` is a file in XML format used to specify the name of the suite, the physics schemes to run, groups of physics that run together, the order in which to run the physics, and whether subcycling will be used to run any of the parameterizations with shorter timesteps. The :term:`SDF` files are located in ``ccpp/suites/suite_*.xml``. | ||
| The :term:`SDF` is a file in XML format used to specify the name of the suite, the physics schemes to run, groups of physics that run together, the order in which to run the physics, and whether subcycling will be used to run any of the parameterizations with shorter timesteps. The :term:`SDF` files are located in ``ccpp/suites/suite_*.xml``. |
There was a problem hiding this comment.
The location seems model specific. Do the suites have to be in any special place for ccpp_prebuild?
There was a problem hiding this comment.
Are you OK with "The :term:SDF files are part of the host model code"?
There was a problem hiding this comment.
We plan to store them in our physics library.
For now, your suggestion might be okay because we do not have the ability to write host-model portable suites. Make your suggested change and let's keep an eye on it.
| if not len(items) in [1, 2, 3]: | ||
| raise Exception("decode_container not implemented for {0} items".format(len(items))) | ||
| itemsdict = {} | ||
| for i in xrange(len(items)): |
There was a problem hiding this comment.
Side note: xrange does not exist in python 3 so consider not using it anymore,
There was a problem hiding this comment.
Noted. The CCPP prebuild scripts are only compatible with Python 2.7.x - something that has been criticized rightfully by others. Because we will move to capgen in the near (?) future, I am not making any attempts to make the CCPP prebuild scripts Python-3 compatible at this time.
There was a problem hiding this comment.
Right. Note that capgen is not yet python 3 compatible (but I keep picking at it when I have time).
| elif self.type is bool: | ||
| if isinstance(test_value, str): | ||
| valid_val = (test_value in ['True', 'False']) or (test_value.lower() in ['t', 'f', '.true.', '.false.']) | ||
| if test_value.lower() in VariableProperty.__true_vals + VariableProperty.__false_vals: |
There was a problem hiding this comment.
I thought we had decided that allowed logical literals were Fortran or Python allowed values. It seems you have expanded the set. Did I miss something?
Also, this list addition is done many, many times, would a combo list (e.g., __logical_vals) be better?
There was a problem hiding this comment.
I actually made this change in "conjunction" (or at least per change request) from you. Let's keep it this way and improve in the future.
| valid_val = (test_value in ['True', 'False']) or (test_value.lower() in ['t', 'f', '.true.', '.false.']) | ||
| if test_value.lower() in VariableProperty.__true_vals + VariableProperty.__false_vals: | ||
| valid_val = (test_value.lower() in VariableProperty.__true_vals) or \ | ||
| not (test_value.lower() in VariableProperty.__false_vals) |
There was a problem hiding this comment.
Does the second clause of the or operator ever change the value given its position inside the if statement above? Why not just omit it?
There was a problem hiding this comment.
Agreed, will change it
| # are defined in that file and/or parsed beforehand. | ||
| #check_fn_in=check_fortran_type), | ||
| # *DH | ||
| ), |
There was a problem hiding this comment.
What about other types? This represents a big change in how types are checked.
If you really need to disable checks on DDTs, please do it in check_fortran_type, not here. Also, let me know why this is necessary.
There was a problem hiding this comment.
We discussed this either in the original PR that introduced the change or in the ccpp-framework meeting. The current version of the parsing scripts for the new metadata rely on all DDTs referenced in one metadata table to be declared in the same metadata table (and also the order matters, they have to be declared beforehand). This doesn't work when radiation sub-DDTs are declared elsewhere and referenced in GFS_typedefs.meta. There won't be a simple fix for this, because we are only reading one (new) metadata file at a time with ccpp_prebuild.py.
I am also wondering if making the following change in check_fortran_type makes any difference in terms of how big the change is:
Turn
dt = ""
match = check_fortran_intrinsic(typestr, error=False)
if match is None:
match = registered_fortran_ddt_name(typestr)
dt = " derived"
# End if
if match is None:
if error:
raise CCPPError("'{}' is not a valid{} Fortran type".format(typestr, dt))
else:
typestr = None
# End if
# End if
return typestr
to
dt = ""
match = check_fortran_intrinsic(typestr, error=False)
if match is None:
match = registered_fortran_ddt_name(typestr)
dt = " derived"
# End if
#if match is None:
# if error:
# raise CCPPError("'{}' is not a valid{} Fortran type".format(typestr, dt))
# else:
# typestr = None
# # End if
# End if
return typestr
?
There was a problem hiding this comment.
That is what I was thinking, at least for now. We should work towards a more robust solution that takes various host build systems into account.
| from parse_source import CCPPError, context_string | ||
| from parse_object import ParseObject | ||
| from parse_checkers import check_fortran_id, FORTRAN_ID | ||
| from parse_checkers import check_fortran_id, LITERAL, FORTRAN_ID |
There was a problem hiding this comment.
I do not really like this name (LITERAL) because it only covers integers. Can it be changed to LITERAL_INT or something similar?
There was a problem hiding this comment.
Will use LITERAL_INT
There was a problem hiding this comment.
Thanks, sorry for being picky.
|
|
||
| ######################################################################## | ||
|
|
||
| # LITERAL is a strin representing a literal value |
There was a problem hiding this comment.
string, not strin, also, the comment is .false. as it only represents integer literal values.
There was a problem hiding this comment.
I will correct this
|
We are in a bit of a difficult situation here. While I agree with @gold2718's comments, we had all PRs going into gmtb/develop approved by not only GMTB but also by @gold2718 (maybe we didn't communicate properly that we interpreted "good enough for gmtb/develop" as "good enough for master"). The changes in this PR have been used for generating the new NEMSfv3gfs baselines and I am not comfortable making changes here when the regression testing is near completion. There seem to be some hierarchy involved here that we need to obey, so maybe from the next time we have the changes for CCPP/master approved (and tested) before we propose changes to EMC. What do we do? Is it ok to record @gold2718's comments and corrections and include them in the following commit for EMC (scheduled for 10/04)? Or do we need to tell EMC that we are making updates and that they have to hold and restart their regression tests? |
|
Note that this issue will be temporary (at least I hope so), because EMC will soon create its own institutional fork of ccpp-{framework,physics} master. This will separate the authoritative repository from their testing. |
|
Given that we are targeting an update of EMC and this Monday, and missing
this date would set us back significantly, I favor going ahead with this
commit and introducing the updates in the next commit cycle.
…On Fri, Sep 13, 2019 at 1:13 PM Dom Heinzeller ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In doc/CCPPtechnical/source/CompliantPhysicsParams.rst
<#222 (comment)>:
> +
+* For each CCPP compliant scheme, the ``.meta`` file should have this set of lines
+
+.. code-block:: fortran
+
+ [ccpp-arg-table]
+ name = <name>
+ type = <type>
+
+* ``ccpp-arg-table`` indicates the start of a new metadata section for a given scheme.
+
+* ``<name>`` is name of the corresponding subroutine/module.
+
+* ``<type>`` can be ``scheme``, ``module``, ``DDT``, or ``host``.
+
+* For empty schemes, the three lines above are sufficient. For non-empty schemes, the metadata should
must - will change
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#222?email_source=notifications&email_token=AE7WQASWRFW4RMT6OM7D4HDQJPQ6BA5CNFSM4IUWEDK2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCEW2F6I#discussion_r324332004>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE7WQARTDZ7JH2EPYAAQOOTQJPQ6BANCNFSM4IUWEDKQ>
.
|
|
So, except for the typos, make the changes in a gmtb/develop commit as soon as practical? |
I have given EMC the hash of my latest commit 7b0ed0b that addresses some of your questions already. We have another commit scheduled for master on 10/04 in which we could bring the changes from gmtb/develop in. |
|
Thanks for approving. Will merge now. |
|
Going ahead and approving then since I am going to bed :) |
Wish I could do the same. |
Well, I am 8 hours ahead so I had an excuse :) |
This PR updates the ccpp-framework master branch with the cumulative changes from gmtb/develop.
These changes are
All of these changes have been approved previously by the GMTB code owners @grantfirl and @llpcarson and mostly also by @gold2718.