Skip to content

master: update from gmtb develop 2019/09/09#222

Merged
climbfuji merged 59 commits into
NCAR:masterfrom
climbfuji:master_update_from_gmtb_develop_20190909
Sep 13, 2019
Merged

master: update from gmtb develop 2019/09/09#222
climbfuji merged 59 commits into
NCAR:masterfrom
climbfuji:master_update_from_gmtb_develop_20190909

Conversation

@climbfuji
Copy link
Copy Markdown
Collaborator

@climbfuji climbfuji commented Sep 9, 2019

This PR updates the ccpp-framework master branch with the cumulative changes from gmtb/develop.

These changes are

  • updates of the CCPP prebuild Python scripts to work with the new and the old metadata format at the same time
  • conversion of ccpp_types.F90 to the new metadata format
  • updates to the technical documentation (to be moved to a separate repository soon)

All of these changes have been approved previously by the GMTB code owners @grantfirl and @llpcarson and mostly also by @gold2718.

climbfuji and others added 30 commits July 11, 2019 08:51
…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
…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
…20190725

Migrate to new metadata format step 1
…pment work for generating html table from metadata table
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-io
Copy link
Copy Markdown

codecov-io commented Sep 9, 2019

Codecov Report

Merging #222 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #222   +/-   ##
=======================================
  Coverage   47.28%   47.28%           
=======================================
  Files          14       14           
  Lines        1343     1343           
=======================================
  Hits          635      635           
  Misses        708      708
Impacted Files Coverage Δ
src/ccpp_types.F90 75% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbec0e5...7b0ed0b. Read the comment docs.

@climbfuji
Copy link
Copy Markdown
Collaborator Author

Associated PRs (GitHub) or changes (Vlab/gerrit):

MISSING

@climbfuji
Copy link
Copy Markdown
Collaborator Author

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)
FV3: https://vlab.ncep.noaa.gov/code-review/19567
FV3/atmos_cubed_sphere: NOAA-EMC/GFDL_atmos_cubed_sphere#3
NEMS: NOAA-EMC/NEMS#7 (ignore update of submodule pointer for pyprodutil)
WW3: no changes
FMS: no changes
ccpp-physics NCAR/ccpp-physics#317
ccpp-framework #222

Copy link
Copy Markdown
Collaborator

@grantfirl grantfirl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved to master since already reviewed/approved in gmtb/develop branch.

Copy link
Copy Markdown
Collaborator

@gold2718 gold2718 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems rather GFS specific. Is this really a framework item?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should or must?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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``.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The location seems model specific. Do the suites have to be in any special place for ccpp_prebuild?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you OK with "The :term:SDF files are part of the host model code"?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scripts/common.py
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)):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: xrange does not exist in python 3 so consider not using it anymore,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Note that capgen is not yet python 3 compatible (but I keep picking at it when I have time).

Comment thread scripts/metavar.py
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:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scripts/metavar.py Outdated
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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, will change it

Comment thread scripts/metavar.py
# are defined in that file and/or parsed beforehand.
#check_fn_in=check_fortran_type),
# *DH
),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scripts/parse_tools/__init__.py Outdated
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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not really like this name (LITERAL) because it only covers integers. Can it be changed to LITERAL_INT or something similar?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will use LITERAL_INT

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sorry for being picky.

Comment thread scripts/parse_tools/parse_checkers.py Outdated

########################################################################

# LITERAL is a strin representing a literal value
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string, not strin, also, the comment is .false. as it only represents integer literal values.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will correct this

@climbfuji
Copy link
Copy Markdown
Collaborator Author

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?

@climbfuji
Copy link
Copy Markdown
Collaborator Author

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.

@ligiabernardet
Copy link
Copy Markdown
Collaborator

ligiabernardet commented Sep 13, 2019 via email

@gold2718
Copy link
Copy Markdown
Collaborator

So, except for the typos, make the changes in a gmtb/develop commit as soon as practical?

@climbfuji
Copy link
Copy Markdown
Collaborator Author

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.

@climbfuji
Copy link
Copy Markdown
Collaborator Author

Thanks for approving. Will merge now.

@gold2718
Copy link
Copy Markdown
Collaborator

Going ahead and approving then since I am going to bed :)

@climbfuji climbfuji merged commit 257252e into NCAR:master Sep 13, 2019
@climbfuji
Copy link
Copy Markdown
Collaborator Author

Going ahead and approving then since I am going to bed :)

Wish I could do the same.

@gold2718
Copy link
Copy Markdown
Collaborator

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 :)

@climbfuji climbfuji deleted the master_update_from_gmtb_develop_20190909 branch June 27, 2022 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants