From 77cb5d703e1169f874604f0047fc99b423393d93 Mon Sep 17 00:00:00 2001 From: Jan Polcher <jan.polcher@lmd.jussieu.fr> Date: Mon, 1 Jul 2019 01:39:25 +0200 Subject: [PATCH] Variable in Interface.py need to be in float32 else not compatible with F90 code. The addition of a landsendtohalo to fetch_basin does not work. Leads to a lock-up in truncate. --- DocumentationInterface | 2 +- F90subroutines/routing_interface.f90 | 4 ++-- Interface.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DocumentationInterface b/DocumentationInterface index 0a431bb..0f09022 100644 --- a/DocumentationInterface +++ b/DocumentationInterface @@ -194,7 +194,7 @@ Parameters ---------- corepts : input rank-1 array('i') with bounds (nbcore) basin_count : input rank-1 array('i') with bounds (nbpt) -basin_area : in/output rank-2 array('f') with bounds (nbpt,nwbas) +basin_area : input rank-2 array('f') with bounds (nbpt,nwbas) basin_id : input rank-2 array('i') with bounds (nbpt,nwbas) basin_hierarchy : input rank-2 array('f') with bounds (nbpt,nwbas) basin_fac : input rank-2 array('f') with bounds (nbpt,nwbas) diff --git a/F90subroutines/routing_interface.f90 b/F90subroutines/routing_interface.f90 index 59886d0..4248e89 100644 --- a/F90subroutines/routing_interface.f90 +++ b/F90subroutines/routing_interface.f90 @@ -344,13 +344,13 @@ SUBROUTINE fetch(nbpt, nwbas, nbcore, corepts, basin_count, basin_area, basin_id INTEGER(i_std), INTENT (in) :: nbcore INTEGER(i_std), DIMENSION(nbcore), INTENT(in) :: corepts INTEGER(i_std), DIMENSION(nbpt), INTENT(in) :: basin_count !! - REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: basin_area !! + REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(in) :: basin_area !! INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(in) :: basin_id !! REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(in) :: basin_hierarchy REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(in) :: basin_fac INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(in) :: outflow_grid !! Type of outflow on the grid box (unitless) INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(in) :: outflow_basin !! - REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(in) :: partial_sum + REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(in) :: partial_sum ! !! IN-OUTPUT VARIABLES REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: fetch_basin !! diff --git a/Interface.py b/Interface.py index d6b215d..12ee03d 100644 --- a/Interface.py +++ b/Interface.py @@ -166,12 +166,12 @@ class HydroSuper : # Order of magnitude for the area precision in m^2. prec = 100.0 # - fetch_basin = np.zeros(self.basin_area.shape, dtype=np.float64, order='F') + fetch_basin = np.zeros(self.basin_area.shape, dtype=np.float32, order='F') # self.basin_area = routing_interface.areanorm(self.basin_count, self.basin_area, self.outflow_grid) - partial_sum = np.zeros(self.basin_area.shape, dtype=np.float64, order='F') + partial_sum = np.zeros(self.basin_area.shape, dtype=np.float32, order='F') # - old_sorted = np.zeros(largest_pos, dtype=np.float64, order='F') + old_sorted = np.zeros(largest_pos, dtype=np.float32, order='F') # maxdiff_sorted = prec*prec iter_count = 0 @@ -196,7 +196,7 @@ class HydroSuper : maxdiff_sorted = np.max(np.abs(sorted_outareas[0:largest_pos]-old_sorted)) old_sorted[:] = sorted_outareas[0:largest_pos] iter_count += 1 - + self.fetch_basin = np.copy(fetch_basin) # # Upstream area of the smalest river we call largest rivers. -- GitLab