private pure function bathymetry_median(b) result(med)
Approximate median via a full sort — b is a setup-time array
(called once per create(), never per-step), so O(n log n) is
fine; this exists purely to make the sign-error message name a
representative depth rather than minval/maxval (which a single
outlier cell would distort).
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Variables
Type
Visibility
Attributes
Name
Initial
real(kind=wp),
private,
allocatable
::
flat(:)
integer,
private
::
n
Source Code
pure function bathymetry_median(b)result(med)!! Approximate median via a full sort — `b` is a setup-time array!! (called once per `create()`, never per-step), so O(n log n) is!! fine; this exists purely to make the sign-error message name a!! representative depth rather than `minval`/`maxval` (which a single!! outlier cell would distort).real(wp),intent(in)::b(:,:)real(wp)::medreal(wp),allocatable::flat(:)integer::nn=size(b)allocate(flat(n),source=reshape(b,[n]))call sort_real(flat)if(mod(n,2)==1)thenmed=flat((n+1)/2)elsemed=0.5_wp*(flat(n/2)+flat(n/2+1))end if end function bathymetry_median