Skip to content

Conversation

@mkavulich
Copy link
Collaborator

Adding a simple script to the framework that takes a metadata file or path containing metadata files, and a branch/tag/hash for the ESCOMP/ESMStandardNames repository (or path to local XML standard names dictionary), and checks the standard names in those metadata variable definitions against the standard names contained in the XML dictionary.

Creating this as a draft for now, as it currently fails when attempting to read metadata files with DDT types. I'm also not sure if this is the correct location for such a tool, or even the right repository. I also should probably add some unit tests.

As an example usage:

python3 check_standard_names.py -m  '../../physics/physics/SFC_Layer/MYJ/'
Fetching XML from branch: main
Retrieved 1106 standard names from XML
Retrieving metadata from ../../physics/physics/SFC_Layer/MYJ/myjsfc_wrapper.meta
Retrieved 1 metadata entries.
The following 48 standard names in ../../physics/physics/SFC_Layer/MYJ/ were not found in provided XML:
air_pressure_at_interface
bulk_richardson_number_at_lowest_model_level
bulk_richardson_number_at_lowest_model_level_over_ice
bulk_richardson_number_at_lowest_model_level_over_land
bulk_richardson_number_at_lowest_model_level_over_water
ccpp_loop_counter
flag_for_iteration
flag_for_mellor_yamada_janjic_surface_layer_scheme
flag_for_restart
flag_print
geopotential_at_interface
index_of_cloud_ice_mixing_ratio_in_tracer_concentration_array
index_of_cloud_liquid_water_mixing_ratio_in_tracer_concentration_array
index_of_graupel_mixing_ratio_in_tracer_concentration_array
index_of_rain_mixing_ratio_in_tracer_concentration_array
index_of_snow_mixing_ratio_in_tracer_concentration_array
monin_obukhov_similarity_function_for_heat_at_2m
monin_obukhov_similarity_function_for_heat_at_2m_over_ice
monin_obukhov_similarity_function_for_heat_at_2m_over_land
monin_obukhov_similarity_function_for_heat_at_2m_over_water
monin_obukhov_similarity_function_for_heat_over_ice
monin_obukhov_similarity_function_for_heat_over_land
monin_obukhov_similarity_function_for_heat_over_water
monin_obukhov_similarity_function_for_momentum_at_10m
monin_obukhov_similarity_function_for_momentum_at_10m_over_ice
monin_obukhov_similarity_function_for_momentum_at_10m_over_land
monin_obukhov_similarity_function_for_momentum_at_10m_over_water
monin_obukhov_similarity_function_for_momentum_over_ice
monin_obukhov_similarity_function_for_momentum_over_land
monin_obukhov_similarity_function_for_momentum_over_water
surface_drag_coefficient_for_heat_and_moisture_in_air
surface_drag_coefficient_for_heat_and_moisture_in_air_over_ice
surface_drag_coefficient_for_heat_and_moisture_in_air_over_land
surface_drag_coefficient_for_heat_and_moisture_in_air_over_water
surface_drag_coefficient_for_momentum_in_air
surface_drag_coefficient_for_momentum_in_air_over_ice
surface_drag_coefficient_for_momentum_in_air_over_land
surface_drag_coefficient_for_momentum_in_air_over_water
surface_friction_velocity_over_ice
surface_friction_velocity_over_land
surface_friction_velocity_over_water
surface_skin_temperature
surface_wind_stress
surface_wind_stress_over_ice
surface_wind_stress_over_land
surface_wind_stress_over_water
weight_for_potental_temperature_at_top_of_viscous_sublayer
wind_speed_at_lowest_model_layer

And another example with truncated output:

python3.10 check_standard_names.py -m  '../../physics/physics/SFC_Models/**' -b release/v1
Fetching XML from branch: release/v1
Retrieved 1218 standard names from XML
Retrieving metadata from ../../physics/physics/SFC_Models/Lake/CLM/clm_lake.meta
Retrieved 1 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/Lake/Flake/flake_driver.meta
Retrieved 2 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/SeaIce/CICE/sfc_sice.meta
Retrieved 1 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/SeaIce/CICE/sfc_cice.meta
Retrieved 1 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/Land/sfc_land.meta
Retrieved 1 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/Land/Noahmp/lnd_iau_mod.meta
Retrieved 4 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/Land/Noahmp/noahmpdrv.meta
Retrieved 1 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/Land/RUC/lsm_ruc.meta
Retrieved 1 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/Land/Noah/lsm_noah.meta
Retrieved 1 metadata entries.
Retrieving metadata from ../../physics/physics/SFC_Models/Ocean/UFS/sfc_ocean.meta
Retrieved 1 metadata entries.
The following 269 standard names in ../../physics/physics/SFC_Models/** were not found in provided XML:
actual_snow_depth_in_clm_lake_model
aerodynamic_resistance_in_canopy
air_pressure_at_interface
bounded_surface_roughness_length_for_heat_over_land
bounded_vegetation_area_fraction
bulk_richardson_number_at_lowest_model_level_over_land
...
...
wind_speed_at_lowest_model_layer
x_ocean_current
y_ocean_current

User interface changes?: No

Fixes: #671
Testing:
test removed: none
unit tests: None yet
system tests: Still don't know what this means
manual testing: Ran this script with several combinations of XMLs, branches, and metadata files

@gold2718
Copy link
Collaborator

gold2718 commented Aug 7, 2025

See #671 (comment)

@mkavulich mkavulich changed the title Feature/standard name checker [DRAFT] Feature/standard name checker Aug 7, 2025
@mkavulich
Copy link
Collaborator Author

Turns out the tool already exists 🤷

@mkavulich mkavulich closed this Aug 7, 2025
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.

Create a tool for checking standard names in CCPP metadata against the standard names dictionary

2 participants