Skip to content
Snippets Groups Projects
Commit 77cb5d70 authored by POLCHER Jan's avatar POLCHER Jan :bicyclist_tone4:
Browse files

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.
parent ab294cc9
No related branches found
No related tags found
No related merge requests found
...@@ -194,7 +194,7 @@ Parameters ...@@ -194,7 +194,7 @@ Parameters
---------- ----------
corepts : input rank-1 array('i') with bounds (nbcore) corepts : input rank-1 array('i') with bounds (nbcore)
basin_count : input rank-1 array('i') with bounds (nbpt) 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_id : input rank-2 array('i') with bounds (nbpt,nwbas)
basin_hierarchy : input rank-2 array('f') 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) basin_fac : input rank-2 array('f') with bounds (nbpt,nwbas)
......
...@@ -344,13 +344,13 @@ SUBROUTINE fetch(nbpt, nwbas, nbcore, corepts, basin_count, basin_area, basin_id ...@@ -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), INTENT (in) :: nbcore
INTEGER(i_std), DIMENSION(nbcore), INTENT(in) :: corepts INTEGER(i_std), DIMENSION(nbcore), INTENT(in) :: corepts
INTEGER(i_std), DIMENSION(nbpt), INTENT(in) :: basin_count !! 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 !! 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_hierarchy
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(in) :: basin_fac 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_grid !! Type of outflow on the grid box (unitless)
INTEGER(i_std), DIMENSION(nbpt,nwbas), INTENT(in) :: outflow_basin !! 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 !! IN-OUTPUT VARIABLES
REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: fetch_basin !! REAL(r_std), DIMENSION(nbpt,nwbas), INTENT(inout) :: fetch_basin !!
......
...@@ -166,12 +166,12 @@ class HydroSuper : ...@@ -166,12 +166,12 @@ class HydroSuper :
# Order of magnitude for the area precision in m^2. # Order of magnitude for the area precision in m^2.
prec = 100.0 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) 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 maxdiff_sorted = prec*prec
iter_count = 0 iter_count = 0
...@@ -196,7 +196,7 @@ class HydroSuper : ...@@ -196,7 +196,7 @@ class HydroSuper :
maxdiff_sorted = np.max(np.abs(sorted_outareas[0:largest_pos]-old_sorted)) maxdiff_sorted = np.max(np.abs(sorted_outareas[0:largest_pos]-old_sorted))
old_sorted[:] = sorted_outareas[0:largest_pos] old_sorted[:] = sorted_outareas[0:largest_pos]
iter_count += 1 iter_count += 1
self.fetch_basin = np.copy(fetch_basin) self.fetch_basin = np.copy(fetch_basin)
# #
# Upstream area of the smalest river we call largest rivers. # Upstream area of the smalest river we call largest rivers.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment