Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The commit with sha cbe0ca on 5 April 2023 transitioned to the use of…
… distribution_param_types in the probit_transform_mod.f90 to communicate parameters of arbitrary distributions to the individual distribution modules. This was required for and tested in the bnrh_distribution_mod.f90. However, it also had a footprint in the beta_distribution_mod.f90 and the gamma_distribution_mod.f90 and these changes were not tested. In addition, this commit provided partial support for a generalized beta distribution in which the bounds are not 0 and 1. It also provided partial support for a generalized gamma distribution where the lower bound did not necessarily have to be 0 and where the gamma could be bounded above rather than below. Neither of these generalizations was ever completed. The use of the standard test subroutine in the beta_distribution_mod would have revealed that there was no longer a guarantee that the appropriate parameters were set for the beta module and one of the tests would have failed; that test still fails in the commit prior to this one. The gamma distribution had a similar problem, all parameters were not set, but the result does not lead to a failure of the gamma test subroutine. This commit fixes the errors in the beta_distribution_mod.f90 and gamma_distribution_mod.f90. It also upgrades the test subroutines in these modules and the normal_distribution_mod.f90 to comply with DART testing standards. These subroutines now explicitly print ‘PASS’ for tests that pass and ‘FAIL’ for tests that fail allowing more automated testing scripts. It also creates directories in the developer_tests directory with programs that run the test subroutine for each of the distributions. Details of differences in each module follow. _________________________________________________________________ Beta_distribution_mod.f90: The key change is to remove partial support for generalized beta distributions. A comment now makes it clear that this module only supports the standard beta distribution that is bounded by 0 and 1. Subroutines beta_cdf, inverse_beta_cdf, set_beta_params_from_ens, and inv_beta_first_guess no longer have the lower_bound and upper_bound as arguments (they are only allowed to be 0 and 1). In addition, inv_beta_first_guess no longer has bounded_below and bounded_above as arguments as they must both be true. inv_beta_cdf now sets the bounded_below, bounded_above, lower_bound and upper_bound parameters to the correct values for the beta. The partially implemented distribution scaling was removed from inv_beta_cdf. Functions inv_beta_cdf_params and beta_cdf_params now include an error check to make sure that the lower and upper bounds in the distribution_params_type have been set to 0 and 1 as other values are not supported. Subroutine set_beta_params_from_ens has changed the distribution_params_type to an intent out argument and defines all six parameters correctly. It also set the parameter type to BETA_DISTRIBUTION. Subroutine test_beta has been modified to print the mandated ‘PASS’ or ‘FAIL’ as appropriate. _________________________________________________________________ gamma_distribution_mod.f90: The key change is to remove partial support for generalized gamma distributions. A comment now makes it clear that this module only supports the standard gamma distribution that is bounded below by 0 and unbounded above. Subroutines gamma_cdf, inverse_gamma_cdf, set_gamma_params_from_ens, and inv_gamma_first_guess no longer have bounded_below, bounded_above, lower_bound, and upper_bound as arguments. inv_gamma_cdf now sets the bounded_below, bounded_above, lower_bound and upper_bound parameters to the correct values for the gamma. Functions inv_gamma_cdf_params and gamma_cdf_params now include an error check to make sure that the lower and upper bounds in the distribution_params_type have been set to 0 and missing_r8 as other values are not supported. Subroutine set_gamma_params_from_ens has changed the distribution_params_type to an intent out argument and defines all six parameters correctly. It also sets the parameter type to GAMMA_DISTRIBUTION. Subroutine test_gamma has been modified to print the mandated ‘PASS’ or ‘FAIL’ as appropriate. _________________________________________________________________ normal_distribution_mod.f90: There were no known errors in this module. Several changes were made to be consistent with the appropriate use of the distribution_params_type. Functions inv_std_normal_cdf and set_normal_params_from_ens now set the appropriate values for the bounded_below, bounded_above, lower_bound and upper_bound components of the distribution_params_type. The distribution_params_type was changed to intent out in set_normal_params_from_ens. The magic number definition of the maximum delta in the inv_cdf root searching routine was changed to be a parameter but the value of 1e-8 was unchanged. A comment notes that changing this parameter to 1e-9 allows all of Ian Groom’s KDE distribution tests to pass. Subroutine test_normal was modified to print the mandated ‘PASS’ or ‘FAIL’ as appropriate. _________________________________________________________________ assim_tools_mod.f90: Deprecated arguments in calls to gamma_cdf and inv_gamma_cdf were removed. Note that the beta distribution has not been implemented as a prior for observation space in assim_tools_mod.f90 so there is no corresponding change. _________________________________________________________________ probit_transform_mod.f90: Deprecated arguments were removed from a call to set_gamma_params_from_ens and set_beta_params_from_ens. Arguments lower_bound and upper_bound were removed from subroutine to_probit_beta. _________________________________________________________________ Directories normal_distribution, gamma_distribution, and beta_distribution were created in developer_tests. They contain programs test_normal_dist.f90, test_gamma_dist.f90, and test_beta_dist.f90 and a work subdirectory. The work subdirectories contain a quickbuild.sh and an input.nml. Each program runs the corresponding test_ subroutine for its distribution. All tests are PASS with this commit.
- Loading branch information