Ability to generate planar metric terms and addition of test_eta.py unit test#65
Conversation
…tion for surface level (no eta_file specified)
|
Given that metric terms, and the grid generation methods as a whole are a part of NDSL, does it make sense to move the unit test |
Yes, please pull it down. We decided that the FV grid would come preset with NDSL, let's commit fully to it. |
…ed eta_file generator script for testing
test_eta.py unit test
oelbert
left a comment
There was a problem hiding this comment.
Minor documentation changes mostly, otherwise lgtm
| """This test checks to see that the program | ||
| fails when (1) the eta_file is not specified in the yaml | ||
| configuration file; and (2), the computed eta values | ||
| increase non-monotonically. For the latter test, the eta_file | ||
| is specified in test_config_not_mono.yaml file and | ||
| the ak and bk values in the eta_file have been changed nonsensically | ||
| to result in erronenous eta values. |
There was a problem hiding this comment.
It looks like this test only does the first of these two, so the docstring should reflect that
There was a problem hiding this comment.
This docstring still needs to be updated
| """This test checks to see that the program | ||
| fails when (1) the eta_file is not specified in the yaml | ||
| configuration file; and (2), the computed eta values | ||
| increase non-monotonically. For the latter test, the eta_file | ||
| is specified in test_config_not_mono.yaml file and | ||
| the ak and bk values in the eta_file have been changed nonsensically | ||
| to result in erronenous eta values. | ||
| """ |
There was a problem hiding this comment.
Same as above, please update the docstring to reflect the test
Co-authored-by: Oliver Elbert <oliver.elbert36@gmail.com>
Co-authored-by: Oliver Elbert <oliver.elbert36@gmail.com>
| """This test checks to see that the program | ||
| fails when (1) the eta_file is not specified in the yaml | ||
| configuration file; and (2), the computed eta values | ||
| increase non-monotonically. For the latter test, the eta_file | ||
| is specified in test_config_not_mono.yaml file and | ||
| the ak and bk values in the eta_file have been changed nonsensically | ||
| to result in erronenous eta values. |
There was a problem hiding this comment.
This docstring still needs to be updated
| """This test checks to see that the program | ||
| fails when (1) the eta_file is not specified in the yaml | ||
| configuration file; and (2), the computed eta values | ||
| increase non-monotonically. For the latter test, the eta_file | ||
| is specified in test_config_not_mono.yaml file and | ||
| the ak and bk values in the eta_file have been changed nonsensically | ||
| to result in erronenous eta values. | ||
| """ |
| self._ak, | ||
| self._bk, | ||
| ) = self._set_hybrid_pressure_coefficients(eta_file, ak, bk) | ||
| else: |
There was a problem hiding this comment.
Is this the behavior we want? I thought we'd rather raise a ValueError or something here?
There was a problem hiding this comment.
A ValueError is raised deeper in when the file specified is either non-existent, and even lower if the values do not fit the size passed in the config. My thought was that we could still have hybrid pressure values; zero valued if no file passed, or specified when passed.
… eta_file variable in generation.py to use an empty string in conditional statement for hybrid pressure generation
FlorianDeconinck
left a comment
There was a problem hiding this comment.
Cleanup the default eta_file using the pythonic None
FlorianDeconinck
left a comment
There was a problem hiding this comment.
Fix a type hint and we are ready to go
Description
A conditional statement has been added to the
__init__method of theMetricTermsclass to allow for generating surface level metric terms (no hybrid pressure values). Initialization of such aMetricTermsobject will now contain zero-valued hybrid pressures.The unit test
test_eta.pyfrompace/tests/main/gridhas now been moved intondsl/tests/gridalong with a python module for generating the test eta level containing files.This PR must be reviewed and merged after PR 92 is merged in pace
How Has This Been Tested?
Tested via the tests contained within the
testsdirectory of NDSL, and in the tests of the dependent repositoriesPace tests will fail as the changes from PR 92 in Pace are necessary for passing.
Checklist: