Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into sima_ideal_phys_std…
Browse files Browse the repository at this point in the history
…names
  • Loading branch information
nusbaume committed Jan 18, 2024
2 parents 85385d0 + b7524d2 commit bef34eb
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 22 deletions.
46 changes: 25 additions & 21 deletions Metadata-standard-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
* [state_variables](#state_variables)
* [diagnostics](#diagnostics)
* [atmospheric_composition](#atmospheric_composition)
* [atmospheric_composition: GOCART aerosols](#atmospheric_composition: GOCART aerosols)
* [required standard variables](#required standard variables)
* [optional standard variables](#optional standard 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)
* [GFS_typedefs_GFS_tbd_type](#GFS_typedefs_GFS_tbd_type)
* [GFS_typedefs_GFS_sfcprop_type](#GFS_typedefs_GFS_sfcprop_type)
* [GFS_typedefs_GFS_coupling_type](#GFS_typedefs_GFS_coupling_type)
* [GFS_typedefs_GFS_statein_type](#GFS_typedefs_GFS_statein_type)
* [GFS_typedefs_GFS_cldprop_type](#GFS_typedefs_GFS_cldprop_type)
* [GFS_typedefs_GFS_radtend_type](#GFS_typedefs_GFS_radtend_type)
* [GFS_typedefs_GFS_grid_type](#GFS_typedefs_GFS_grid_type)
* [GFS_typedefs_GFS_stateout_type](#GFS_typedefs_GFS_stateout_type)
* [atmospheric_composition: GOCART aerosols](#atmospheric_composition-gocart-aerosols)
* [required framework-provided variables](#required-framework-provided-variables)
* [optional framework-provided variables](#optional-framework-provided-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)
* [GFS_typedefs_GFS_tbd_type](#gfs_typedefs_gfs_tbd_type)
* [GFS_typedefs_GFS_sfcprop_type](#gfs_typedefs_gfs_sfcprop_type)
* [GFS_typedefs_GFS_coupling_type](#gfs_typedefs_gfs_coupling_type)
* [GFS_typedefs_GFS_statein_type](#gfs_typedefs_gfs_statein_type)
* [GFS_typedefs_GFS_cldprop_type](#gfs_typedefs_gfs_cldprop_type)
* [GFS_typedefs_GFS_radtend_type](#gfs_typedefs_gfs_radtend_type)
* [GFS_typedefs_GFS_grid_type](#gfs_typedefs_gfs_grid_type)
* [GFS_typedefs_GFS_stateout_type](#gfs_typedefs_gfs_stateout_type)

## dimensions
Dimension standard names may come in sets of six related standard names for each dimension:
Expand All @@ -44,6 +44,8 @@ Currently, the only dimension which supports all six dimension types is horizont
* `integer`: units = count
* `vertical_layer_dimension`: number of vertical layers
* `integer`: units = count
* `vertical_layer_dimension_extended_up_by_1`: number of vertical layers extended up by 1
* `integer`: units = count
* `vertical_interface_dimension`: number of vertical interfaces
* `integer`: units = count
* `vertical_layer_index`: index of a particular vertical layer
Expand Down Expand Up @@ -132,7 +134,7 @@ Note that appending '_on_previous_timestep' to standard_names in this section yi
* `logical(kind=)`: units = flag
* `lagrangian_tendency_of_air_pressure`: Vertical pressure velocity
* `real(kind=kind_phys)`: units = Pa s-1
* `density_of_dry_air`: Density of dry air
* `dry_air_density`: Density of dry air
* `real(kind=kind_phys)`: units = kg m-3
* `air_pressure`: Midpoint air pressure
* `real(kind=kind_phys)`: units = Pa
Expand Down Expand Up @@ -168,13 +170,15 @@ Note that appending '_on_previous_timestep' to standard_names in this section yi
* `real(kind=kind_phys)`: units = 1
* `ln_air_pressure_of_dry_air_at_interface`: Ln air pressure of dry air at interface
* `real(kind=kind_phys)`: units = 1
* `air_pressure_extended_up_by_1`: Air pressure extended up by 1
* `real(kind=kind_phys)`: units = Pa
* `largest_model_top_pressure_that_allows_molecular_diffusion`: Largest model top pressure that allows molecular diffusion
* `real(kind=kind_phys)`: units = Pa
* `do_molecular_diffusion`: Do molecular diffusion
* `logical(kind=kind_phys)`: units = flag
* `is_initialized_physics_grid`: Flag to indicate if physics grid is initialized
* `logical(kind=kind_phys)`: units = flag
* `print_qneg_warn`: Logging setting for negative constituent mass fixer
* `control_for_negative_constituent_warning`: Logging setting for negative constituent mass fixer
* `character(kind=len=*)`: units = 1
* `geopotential_height_at_interface`: Geopotential height at interface
* `real(kind=kind_phys)`: units = m
Expand All @@ -190,7 +194,7 @@ Note that appending '_on_previous_timestep' to standard_names in this section yi
* `real(kind=kind_phys)`: units = J kg-1 s-1
* `tendency_of_air_temperature`: Change in temperature from a parameterization
* `real(kind=kind_phys)`: units = K s-1
* `tendency_of_air_temperature_due_to_model_physics`: Total change in temperature from a physics suite
* `tendency_of_air_temperature_due_to_model_physics`: Total change in air temperature from a physics suite
* `real(kind=kind_phys)`: units = K s-1
* `tendency_of_air_potential_temperature`: Change in potential temperature from a parameterization
* `real(kind=kind_phys)`: units = K s-1
Expand Down Expand Up @@ -363,14 +367,14 @@ 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
## required standard variables
Standard / required CCPP variables
## 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 standard variables
Optional CCPP variables
## optional framework-provided variables
Optional CCPP framework-provided variables
* `scheme_name`: CCPP physics scheme name
* `character(kind=len=64)`: units = none
* `ccpp_constituent_properties`: CCPP Constituent Properties
Expand Down
1 change: 1 addition & 0 deletions StandardNamesRules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Suffixes
| **at_pressure_levels**
| **at_top_of_viscous_sublayer**
| **at_various_atmosphere_layers**
| **extended_up_by_1**

Component
Expand Down
7 changes: 7 additions & 0 deletions standard_names.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
long_name="number of vertical layers">
<type units="count">integer</type>
</standard_name>
<standard_name name="vertical_layer_dimension_extended_up_by_1"
long_name="number of vertical layers extended up by 1">
<type units="count">integer</type>
</standard_name>
<standard_name name="vertical_interface_dimension"
long_name="number of vertical interfaces">
<type units="count">integer</type>
Expand Down Expand Up @@ -254,6 +258,9 @@
<standard_name name="ln_air_pressure_of_dry_air_at_interface">
<type kind="kind_phys" units="1">real</type>
</standard_name>
<standard_name name="air_pressure_extended_up_by_1">
<type kind="kind_phys" units="Pa">real</type>
</standard_name>
<standard_name name="largest_model_top_pressure_that_allows_molecular_diffusion">
<type kind="kind_phys" units="Pa">real</type>
</standard_name>
Expand Down
33 changes: 32 additions & 1 deletion tools/write_standard_name_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,40 @@
from xml_tools import validate_xml_file, read_xml_file
from xml_tools import find_schema_file, find_schema_version

#######################################
#Regular expressions
#######################################

_REAL_SUBST_RE = re.compile(r"(.*\d)p(\d.*)")

_DROPPED_LINK_CHARS_RE = re.compile(r"[^a-z_-]")

########################################################################
def convert_text_to_link(text_str):

"""
When Markdown converts a header string into
an internal document link it applies certain
text conversion rules. This function thus
applies those same rules to a given string
in order to produce the correct link.
"""

#First trim the string to remove leading/trailing white space:
link_str = text_str.strip()

#Next, make sure all text is lowercase:
link_str = link_str.lower()

#Then, replace all spaces with dashes:
link_str = link_str.replace(" ", "-")

#Finally, remove all characters that aren't
#letters, underscores, or dashes:
link_str = _DROPPED_LINK_CHARS_RE.sub("",link_str)

return link_str

########################################################################
def standard_name_to_long_name(prop_dict, context=None):
########################################################################
Expand Down Expand Up @@ -103,7 +133,8 @@ def convert_xml_to_markdown(root, library_name, snl):
snl.write('#### Table of Contents\n')
for section in root:
sec_name = section.get('name')
snl.write("* [{name}](#{name})\n".format(name=sec_name))
sec_name_link = convert_text_to_link(sec_name) #convert string to link text
snl.write(f"* [{sec_name}](#{sec_name_link})\n")
# end for
snl.write('\n')
for section in root:
Expand Down

0 comments on commit bef34eb

Please sign in to comment.