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

Update several units in CCPP metadata following CCPP framework update #422

Merged
Merged
12 changes: 8 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
branch = dev/emc
[submodule "ccpp/framework"]
path = ccpp/framework
url = https://github.com/NCAR/ccpp-framework
branch = main
#url = https://github.com/NCAR/ccpp-framework
#branch = main
url = https://github.com/climbfuji/ccpp-framework
branch = update_main_from_feature_capgen
[submodule "ccpp/physics"]
path = ccpp/physics
url = https://github.com/NCAR/ccpp-physics
branch = main
#url = https://github.com/NCAR/ccpp-physics
#branch = main
url = https://github.com/climbfuji/ccpp-physics
branch = correct_units_due_to_feature_capgen
2 changes: 1 addition & 1 deletion ccpp/data/CCPP_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
[pkz]
standard_name = finite_volume_mean_edge_pressure_raised_to_the_power_of_kappa
long_name = finite-volume mean edge pressure raised to the power of kappa
units = Pa**kappa
units = 1
dimensions = (starting_x_direction_index:ending_x_direction_index,starting_y_direction_index:ending_y_direction_index,1:vertical_dimension_for_fast_physics)
type = real
kind = kind_dyn
Expand Down
26 changes: 13 additions & 13 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@
[hprime]
standard_name = statistical_measures_of_subgrid_orography_collection_array
long_name = orographic metrics
units = various
units = mixed
dimensions = (horizontal_loop_extent,number_of_statistical_measures_of_subgrid_orography)
type = real
kind = kind_phys
Expand Down Expand Up @@ -5735,21 +5735,21 @@
[tau_amf]
standard_name = absolute_momentum_flux_due_to_nonorographic_gravity_wave_drag
long_name = ngw_absolute_momentum_flux
units = various
units = mixed
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[ozpl]
standard_name = ozone_forcing
long_name = ozone forcing data
units = various
units = mixed
dimensions = (horizontal_loop_extent,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_forcing_data)
type = real
kind = kind_phys
[h2opl]
standard_name = stratospheric_water_vapor_forcing
long_name = water forcing data
units = various
units = mixed
dimensions = (horizontal_loop_extent,vertical_dimension_of_h2o_forcing_data,number_of_coefficients_in_h2o_forcing_data)
type = real
kind = kind_phys
Expand Down Expand Up @@ -6340,7 +6340,7 @@
[fluxr]
standard_name = cumulative_radiation_diagnostic
long_name = time-accumulated 2D radiation-related diagnostic fields
units = various
units = mixed
dimensions = (horizontal_loop_extent,number_of_diagnostics_variables_for_radiation)
type = real
kind = kind_phys
Expand Down Expand Up @@ -6921,7 +6921,7 @@
[dtend]
standard_name = cumulative_change_of_state_variables
long_name = diagnostic tendencies for state variables
units = various
units = mixed
dimensions = (horizontal_loop_extent,vertical_layer_dimension,cumulative_change_of_state_variables_outer_index_max)
type = real
kind = kind_phys
Expand Down Expand Up @@ -6957,14 +6957,14 @@
[rh02max]
standard_name = maximum_relative_humidity_at_2m_over_maximum_hourly_time_interval
long_name = maximum relative humidity at 2m over maximum hourly time interval
units = %
units = 1
dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
[rh02min]
standard_name = minimum_relative_humidity_at_2m_over_maximum_hourly_time_interval
long_name = minumum relative humidity at 2m over maximum hourly time interval
units = %
units = 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

May I ask what is the meaning of "units 1" and "units mixed"? Maybe you can see the units in NCEP grib2 product table as a reference? https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-2-0-1.shtml

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Relative humidity in the code is expressed between 0 and 1, i.e. as a fraction. If it was a real percentage, it would range from 0 to 100. See the actual code in ccpp-physics.

Note also we do have percent as a valid unit for such quantities. The % symbol is not acceptable as a unit in the CCPP, it causes all sorts of problem with parsing code (also because members of derived data types have a percent in the name, e.g. foo%bar). We could use fraction instead of 1 for relative humidity, but if so we need to go back to the CCPP framework developers and have them confirm.

Any variable that is a number without a physical unit can have unit 1.

mixed is simply replacing various and is used in cases where a variable contains multiple units. For example, the grab-bag tracer array qgrs contains mass mixing ratios (kg kg-1), number concentrations (kg-1), cloud amount (fraction or 1, can't remember) etc. When the individual members of the qgrs array are passed, then the correct units can be used. But when the entire array is passed, we need to use mixed (was various until now).

Lastly, note that CCPP units do not follow the standard in https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-2-0-1.shtml. If they do match, that is great, and we should strive for consistency where possible. But CCPP units follow CF conventions and udunits, with the extensions defined in https://github.com/ESCOMP/CCPPStandardNames/blob/main/StandardNamesRules.rst (as approved by the CCPP framework developer team).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comparing the grib2 doc with what we have I see a nearly 100% match. The only difference is that we use percent instead of % for real percentages. Some units may differ from scheme to scheme (e.g. Thompson MP defines cloud effective radii in micron), but this is why we have automatic unit conversions - this way the host models can keep their units and still use the physics as-is.

dimensions = (horizontal_loop_extent)
type = real
kind = kind_phys
Expand Down Expand Up @@ -8186,7 +8186,7 @@
[faerlw]
standard_name = aerosol_optical_properties_for_longwave_bands_01_16
long_name = aerosol optical properties for longwave bands 01-16
units = various
units = mixed
dimensions = (horizontal_loop_extent,adjusted_vertical_layer_dimension_for_radiation,number_of_aerosol_bands_for_longwave_radiation,number_of_aerosol_output_fields_for_longwave_radiation)
type = real
kind = kind_phys
Expand Down Expand Up @@ -8214,7 +8214,7 @@
[faersw]
standard_name = aerosol_optical_properties_for_shortwave_bands_01_16
long_name = aerosol optical properties for shortwave bands 01-16
units = various
units = mixed
dimensions = (horizontal_loop_extent,adjusted_vertical_layer_dimension_for_radiation,number_of_aerosol_bands_for_shortwave_radiation,number_of_aerosol_output_fields_for_shortwave_radiation)
type = real
kind = kind_phys
Expand Down Expand Up @@ -9820,7 +9820,7 @@
[q_lay]
standard_name = water_vapor_mixing_ratio
long_name = water vaport mixing ratio
units = kg/kg
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
Expand Down Expand Up @@ -9982,7 +9982,7 @@
[aerosolslw]
standard_name = RRTMGP_aerosol_optical_properties_for_longwave_bands_01_16
long_name = aerosol optical properties for longwave bands 01-16
units = various
units = mixed
dimensions = (horizontal_loop_extent,vertical_layer_dimension, number_of_longwave_bands,number_of_aerosol_output_fields_for_longwave_radiation)
type = real
kind = kind_phys
Expand Down Expand Up @@ -10011,7 +10011,7 @@
[aerosolssw]
standard_name = RRTMGP_aerosol_optical_properties_for_shortwave_bands_01_16
long_name = aerosol optical properties for shortwave bands 01-16
units = various
units = mixed
dimensions = (horizontal_loop_extent,vertical_layer_dimension, number_of_shortwave_bands, number_of_aerosol_output_fields_for_shortwave_radiation)
type = real
kind = kind_phys
Expand Down
2 changes: 1 addition & 1 deletion ccpp/framework
Submodule framework updated 78 files
+1 −0 .github/workflows/python.yaml
+3 −3 .travis.yml
+6 −6 doc/HelloWorld/hello_scheme.meta
+2 −2 doc/HelloWorld/hello_world_host.meta
+6 −6 doc/HelloWorld/temp_adjust.meta
+84 −190 scripts/ccpp_capgen.py
+16 −101 scripts/ccpp_datafile.py
+9 −6 scripts/ccpp_fortran_to_metadata.py
+1 −1 scripts/ccpp_prebuild.py
+238 −1,997 scripts/ccpp_suite.py
+6 −2 scripts/code_block.py
+1 −1 scripts/common.py
+156 −72 scripts/constituents.py
+1 −1 scripts/conversion_tools/unit_conversion.py
+45 −34 scripts/ddt_library.py
+2 −2 scripts/file_utils.py
+13 −15 scripts/fortran_tools/fortran_write.py
+63 −28 scripts/fortran_tools/parse_fortran.py
+65 −66 scripts/fortran_tools/parse_fortran_file.py
+385 −0 scripts/framework_env.py
+41 −26 scripts/host_cap.py
+39 −31 scripts/host_model.py
+1 −1 scripts/metadata2html.py
+8 −2 scripts/metadata_parser.py
+73 −54 scripts/metadata_table.py
+252 −659 scripts/metavar.py
+1 −1 scripts/mkcap.py
+1 −1 scripts/mkdoc.py
+1 −1 scripts/mkstatic.py
+2 −0 scripts/parse_tools/__init__.py
+24 −12 scripts/parse_tools/parse_checkers.py
+1 −1 scripts/parse_tools/parse_log.py
+7 −2 scripts/parse_tools/parse_object.py
+6 −2 scripts/parse_tools/parse_source.py
+6 −2 scripts/parse_tools/preprocess.py
+123 −3 scripts/parse_tools/xml_tools.py
+8 −3 scripts/state_machine.py
+1,912 −0 scripts/suite_objects.py
+1,294 −0 scripts/var_props.py
+190 −164 src/ccpp_constituent_prop_mod.F90
+4 −4 test/advection_test/cld_ice.meta
+4 −4 test/advection_test/cld_liq.meta
+3 −3 test/advection_test/run_test
+5 −2 test/advection_test/test_host.F90
+9 −2 test/advection_test/test_host.meta
+1 −1 test/advection_test/test_host_data.meta
+8 −3 test/advection_test/test_reports.py
+6 −6 test/capgen_test/environ_conditions.meta
+6 −6 test/capgen_test/make_ddt.meta
+5 −5 test/capgen_test/run_test
+4 −2 test/capgen_test/temp_adjust.F90
+6 −6 test/capgen_test/temp_adjust.meta
+6 −6 test/capgen_test/temp_calc_adjust.meta
+8 −8 test/capgen_test/temp_set.meta
+7 −4 test/capgen_test/test_host.F90
+9 −2 test/capgen_test/test_host.meta
+1 −1 test/capgen_test/test_host_data.meta
+9 −4 test/capgen_test/test_reports.py
+6 −0 test/run_doctest.sh
+62 −0 test/run_tests.sh
+2 −2 test/unit_tests/sample_files/test_host.meta
+6 −6 test/unit_tests/sample_files/test_multi_ccpp_arg_tables.meta
+2 −2 test/unit_tests/sample_scheme_files/CCPPeq1_var_in_fort_meta.meta
+2 −2 test/unit_tests/sample_scheme_files/CCPPeq1_var_missing_in_fort.meta
+2 −2 test/unit_tests/sample_scheme_files/CCPPeq1_var_missing_in_meta.meta
+2 −2 test/unit_tests/sample_scheme_files/CCPPgt1_var_in_fort_meta.meta
+2 −2 test/unit_tests/sample_scheme_files/CCPPnotset_var_missing_in_meta.meta
+2 −2 test/unit_tests/sample_scheme_files/invalid_dummy_arg.meta
+2 −2 test/unit_tests/sample_scheme_files/invalid_subr_stmnt.meta
+6 −6 test/unit_tests/sample_scheme_files/mismatch_intent.meta
+4 −4 test/unit_tests/sample_scheme_files/missing_arg_table.meta
+6 −6 test/unit_tests/sample_scheme_files/missing_fort_header.meta
+6 −6 test/unit_tests/sample_scheme_files/reorder.meta
+6 −6 test/unit_tests/sample_scheme_files/temp_adjust.meta
+38 −31 test/unit_tests/test_metadata_scheme_file.py
+65 −68 test/unit_tests/test_metadata_table.py
+424 −0 test/unit_tests/test_var_transforms.py
+7 −3 tests/test_metadata_parser.py