SABER
tools_func Module Reference

Subroutines/functions list. More...

Data Types

interface  c_fletcher32
 
interface  fletcher32
 
interface  lonlatmod
 
interface  gridhash
 
interface  independent_levels
 
interface  lonlathash
 
interface  sphere_dist
 
interface  lonlat2xyz
 
interface  xyz2lonlat
 
interface  vector_product
 
interface  det
 
interface  order_cc
 
interface  add
 
interface  divide
 
interface  fit_diag
 
interface  gc99
 
interface  fit_func
 
interface  fit_lct
 
interface  lct_d2h
 
interface  lct_h2r
 
interface  lct_r2d
 
interface  check_cond
 
interface  matern
 
interface  cholesky
 
interface  syminv
 
interface  histogram
 
interface  cx_to_cxa
 
interface  cx_to_proc
 
interface  cx_to_cxu
 

Functions/Subroutines

integer function func_fletcher32 (var)
 Fletcher-32 checksum algorithm. More...
 
subroutine func_lonlatmod (lon, lat)
 Set latitude between -pi/2 and pi/2 and longitude between -pi and pi. More...
 
subroutine func_gridhash (ncx, nlx, lon_cx, lat_cx, mask_cx, grid_hash)
 Compute grid hash profile. More...
 
subroutine func_independent_levels (mpl, nlx, grid_hash, nlxi, lx_to_lxi, lxi_to_lx, ifmt)
 Compute independent levels. More...
 
real(kind_real) function func_lonlathash (lon, lat, il)
 Define a unique real from a lon/lat pair. More...
 
subroutine func_sphere_dist (lon_i, lat_i, lon_f, lat_f, dist)
 Compute the great-circle distance between two points. More...
 
subroutine func_lonlat2xyz (mpl, lon, lat, x, y, z)
 Convert longitude/latitude to cartesian coordinates. More...
 
subroutine func_xyz2lonlat (mpl, x, y, z, lon, lat)
 Convert longitude/latitude to cartesian coordinates. More...
 
subroutine func_vector_product (v1, v2, vp)
 Compute normalized vector product. More...
 
subroutine func_det (v1, v2, v3, p, cflag)
 Compute determinant (vector triple product) More...
 
subroutine func_order_cc (mpl, lon, lat, n, x, y, z, order, diff)
 Order points in counter-clockwise order with respect to a central point. More...
 
subroutine func_add (mpl, val, cumul, num, wgt)
 Check if value missing and add if not missing. More...
 
subroutine func_divide (mpl, val, num)
 Check if value missing and divide if not missing. More...
 
subroutine func_fit_diag (mpl, nc3, nl0r, nl0, l0rl0_to_l0, disth, distv, coef, rh, rv, fit)
 Compute diagnostic fit function. More...
 
real(kind_real) function func_gc99 (distnorm)
 Gaspari and Cohn (1999) function, with the support radius as a parameter. More...
 
real(kind_real) function func_fit_func (mpl, distnorm)
 Fit_function. More...
 
subroutine func_fit_lct (mpl, nc, nl0, dxsq, dysq, dxdy, dzsq, dmask, nscales, D, coef, fit)
 LCT fit. More...
 
subroutine func_lct_d2h (mpl, D11, D22, D33, D12, H11, H22, H33, H12)
 From D (Daley tensor) to H (local correlation tensor) More...
 
subroutine func_lct_h2r (mpl, H11, H22, H33, H12, rh, rv)
 From H (local correlation tensor) to support radii. More...
 
subroutine func_lct_r2d (r, D)
 From support radius to Daley tensor diagonal element. More...
 
subroutine func_check_cond (d1, d2, nod, valid)
 Check tensor conditioning. More...
 
real(kind_real) function func_matern (mpl, M, x)
 Compute the normalized diffusion function from eq. (55) of Mirouze and Weaver (2013), for the 3d case (d = 3) More...
 
subroutine func_cholesky (mpl, n, a, u)
 Compute cholesky decomposition. More...
 
subroutine func_syminv (mpl, n, a, c)
 Compute inverse of a symmetric matrix. More...
 
subroutine func_histogram (mpl, nlist, list, nbins, histmin, histmax, bins, hist)
 Compute bins and histogram from a list of values. More...
 
integer function func_cx_to_cxa (nproc, proc_to_cx_offset, icx)
 Conversion from global to halo A on subset Scx. More...
 
integer function func_cx_to_proc (nproc, proc_to_cx_offset, icx)
 Conversion from global to processor on subset Scx. More...
 
integer function func_cx_to_cxu (nproc, proc_to_cx_offset, proc_to_ncxa, myuniverse, icx)
 Conversion from global to universe on subset Scx. More...
 

Variables

real(kind_real), parameter, public gc2gau = 0.28_kind_real
 GC99 support radius to Gaussian Daley length-scale (empirical) More...
 
real(kind_real), parameter, public gau2gc = 3.57_kind_real
 Gaussian Daley length-scale to GC99 support radius (empirical) More...
 
real(kind_real), parameter, public dmin = 1.0e-12_kind_real
 Minimum tensor diagonal value. More...
 
real(kind_real), parameter condmax = thousand
 Maximum tensor conditioning number. More...
 
integer, parameter, public m = 0
 Number of implicit iteration for the Matern function (0: Gaussian) More...
 

Detailed Description

Subroutines/functions list.

Instrumentation functions Usual functions

Function/Subroutine Documentation

◆ func_add()

subroutine tools_func::func_add ( type(mpl_type), intent(in)  mpl,
real(kind_real), intent(in)  val,
real(kind_real), intent(inout)  cumul,
real(kind_real), intent(inout)  num,
real(kind_real), intent(in), optional  wgt 
)
private

Check if value missing and add if not missing.

Parameters
[in]mplMPI data
[in]valValue to add
[in,out]numNumber of values
[in]wgtWeight

Definition at line 705 of file tools_func.F90.

◆ func_check_cond()

subroutine tools_func::func_check_cond ( real(kind_real), intent(in)  d1,
real(kind_real), intent(in)  d2,
real(kind_real), intent(in)  nod,
logical, intent(out)  valid 
)
private

Check tensor conditioning.

Parameters
[in]d1First diagonal coefficient
[in]d2Second diagonal coefficient
[in]nodNormalized off-diagonal coefficient
[out]validConditioning validity

Definition at line 1252 of file tools_func.F90.

◆ func_cholesky()

subroutine tools_func::func_cholesky ( type(mpl_type), intent(inout)  mpl,
integer, intent(in)  n,
real(kind_real), dimension(n,n), intent(in)  a,
real(kind_real), dimension(n,n), intent(out)  u 
)
private

Compute cholesky decomposition.

Parameters
[in,out]mplMPI data
[in]nMatrix rank
[in]aMatrix
[out]uMatrix square-root

Definition at line 1357 of file tools_func.F90.

◆ func_cx_to_cxa()

integer function tools_func::func_cx_to_cxa ( integer, intent(in)  nproc,
integer, dimension(nproc), intent(in)  proc_to_cx_offset,
integer, intent(in)  icx 
)
private

Conversion from global to halo A on subset Scx.

Parameters
[in]nprocNumber of processors
[in]proc_to_cx_offsetProcessor to offset on subset Scx
[in]icxGlobal index

Definition at line 1553 of file tools_func.F90.

◆ func_cx_to_cxu()

integer function tools_func::func_cx_to_cxu ( integer, intent(in)  nproc,
integer, dimension(nproc), intent(in)  proc_to_cx_offset,
integer, dimension(nproc), intent(in)  proc_to_ncxa,
logical, dimension(nproc), intent(in)  myuniverse,
integer, intent(in)  icx 
)
private

Conversion from global to universe on subset Scx.

Parameters
[in]nprocNumber of processors
[in]proc_to_cx_offsetProcessor to offset on subset Scx
[in]proc_to_ncxaProcessor to halo A size for subset Scx
[in]myuniverseTask universe
[in]icxGlobal index

Definition at line 1624 of file tools_func.F90.

◆ func_cx_to_proc()

integer function tools_func::func_cx_to_proc ( integer, intent(in)  nproc,
integer, dimension(nproc), intent(in)  proc_to_cx_offset,
integer, intent(in)  icx 
)
private

Conversion from global to processor on subset Scx.

Parameters
[in]nprocNumber of processors
[in]proc_to_cx_offsetProcessor to offset on subset Scx
[in]icxGlobal index

Definition at line 1589 of file tools_func.F90.

◆ func_det()

subroutine tools_func::func_det ( real(kind_real), dimension(3), intent(in)  v1,
real(kind_real), dimension(3), intent(in)  v2,
real(kind_real), dimension(3), intent(in)  v3,
real(kind_real), intent(out)  p,
logical, intent(out)  cflag 
)
private

Compute determinant (vector triple product)

Parameters
[in]v1First vector
[in]v2Second vector
[in]v3Third vector
[out]pDeterminant
[out]cflagConfidence flag

Definition at line 583 of file tools_func.F90.

◆ func_divide()

subroutine tools_func::func_divide ( type(mpl_type), intent(in)  mpl,
real(kind_real), intent(inout)  val,
real(kind_real), intent(in)  num 
)
private

Check if value missing and divide if not missing.

Parameters
[in]mplMPI data
[in,out]valValue to divide
[in]numDivider

Definition at line 744 of file tools_func.F90.

◆ func_fit_diag()

subroutine tools_func::func_fit_diag ( type(mpl_type), intent(inout)  mpl,
integer, intent(in)  nc3,
integer, intent(in)  nl0r,
integer, intent(in)  nl0,
integer, dimension(nl0r,nl0), intent(in)  l0rl0_to_l0,
real(kind_real), dimension(nc3), intent(in)  disth,
real(kind_real), dimension(nl0,nl0), intent(in)  distv,
real(kind_real), dimension(nl0), intent(in)  coef,
real(kind_real), dimension(nl0), intent(in)  rh,
real(kind_real), dimension(nl0), intent(in)  rv,
real(kind_real), dimension(nc3,nl0r,nl0), intent(out)  fit 
)
private

Compute diagnostic fit function.

Parameters
[in,out]mplMPI data
[in]nc3Number of classes
[in]nl0rEffective number of levels
[in]nl0Number of levels
[in]l0rl0_to_l0Effective level to level
[in]disthHorizontal distance
[in]distvVertical distance
[in]coefDiagonal coefficient
[in]rhHorizontal support radius
[in]rvVertical support radius

Definition at line 775 of file tools_func.F90.

◆ func_fit_func()

real(kind_real) function tools_func::func_fit_func ( type(mpl_type), intent(inout)  mpl,
real(kind_real), intent(in)  distnorm 
)
private

Fit_function.

Parameters
[in,out]mplMPI data
[in]distnormNormalized distance

Definition at line 1004 of file tools_func.F90.

◆ func_fit_lct()

subroutine tools_func::func_fit_lct ( type(mpl_type), intent(inout)  mpl,
integer, intent(in)  nc,
integer, intent(in)  nl0,
real(kind_real), dimension(nc,nl0), intent(in)  dxsq,
real(kind_real), dimension(nc,nl0), intent(in)  dysq,
real(kind_real), dimension(nc,nl0), intent(in)  dxdy,
real(kind_real), dimension(nc,nl0), intent(in)  dzsq,
logical, dimension(nc,nl0), intent(in)  dmask,
integer, intent(in)  nscales,
real(kind_real), dimension(4,nscales), intent(in)  D,
real(kind_real), dimension(nscales), intent(in)  coef,
real(kind_real), dimension(nc,nl0), intent(out)  fit 
)
private

LCT fit.

Parameters
[in,out]mplMPI data
[in]ncNumber of classes
[in]nl0Number of levels
[in]dxsqZonal separation squared
[in]dysqMeridian separation squared
[in]dxdyZonal x meridian separations product
[in]dzsqVertical separation squared
[in]dmaskMask
[in]nscalesNumber of LCT scales
[in]dLCT components
[in]coefLCT coefficients

Definition at line 1037 of file tools_func.F90.

◆ func_fletcher32()

integer function tools_func::func_fletcher32 ( real(kind_real), dimension(:), intent(in)  var)
private

Fletcher-32 checksum algorithm.

Parameters
[in]varVariable

Definition at line 156 of file tools_func.F90.

◆ func_gc99()

real(kind_real) function tools_func::func_gc99 ( real(kind_real), intent(in)  distnorm)
private

Gaspari and Cohn (1999) function, with the support radius as a parameter.

Parameters
[in]distnormNormalized distance

Definition at line 963 of file tools_func.F90.

◆ func_gridhash()

subroutine tools_func::func_gridhash ( integer, intent(in)  ncx,
integer, intent(in)  nlx,
real(kind_real), dimension(ncx), intent(in)  lon_cx,
real(kind_real), dimension(ncx), intent(in)  lat_cx,
logical, dimension(ncx,nlx), intent(in)  mask_cx,
integer, dimension(0:nlx), intent(out)  grid_hash 
)
private

Compute grid hash profile.

Parameters
[in]ncxNumber of points
[in]nlxNumber of levels
[in]lon_cxLongitude (radians)
[in]lat_cxLatitude (radians)
[in]mask_cxMask
[out]grid_hashGrid hash profile

Definition at line 226 of file tools_func.F90.

◆ func_histogram()

subroutine tools_func::func_histogram ( type(mpl_type), intent(inout)  mpl,
integer, intent(in)  nlist,
real(kind_real), dimension(nlist), intent(in)  list,
integer, intent(in)  nbins,
real(kind_real), intent(in)  histmin,
real(kind_real), intent(in)  histmax,
real(kind_real), dimension(nbins+1), intent(out)  bins,
real(kind_real), dimension(nbins), intent(out)  hist 
)
private

Compute bins and histogram from a list of values.

Parameters
[in,out]mplMPI data
[in]nlistList size
[in]nbinsNumber of bins
[in]histminHistogram minimum
[in]histmaxHistogram maximum
[out]histHistogram

Definition at line 1478 of file tools_func.F90.

◆ func_independent_levels()

subroutine tools_func::func_independent_levels ( type(mpl_type), intent(inout)  mpl,
integer, intent(in)  nlx,
integer, dimension(nlx), intent(in)  grid_hash,
integer, intent(out)  nlxi,
integer, dimension(nlx), intent(out)  lx_to_lxi,
integer, dimension(nlx), intent(out)  lxi_to_lx,
integer, intent(in)  ifmt 
)
private

Compute independent levels.

Parameters
[in,out]mplMPI data
[in]nlxNumber of levels
[in]grid_hashGrid hash profile
[out]nlxiNumber of independent levels
[out]lx_to_lxiLevels to independent levels
[out]lxi_to_lxIndependent levels to levels
[in]ifmtIndentation

Definition at line 289 of file tools_func.F90.

◆ func_lct_d2h()

subroutine tools_func::func_lct_d2h ( type(mpl_type), intent(inout)  mpl,
real(kind_real), intent(in)  D11,
real(kind_real), intent(in)  D22,
real(kind_real), intent(in)  D33,
real(kind_real), intent(in)  D12,
real(kind_real), intent(out)  H11,
real(kind_real), intent(out)  H22,
real(kind_real), intent(out)  H33,
real(kind_real), intent(out)  H12 
)
private

From D (Daley tensor) to H (local correlation tensor)

Parameters
[in,out]mplMPI data
[in]d11Daley tensor component 11
[in]d22Daley tensor component 22
[in]d33Daley tensor component 33
[in]d12Daley tensor component 12
[out]h11Local correlation tensor component 11
[out]h22Local correlation tensor component 22
[out]h33Local correlation tensor component 33
[out]h12Local correlation tensor component 12

Definition at line 1117 of file tools_func.F90.

◆ func_lct_h2r()

subroutine tools_func::func_lct_h2r ( type(mpl_type), intent(inout)  mpl,
real(kind_real), intent(in)  H11,
real(kind_real), intent(in)  H22,
real(kind_real), intent(in)  H33,
real(kind_real), intent(in)  H12,
real(kind_real), intent(out)  rh,
real(kind_real), intent(out)  rv 
)
private

From H (local correlation tensor) to support radii.

Parameters
[in,out]mplMPI data
[in]h11Local correlation tensor component 11
[in]h22Local correlation tensor component 22
[in]h33Local correlation tensor component 33
[in]h12Local correlation tensor component 12
[out]rhHorizontal support radius
[out]rvVertical support radius

Definition at line 1167 of file tools_func.F90.

◆ func_lct_r2d()

subroutine tools_func::func_lct_r2d ( real(kind_real), intent(in)  r,
real(kind_real), intent(out)  D 
)
private

From support radius to Daley tensor diagonal element.

Parameters
[in]rSupport radius
[out]dDaley tensor diagonal element

Definition at line 1226 of file tools_func.F90.

◆ func_lonlat2xyz()

subroutine tools_func::func_lonlat2xyz ( type(mpl_type), intent(inout)  mpl,
real(kind_real), intent(in)  lon,
real(kind_real), intent(in)  lat,
real(kind_real), intent(out)  x,
real(kind_real), intent(out)  y,
real(kind_real), intent(out)  z 
)
private

Convert longitude/latitude to cartesian coordinates.

Parameters
[in,out]mplMPI data
[in]lonLongitude (radians)
[in]latLatitude (radians)
[out]xX coordinate
[out]yY coordinate
[out]zZ coordinate

Definition at line 454 of file tools_func.F90.

◆ func_lonlathash()

real(kind_real) function tools_func::func_lonlathash ( real(kind_real), intent(in)  lon,
real(kind_real), intent(in)  lat,
integer, intent(in), optional  il 
)
private

Define a unique real from a lon/lat pair.

Parameters
[in]lonLongitude (radians)
[in]latLatitude (radians)
[in]ilLevel

Definition at line 380 of file tools_func.F90.

◆ func_lonlatmod()

subroutine tools_func::func_lonlatmod ( real(kind_real), intent(inout)  lon,
real(kind_real), intent(inout)  lat 
)
private

Set latitude between -pi/2 and pi/2 and longitude between -pi and pi.

Parameters
[in,out]lonLongitude (radians)
[in,out]latLatitude (radians)

Definition at line 184 of file tools_func.F90.

◆ func_matern()

real(kind_real) function tools_func::func_matern ( type(mpl_type), intent(inout)  mpl,
integer, intent(in)  M,
real(kind_real), intent(in)  x 
)
private

Compute the normalized diffusion function from eq. (55) of Mirouze and Weaver (2013), for the 3d case (d = 3)

Parameters
[in,out]mplMPI data
[in]mMatern function order
[in]xArgument

Definition at line 1302 of file tools_func.F90.

◆ func_order_cc()

subroutine tools_func::func_order_cc ( type(mpl_type), intent(inout)  mpl,
real(kind_real), intent(in)  lon,
real(kind_real), intent(in)  lat,
integer  n,
real(kind_real), dimension(n), intent(in)  x,
real(kind_real), dimension(n), intent(in)  y,
real(kind_real), dimension(n), intent(in)  z,
integer, dimension(n), intent(out)  order,
real(kind_real), dimension(n), intent(out), optional  diff 
)
private

Order points in counter-clockwise order with respect to a central point.

Parameters
[in,out]mplMPI data
[in]lonLongitude of the central point
[in]latLatitude of the central point
nNumber of points
[in]xList of X-coordinates
[in]yList of Y-coordinates
[in]zList of Z-coordinates
[out]orderCounter-clockwise order
[out]diffAngles differences

Definition at line 630 of file tools_func.F90.

◆ func_sphere_dist()

subroutine tools_func::func_sphere_dist ( real(kind_real), intent(in)  lon_i,
real(kind_real), intent(in)  lat_i,
real(kind_real), intent(in)  lon_f,
real(kind_real), intent(in)  lat_f,
real(kind_real), intent(out)  dist 
)
private

Compute the great-circle distance between two points.

Parameters
[in]lon_iInitial point longitude (radians)
[in]lat_iInitial point latitude (radians)
[in]lon_fFinal point longitude (radians)
[in]lat_fFinal point latitude (radians)
[out]distGreat-circle distance

Definition at line 419 of file tools_func.F90.

◆ func_syminv()

subroutine tools_func::func_syminv ( type(mpl_type), intent(inout)  mpl,
integer, intent(in)  n,
real(kind_real), dimension(n,n), intent(in)  a,
real(kind_real), dimension(n,n), intent(out)  c 
)
private

Compute inverse of a symmetric matrix.

Parameters
[in,out]mplMPI data
[in]nMatrix rank
[in]aMatrix
[out]cMatrix inverse

Definition at line 1418 of file tools_func.F90.

◆ func_vector_product()

subroutine tools_func::func_vector_product ( real(kind_real), dimension(3), intent(in)  v1,
real(kind_real), dimension(3), intent(in)  v2,
real(kind_real), dimension(3), intent(out)  vp 
)
private

Compute normalized vector product.

Parameters
[in]v1First vector
[in]v2Second vector
[out]vpVector product

Definition at line 547 of file tools_func.F90.

◆ func_xyz2lonlat()

subroutine tools_func::func_xyz2lonlat ( type(mpl_type), intent(in)  mpl,
real(kind_real), intent(in)  x,
real(kind_real), intent(in)  y,
real(kind_real), intent(in)  z,
real(kind_real), intent(out)  lon,
real(kind_real), intent(out)  lat 
)
private

Convert longitude/latitude to cartesian coordinates.

Parameters
[in]mplMPI data
[in]xX coordinate
[in]yY coordinate
[in]zZ coordinate
[out]lonLongitude (radians)
[out]latLatitude (radians)

Definition at line 501 of file tools_func.F90.

Variable Documentation

◆ condmax

real(kind_real), parameter tools_func::condmax = thousand

Maximum tensor conditioning number.

Definition at line 48 of file tools_func.F90.

◆ dmin

real(kind_real), parameter, public tools_func::dmin = 1.0e-12_kind_real

Minimum tensor diagonal value.

Definition at line 47 of file tools_func.F90.

◆ gau2gc

real(kind_real), parameter, public tools_func::gau2gc = 3.57_kind_real

Gaussian Daley length-scale to GC99 support radius (empirical)

Definition at line 46 of file tools_func.F90.

◆ gc2gau

real(kind_real), parameter, public tools_func::gc2gau = 0.28_kind_real

GC99 support radius to Gaussian Daley length-scale (empirical)

Definition at line 45 of file tools_func.F90.

◆ m

integer, parameter, public tools_func::m = 0

Number of implicit iteration for the Matern function (0: Gaussian)

Definition at line 49 of file tools_func.F90.