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, contains "Expanded format fields for percentages ..." (#777), update CODEOWNERS #775

Merged
merged 10 commits into from
Nov 23, 2021

Conversation

climbfuji
Copy link
Collaborator

@climbfuji climbfuji commented Nov 10, 2021

Description

With the metadata parser update in NCAR/ccpp-framework#415, a stricter checking of units will be enforced. This includes the replacement of "convenience units" such as log(Pa) with 1. All changes:

  • Replace units 'various' with 'mixed' as agreed upon on the ccpp-framework developer committee
  • Update several invalid convenience units of non-physical quantities with 1
  • Correct the units of the relative humidity variables of the maximum hourly diagnostics from % to 1
  • Revert undesired whitespace changes in module_mp_thomson.F90 from PR add semi-Lagrangian sedimentation of graupel into Thompson MP #770

Contains all changes from PR #777.

Fixes #776.

Last-minute change: add @mkavulich to CODEOWNERS

Associated PRs

NCAR/ccpp-framework#415
#775
NOAA-EMC/fv3atm#422
ufs-community/ufs-weather-model#907

Testing

See ufs-community/ufs-weather-model#907

… non-physical quantities, fix units of humidity diagnostic variables
@climbfuji climbfuji changed the title Update several units in CCPP metadata Update several units in CCPP metadata, contains "Expanded format fields for percentages ..." (#777) Nov 15, 2021
@climbfuji climbfuji changed the title Update several units in CCPP metadata, contains "Expanded format fields for percentages ..." (#777) Update several units in CCPP metadata, contains "Expanded format fields for percentages ..." (#777), update CODEOWNERS Nov 18, 2021
@climbfuji climbfuji requested a review from mkavulich November 18, 2021 23:10
@climbfuji
Copy link
Collaborator Author

@grantfirl for some reason I can't add you as reviewer to this PR. Maybe you didn't exist or were caught in a space-time bubble while transferring from NCAR to NOAA.

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

I have mixed thoughts about replacing things like Pa**kappa and log(Pa) with 1. According to https://math.stackexchange.com/questions/238390/units-of-a-log-of-a-physical-quantity, it would probably make more sense to replace log(Pa) with Pa. As for Pa**kappa, we (CCPP) may need to support exponents of units that are non-integers, because that does come up occasionally. Although, to be consistent with our unit conventions, it would then need to be Pa0.2858 or some ugly-looking thing. Thoughts?

@climbfuji
Copy link
Collaborator Author

I have mixed thoughts about replacing things like Pakappa and log(Pa) with 1. According to https://math.stackexchange.com/questions/238390/units-of-a-log-of-a-physical-quantity, it would probably make more sense to replace log(Pa) with Pa. As for Pakappa, we (CCPP) may need to support exponents of units that are non-integers, because that does come up occasionally. Although, to be consistent with our unit conventions, it would then need to be Pa0.2858 or some ugly-looking thing. Thoughts?

@gold2718 @dudhia @ligiabernardet @grantfirl What are your thoughts? The PR is scheduled for commit tomorrow or the day after. I would prefer to use fraction or frac for the units of relative humidity when they are not percentages instead of 1. I have no strong preference for the units of log(Pa) and Pa**kappa.

@climbfuji
Copy link
Collaborator Author

I have mixed thoughts about replacing things like Pakappa and log(Pa) with 1. According to https://math.stackexchange.com/questions/238390/units-of-a-log-of-a-physical-quantity, it would probably make more sense to replace log(Pa) with Pa. As for Pakappa, we (CCPP) may need to support exponents of units that are non-integers, because that does come up occasionally. Although, to be consistent with our unit conventions, it would then need to be Pa0.2858 or some ugly-looking thing. Thoughts?

@gold2718 @dudhia @ligiabernardet @grantfirl What are your thoughts? The PR is scheduled for commit tomorrow or the day after. I would prefer to use fraction or frac for the units of relative humidity when they are not percentages instead of 1. I have no strong preference for the units of log(Pa) and Pa**kappa.

I looked through GFS_typedefs.meta, there are many many more relative humidity variables, and they all have units frac. I am therefore going to use the same. We can consider expanding it to fraction in a future PR.

@SamuelTrahanNOAA
Copy link
Collaborator

I move that we merge the PR as is (subject to regression tests passing) and change any units later after a broader discussion of how to handle this problem. Otherwise, we'll just hold up the PR, and more pressing matters won't be resolved.

@dudhia
Copy link
Collaborator

dudhia commented Nov 23, 2021 via email

@SamuelTrahanNOAA
Copy link
Collaborator

What is the purpose of the units? Is it to be parseable by automated tools like udunits? Or is it just for people to read?

For automated tools, we have to follow an existing convention. People are usually a bit more flexible.

@climbfuji
Copy link
Collaborator Author

What is the purpose of the units? Is it to be parseable by automated tools like udunits? Or is it just for people to read?

For automated tools, we have to follow an existing convention. People are usually a bit more flexible.

The units must be parseable, not only for matching but also for automated unit conversions. Yes, we try to follow the udunits standard, and log(Pa) or Pa**kappa are not valid units. We will merge this PR with units 1 instead of log(Pa) and Pa**kappa, as requested by @gold2718. This can be reverted if needed and if a different agreement will be made in the future.

@SamuelTrahanNOAA
Copy link
Collaborator

If the log(Pa) and Pa**kappa information is critical to a human understanding the variable, could we put it in the long_name instead?

@@ -22,7 +22,7 @@
[h2o_pres]
standard_name = natural_log_of_h2o_forcing_data_pressure_levels
long_name = natural log of h2o forcing data pressure levels
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See here @SamuelTrahanNOAA - both standard name and long name have the log of ... pressure

@@ -74,7 +74,7 @@
[ph2o]
standard_name = natural_log_of_h2o_forcing_data_pressure_levels
long_name = natural log of h2o forcing data pressure levels
units = log(Pa)
units = 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also here @SamuelTrahanNOAA - both standard name and long name have the log of ... pressure

@@ -341,7 +341,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
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And here @SamuelTrahanNOAA - both standard name and long name have "finite-volume mean edge pressure raised to the power of kappa"

@SamuelTrahanNOAA SamuelTrahanNOAA self-requested a review November 23, 2021 19:48
Copy link
Collaborator

@SamuelTrahanNOAA SamuelTrahanNOAA left a comment

Choose a reason for hiding this comment

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

The only dispute I've heard about this is removing log(Pa) and similar in the units. It seems to me that @climbfuji has come up with a reasonable solution to the problem, given the constraints on the contents of the units variable. I see no reason to delay a commit.

@dudhia
Copy link
Collaborator

dudhia commented Nov 23, 2021 via email

@climbfuji
Copy link
Collaborator Author

The long name should include the Pa information in this case as it is not in the unit itself.

Yes, this is what Sam also asked for. They do, see my comments in physics/h2o_def.meta, physics/h2ophys.meta, physics/gfdl_fv_sat_adj.meta. It's in both the long name and the standard name.

@dudhia
Copy link
Collaborator

dudhia commented Nov 23, 2021 via email

@climbfuji
Copy link
Collaborator Author

I mean Pascals should be explicitly in the long name as the magnitude depends on it.

But didn't we agree on the rule that units are only mentioned explicitly if they deviate from the standard for the quantity in question? I have no problem changing two or three long names post-testing, because we know for sure that those are completely ignored by the parser or code generator, but I want to make sure that we follow the rules.

@dudhia
Copy link
Collaborator

dudhia commented Nov 23, 2021 via email

@climbfuji
Copy link
Collaborator Author

climbfuji commented Nov 23, 2021 via email

@climbfuji
Copy link
Collaborator Author

Good point. Let's add "in Pa" to the three long names before committing.

@dudhia see b7bd5b9 please

@climbfuji
Copy link
Collaborator Author

Regression testing complete, will merge now.

@climbfuji climbfuji merged commit 2c251ef into NCAR:main Nov 23, 2021
@climbfuji climbfuji deleted the correct_units_due_to_feature_capgen branch June 27, 2022 03:01
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.

sfcsub.F produces IO errors if land/sea percentages reach 100%.
5 participants