From 3ccd606d86332712c41d22322729d9e357f2f4ca Mon Sep 17 00:00:00 2001 From: Nic Hannah Date: Mon, 12 Jul 2021 23:16:38 +1000 Subject: [PATCH 1/2] Update oasis3-mct submodule. --- oasis3-mct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oasis3-mct b/oasis3-mct index a4bcaf6..120a098 160000 --- a/oasis3-mct +++ b/oasis3-mct @@ -1 +1 @@ -Subproject commit a4bcaf666f04d9464d2572edc6ee3f4a9c1c1ff4 +Subproject commit 120a098b6c0757684f1c8782dd3cbe5066fe90c6 From 11b981b58dfc8b4e3f91c09fd84944ba225a847f Mon Sep 17 00:00:00 2001 From: Nic Hannah Date: Tue, 10 Aug 2021 23:51:06 +1000 Subject: [PATCH 2/2] Fix bug which was rounding scaling forcing perturbations to integers. #30 --- libforcing/src/forcing_config.F90 | 2 +- libforcing/src/forcing_perturbation.F90 | 2 +- libforcing/test/test_forcing_perturbations.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libforcing/src/forcing_config.F90 b/libforcing/src/forcing_config.F90 index 73ba378..16556d6 100644 --- a/libforcing/src/forcing_config.F90 +++ b/libforcing/src/forcing_config.F90 @@ -138,7 +138,7 @@ subroutine forcing_config_parse_field(self, field_jv_ptr, field_ptr, & character(kind=CK, len=:), allocatable :: dimension_type character(kind=CK, len=:), allocatable :: perturbation_calendar - integer :: perturbation_constant_value + real :: perturbation_constant_value logical :: found, domain_found integer :: num_perturbations, num_fields integer :: i, j diff --git a/libforcing/src/forcing_perturbation.F90 b/libforcing/src/forcing_perturbation.F90 index bee142e..f91c664 100644 --- a/libforcing/src/forcing_perturbation.F90 +++ b/libforcing/src/forcing_perturbation.F90 @@ -28,7 +28,7 @@ module forcing_perturbation_mod integer :: serperable_id character(len=64) :: name character(len=1024) :: filename_template - integer :: constant_value + real :: constant_value type(ncvar_type) :: ncvar logical :: initialised logical :: valid diff --git a/libforcing/test/test_forcing_perturbations.py b/libforcing/test/test_forcing_perturbations.py index a795e34..0e9d414 100644 --- a/libforcing/test/test_forcing_perturbations.py +++ b/libforcing/test/test_forcing_perturbations.py @@ -125,7 +125,7 @@ def run_simple_test(self, ptype, pdimension, pvalue, pcalendar): perturb_array = f.variables[FORCING_FIELDNAME][tidx, :] else: assert pdimension == 'constant' - perturb_array = int(pvalue) + perturb_array = float(pvalue) # Do the perturbation in Python code and check that it is as expected if ptype == 'scaling': @@ -141,7 +141,7 @@ def test_constant(self, perturb_type, calendar): Test constant scaling and offset """ - perturb_value = random.randint(0, 100) + perturb_value = random.random() self.run_simple_test(perturb_type, 'constant', perturb_value, calendar)