Skip to content
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

Changes after rename of CCPPStandardNames --> ESMStandardNames #98

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions Metadata-standard-names.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CCPP Standard Name Library
# Earth System Modeling Standard Name Library
#### Table of Contents
* [dimensions](#dimensions)
* [constants](#constants)
Expand All @@ -8,9 +8,8 @@
* [diagnostics](#diagnostics)
* [atmospheric_composition](#atmospheric_composition)
* [atmospheric_composition: GOCART aerosols](#atmospheric_composition-gocart-aerosols)
* [emissions: Community Emissions Data System (CEDS)](#emissions-community-emissions-data-system-ceds)
* [required framework-provided variables](#required-framework-provided-variables)
* [optional framework-provided variables](#optional-framework-provided-variables)
* [emissions](#emissions)
* [Application-specific variables](#application-specific-variables)
* [system variables](#system-variables)
* [GFS_typedefs_GFS_control_type](#gfs_typedefs_gfs_control_type)
* [GFS_typedefs_GFS_interstitial_type](#gfs_typedefs_gfs_interstitial_type)
Expand Down Expand Up @@ -62,10 +61,8 @@ Currently, the only dimension which supports all six dimension types is horizont
* `integer`: units = index
* `vertical_index_at_top_interface`: Vertical index at top interface
* `integer`: units = index
* `number_of_openmp_threads`: Total number of thread blocks which the host model may use to call CCPP physics run groups during the CCPP run phase.
* `number_of_openmp_threads`: Total number of thread blocks OpenMP (shared-memory) parallel threads.
* `integer`: units = count
* `ccpp_thread_number`: Number of current thread block. This variable may only be used during CCPP run phase
* `integer`: units = index
## constants
* `avogadro_number`: Avogadro number
* `real(kind=kind_phys)`: units = molecules mol-1
Expand Down Expand Up @@ -452,7 +449,8 @@ Note that appending '_on_previous_timestep' to standard_names in this section yi
* `real(kind=kind_phys)`: units = m-1
* `volume_extinction_in_air_due_to_aerosol_particles_lambda3`: Aerosol extinction at wavelength3
* `real(kind=kind_phys)`: units = m-1
## emissions: Community Emissions Data System (CEDS)
## emissions
Emissions variables, contributed for the Community Emissions Data System (CEDS)
* `emissions_of_co_due_to_anthropogenic`: Carbon monoxide emissions from anthropogenic sources, total
* `real(kind=kind_phys)`: units = kg m-2 s-1
* `emissions_of_no_due_to_anthropogenic`: Nitric oxide emissions from anthropogenic sources, total
Expand Down Expand Up @@ -507,13 +505,15 @@ Note that appending '_on_previous_timestep' to standard_names in this section yi
* `real(kind=kind_phys)`: units = kg m-2 s-1
* `emissions_of_hcho_due_to_anthropogenic_waste`: Formaldehyde emissions from anthropogenic waste disposal and handling
* `real(kind=kind_phys)`: units = kg m-2 s-1
## required framework-provided variables
## Application-specific variables
Variable names only for use with a specific application
### required framework-provided variables
Required CCPP framework-provided variables
* `ccpp_error_message`: Error message for error handling in CCPP
* `character(kind=len=512)`: units = none
* `ccpp_error_code`: Error code for error handling in CCPP
* `integer(kind=)`: units = 1
## optional framework-provided variables
### optional framework-provided variables
Optional CCPP framework-provided variables
* `scheme_name`: CCPP physics scheme name
* `character(kind=len=64)`: units = none
Expand All @@ -525,6 +525,12 @@ Optional CCPP framework-provided variables
* `real(kind=kind_phys)`: units = none
* `number_of_ccpp_constituents`: Number of constituents managed by CCPP Framework
* `integer(kind=)`: units = count
* `ccpp_block_count`: Ccpp block count
* `integer(kind=)`: units = count
* `ccpp_block_sizes`: Ccpp block sizes
* `integer(kind=)`: units = count
* `ccpp_thread_number`: Number of current thread block. This variable may only be used during CCPP run phase
* `integer`: units = index
## system variables
Variables related to the compute environment
* `flag_for_mpi_root`: Flag for MPI root
Expand Down Expand Up @@ -556,10 +562,6 @@ Variables related to the compute environment
* `real(kind=kind_phys)`: units = m2 s-1
* `sigma_pressure_hybrid_coordinate_b_coefficient`: Sigma pressure hybrid coordinate b coefficient
* `real(kind=kind_phys)`: units = 1
* `ccpp_block_count`: Ccpp block count
* `integer(kind=)`: units = count
* `ccpp_block_sizes`: Ccpp block sizes
* `integer(kind=)`: units = count
* `cellular_automata_finer_grid`: Cellular automata finer grid
* `integer(kind=)`: units = count
* `cellular_automata_lifetime`: Cellular automata lifetime
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# CCPPStandardNames
# ESMStandardNames

The CCPPStandardNames Repository contains community-accepted CCPP
The Earth System Modeling Standard Names Repository contains community-accepted
Standard Names, publishing tools, and search tools.

A Markdown file describing the standard names
[is included](https://github.com/ESCOMP/CCPPStandardNames/blob/master/Metadata-standard-names.md).
[is included](https://github.com/ESCOMP/ESMStandardNames/blob/main/Metadata-standard-names.md).
Rules governing the designation and format of standard names can be found in StandardNamesRules.rst

To regenerate the standard name Markdown file, run:
Edits to standard names should be made in the xml file, using the included python tools to generate
the human-readable standard name Markdown file:
```
tools/write_standard_name_table.py standard_names.xml
```
Expand Down
8 changes: 4 additions & 4 deletions StandardNamesRules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
<br />

*******************
CCPP Standard Names
Earth System Modeling Standard Names
*******************

This document contains information about the rules used to create Standard Names
for use with the Common Community Physics Package (CCPP). It describes the
for use with Earth System Models. It describes the

* CCPP Standard Name rules
* ESM Standard Name rules
* Standard Name qualifiers
* Other common standard name components
* Acronyms, abbreviations, and aliases
* Units

.. _Rules
CCPP Standard Name Rules
ESM Standard Name Rules
========================

#. Standard names should be identical to those from the latest version
Expand Down
96 changes: 50 additions & 46 deletions standard_names.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<standard_names name="CCPP Standard Name Library" version="1.0">
<standard_names name="Earth System Modeling Standard Name Library" version="1.0">
<section name="dimensions"
comment="Dimension standard names may come in sets of six
related standard names for each dimension:\n
Expand Down Expand Up @@ -69,13 +69,9 @@
<type units="index">integer</type>
</standard_name>
<standard_name name="number_of_openmp_threads"
long_name="Total number of thread blocks which the host model may use to call CCPP physics run groups during the CCPP run phase.">
long_name="Total number of thread blocks OpenMP (shared-memory) parallel threads.">
<type units="count">integer</type>
</standard_name>
<standard_name name="ccpp_thread_number"
long_name="Number of current thread block. This variable may only be used during CCPP run phase">
<type units="index">integer</type>
</standard_name>
</section>
<section name="constants">
<standard_name name="avogadro_number">
Expand Down Expand Up @@ -791,7 +787,8 @@
<type kind="kind_phys" units="m-1">real</type>
</standard_name>
</section>
<section name="emissions: Community Emissions Data System (CEDS)">
<section name="emissions"
comment="Emissions variables, contributed for the Community Emissions Data System (CEDS)">
<standard_name name="emissions_of_co_due_to_anthropogenic"
long_name="Carbon monoxide emissions from anthropogenic sources, total">
<type kind="kind_phys" units="kg m-2 s-1">real</type>
Expand Down Expand Up @@ -901,39 +898,52 @@
<type kind="kind_phys" units="kg m-2 s-1">real</type>
</standard_name>
</section>
<section name="required framework-provided variables"
comment="Required CCPP framework-provided variables">
<standard_name name="ccpp_error_message"
long_name="Error message for error handling in CCPP">
<type kind="len=512" units="none">character</type>
</standard_name>
<standard_name name="ccpp_error_code"
long_name="Error code for error handling in CCPP">
<type kind="" units="1">integer</type>
</standard_name>
</section>
<section name="optional framework-provided variables"
comment="Optional CCPP framework-provided variables">
<standard_name name="scheme_name"
long_name="CCPP physics scheme name">
<type kind="len=64" units="none">character</type>
</standard_name>
<standard_name name="ccpp_constituent_properties"
long_name="CCPP Constituent Properties">
<type kind="" units="none">ccpp_constituent_prop_ptr_t</type>
</standard_name>
<standard_name name="ccpp_constituents"
long_name="Array of constituents managed by CCPP Framework">
<type kind="kind_phys" units="none">real</type>
</standard_name>
<standard_name name="ccpp_constituent_minimum_values"
long_name="CCPP constituent minimum values">
<type kind="kind_phys" units="none">real</type>
</standard_name>
<standard_name name="number_of_ccpp_constituents"
long_name="Number of constituents managed by CCPP Framework">
<type kind="" units="count">integer</type>
</standard_name>
<section name="Application-specific variables"
comment="Variable names only for use with a specific application">
<section name="required framework-provided variables"
comment="Required CCPP framework-provided variables">
<standard_name name="ccpp_error_message"
long_name="Error message for error handling in CCPP">
<type kind="len=512" units="none">character</type>
</standard_name>
<standard_name name="ccpp_error_code"
long_name="Error code for error handling in CCPP">
<type kind="" units="1">integer</type>
</standard_name>
</section>
<section name="optional framework-provided variables"
comment="Optional CCPP framework-provided variables">
<standard_name name="scheme_name"
long_name="CCPP physics scheme name">
<type kind="len=64" units="none">character</type>
</standard_name>
<standard_name name="ccpp_constituent_properties"
long_name="CCPP Constituent Properties">
<type kind="" units="none">ccpp_constituent_prop_ptr_t</type>
</standard_name>
<standard_name name="ccpp_constituents"
long_name="Array of constituents managed by CCPP Framework">
<type kind="kind_phys" units="none">real</type>
</standard_name>
<standard_name name="ccpp_constituent_minimum_values"
long_name="CCPP constituent minimum values">
<type kind="kind_phys" units="none">real</type>
</standard_name>
<standard_name name="number_of_ccpp_constituents"
long_name="Number of constituents managed by CCPP Framework">
<type kind="" units="count">integer</type>
</standard_name>
<standard_name name="ccpp_block_count">
<type kind="" units="count">integer</type>
</standard_name>
<standard_name name="ccpp_block_sizes">
<type kind="" units="count">integer</type>
</standard_name>
<standard_name name="ccpp_thread_number"
long_name="Number of current thread block. This variable may only be used during CCPP run phase">
<type units="index">integer</type>
</standard_name>
</section>
</section>
<section name="system variables"
comment="Variables related to the compute environment">
Expand Down Expand Up @@ -983,12 +993,6 @@
<standard_name name="sigma_pressure_hybrid_coordinate_b_coefficient">
<type kind="kind_phys" units="1">real</type>
</standard_name>
<standard_name name="ccpp_block_count">
<type kind="" units="count">integer</type>
</standard_name>
<standard_name name="ccpp_block_sizes">
<type kind="" units="count">integer</type>
</standard_name>
<standard_name name="cellular_automata_finer_grid">
<type kind="" units="count">integer</type>
</standard_name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from collections import OrderedDict

################################################
#Add CCPP framework (lib) modules to python path
#Add lib modules to python path
################################################

_CURR_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down
2 changes: 1 addition & 1 deletion tools/check_name_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import re

################################################
#Add CCPP framework (lib) modules to python path
#Add lib modules to python path
################################################

_CURR_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down
2 changes: 1 addition & 1 deletion tools/check_xml_unique.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import copy

################################################
#Add CCPP framework (lib) modules to python path
#Add lib modules to python path
################################################

_CURR_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down
39 changes: 19 additions & 20 deletions tools/write_standard_name_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import re

################################################
#Add CCPP framework (lib) modules to python path
#Add lib) modules to python path
################################################

_CURR_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -63,21 +63,20 @@ def convert_text_to_link(text_str):
def standard_name_to_long_name(prop_dict, context=None):
########################################################################
"""Translate a standard_name to its default long_name
Note: This code is copied from the CCPP Framework.
>>> standard_name_to_long_name({'standard_name':'cloud_optical_depth_layers_from_0p55mu_to_0p99mu'})
'Cloud optical depth layers from 0.55mu to 0.99mu'
>>> standard_name_to_long_name({'local_name':'foo'}) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
CCPPError: No standard name to convert foo to long name
KeyError: No standard name to convert foo to long name
>>> standard_name_to_long_name({}) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
CCPPError: No standard name to convert to long name
KeyError: No standard name to convert to long name
>>> standard_name_to_long_name({'local_name':'foo'}, context=ParseContext(linenum=3, filename='foo.F90')) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
CCPPError: No standard name to convert foo to long name at foo.F90:3
KeyError: No standard name to convert foo to long name at foo.F90:3
>>> standard_name_to_long_name({}, context=ParseContext(linenum=3, filename='foo.F90')) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
CCPPError: No standard name to convert to long name at foo.F90:3
KeyError: No standard name to convert to long name at foo.F90:3
"""
# We assume that standar_name has been checked for validity
# Make the first char uppercase and replace each underscore with a space
Expand All @@ -104,7 +103,7 @@ def standard_name_to_long_name(prop_dict, context=None):
# end if
ctxt = context_string(context)
emsg = 'No standard name to convert{} to long name{}'
raise CCPPError(emsg.format(lname, ctxt))
raise KeyError(emsg.format(lname, ctxt))
# end if
return long_name

Expand All @@ -129,7 +128,7 @@ def parse_command_line(args, description):
def convert_xml_to_markdown(root, library_name, snl):
###############################################################################
snl.write('# {}\n'.format(library_name))
# Write a table of contents
# Write a table of contents for top-level sections
snl.write('#### Table of Contents\n')
for section in root:
sec_name = section.get('name')
Expand All @@ -138,15 +137,19 @@ def convert_xml_to_markdown(root, library_name, snl):
# end for
snl.write('\n')
for section in root:
parse_section(snl, section)

###############################################################################
def parse_section(snl, sec, level='##'):
###############################################################################
# Step through the sections
sec_name = section.get('name')
sec_comment = section.get('comment')
snl.write('## {}\n'.format(sec_name))
sec_name = sec.get('name')
sec_comment = sec.get('comment')
snl.write(f'{level} {sec_name}\n')
if sec_comment is not None:
# First, squeeze out the spacing
while sec_comment.find(' ') >= 0:
sec_comment = sec_comment.replace(' ', ' ')
# end while
while sec_comment:
sec_comment = sec_comment.lstrip()
cind = sec_comment.find('\\n')
Expand All @@ -156,10 +159,10 @@ def convert_xml_to_markdown(root, library_name, snl):
else:
snl.write('{}\n'.format(sec_comment))
sec_comment = ''
# end if
# end while
# end if
for std_name in section:
for std_name in sec:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason these comments must be removed? We have been using them for years and they are very helpful for those of us with vision issues.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have a few arguments against including these comments. They require a non-trival amount of effort to ensure they are always correct, and it is not lintable so this will always be a manual effort. And if they are not kept up-to-date it does more harm than good. I am sympathetic to the needs of individual coding workflows, but can these kinds of decorations not be handled with IDE settings? I know Pycharm is extremely configurable, for example, and there are a number of suggestions online for people in similar situations.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this at least be a group discussion / decision instead of a unilateral change? Has this been discussed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It has not been discussed widely; these changes originally came from the release/v1 branch so I did not realize they would be controversial. I can revert them from this PR for now and open an issue for wider discussion.

if std_name.tag == 'section':
parse_section(snl, std_name, level + '#')
continue
stdn_name = std_name.get('name')
stdn_longname = std_name.get('long_name')
if stdn_longname is None:
Expand All @@ -183,10 +186,6 @@ def convert_xml_to_markdown(root, library_name, snl):
else:
emsg = "Unknown standard name property, '{}'"
raise ValueError(emsg.format(item.tag))
# end if
# end for
# end for
# end for

###############################################################################
def main_func():
Expand Down