SABER
tools_func Module Reference

Usual functions. More...

Data Types

interface  c_fletcher32
 

Functions/Subroutines

integer function, public fletcher32 (var)
 Fletcher-32 checksum algorithm. More...
 
subroutine, public lonlatmod (lon, lat)
 Set latitude between -pi/2 and pi/2 and longitude between -pi and pi. More...
 
real(kind_real) function, public lonlathash (lon, lat, il)
 Define a unique real from a lon/lat pair. More...
 
subroutine, public sphere_dist (lon_i, lat_i, lon_f, lat_f, dist)
 Compute the great-circle distance between two points. More...
 
subroutine, public reduce_arc (lon_i, lat_i, lon_f, lat_f, maxdist, dist)
 Reduce arc to a given distance. More...
 
subroutine, public lonlat2xyz (mpl, lon, lat, x, y, z)
 Convert longitude/latitude to cartesian coordinates. More...
 
subroutine, public xyz2lonlat (mpl, x, y, z, lon, lat)
 Convert longitude/latitude to cartesian coordinates. More...
 
subroutine, public vector_product (v1, v2, vp)
 Compute normalized vector product. More...
 
subroutine, public vector_triple_product (v1, v2, v3, p, cflag)
 Compute vector triple product. More...
 
subroutine, public add (mpl, val, cumul, num, wgt)
 Check if value missing and add if not missing. More...
 
subroutine, public divide (mpl, val, num)
 Check if value missing and divide if not missing. More...
 
subroutine, public fit_diag (mpl, nc3, nl0r, nl0, l0rl0_to_l0, disth, distv, coef, rh, rv, fit)
 Compute diagnostic fit function. More...
 
real(kind_real) function gc99 (distnorm)
 Gaspari and Cohn (1999) function, with the support radius as a parameter. More...
 
real(kind_real) function, public fit_func (mpl, distnorm)
 Fit_function. More...
 
subroutine, public fit_lct (mpl, nc, nl0, dxsq, dysq, dxdy, dzsq, dmask, nscales, D, coef, fit)
 LCT fit. More...
 
subroutine, public lct_d2h (mpl, D11, D22, D33, D12, H11, H22, H33, H12)
 From D (Daley tensor) to H (local correlation tensor) More...
 
subroutine, public lct_h2r (mpl, H11, H22, H33, H12, rh, rv)
 From H (local correlation tensor) to support radii. More...
 
subroutine, public lct_r2d (r, D)
 From support radius to Daley tensor diagonal element. More...
 
subroutine, public check_cond (d1, d2, nod, valid)
 Check tensor conditioning. More...
 
real(kind_real) function 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, public cholesky (mpl, n, a, u, ierr)
 Compute cholesky decomposition. More...
 
subroutine, public syminv (mpl, n, a, c, ierr)
 Compute inverse of a symmetric matrix. More...
 
subroutine, public pseudoinv (mpl, n, a, c, ierr, mmax, var_th)
 
subroutine da_eof_decomposition (kz, bx, e, l, ierr)
 
subroutine, public histogram (mpl, nlist, list, nbins, histmin, histmax, bins, hist)
 Compute bins and histogram from a list of values. More...
 

Variables

real(kind_real), parameter, public gc2gau = 0.28
 
real(kind_real), parameter, public gau2gc = 3.57
 
real(kind_real), parameter, public dmin = 1.0e-12_kind_real
 
real(kind_real), parameter condmax = 1.0e3
 
integer, parameter, public m = 0
 

Detailed Description

Usual functions.

Function/Subroutine Documentation

◆ add()

subroutine, public tools_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 
)

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 329 of file tools_func.F90.

Here is the caller graph for this function:

◆ check_cond()

subroutine, public tools_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 
)

Check tensor conditioning.

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

Definition at line 791 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cholesky()

subroutine, public tools_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,
integer, intent(out)  ierr 
)

Compute cholesky decomposition.

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

Definition at line 876 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ da_eof_decomposition()

subroutine tools_func::da_eof_decomposition ( integer, intent(in)  kz,
real(kind_real), dimension(1:kz,1:kz), intent(in)  bx,
real(kind_real), dimension(1:kz,1:kz), intent(out)  e,
real(kind_real), dimension(1:kz), intent(out)  l,
integer, intent(out)  ierr 
)
private

Definition at line 1080 of file tools_func.F90.

Here is the caller graph for this function:

◆ divide()

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

Check if value missing and divide if not missing.

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

Definition at line 359 of file tools_func.F90.

Here is the caller graph for this function:

◆ fit_diag()

subroutine, public tools_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 
)

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 381 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fit_func()

real(kind_real) function, public tools_func::fit_func ( type(mpl_type), intent(inout)  mpl,
real(kind_real), intent(in)  distnorm 
)

Fit_function.

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

Definition at line 583 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fit_lct()

subroutine, public tools_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 
)

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 610 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fletcher32()

integer function, public tools_func::fletcher32 ( real(kind_real), dimension(:), intent(in)  var)

Fletcher-32 checksum algorithm.

Parameters
[in]varVariable

Definition at line 46 of file tools_func.F90.

Here is the call graph for this function:

◆ gc99()

real(kind_real) function tools_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 560 of file tools_func.F90.

Here is the caller graph for this function:

◆ histogram()

subroutine, public tools_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 
)

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 1115 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lct_d2h()

subroutine, public tools_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 
)

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 681 of file tools_func.F90.

Here is the caller graph for this function:

◆ lct_h2r()

subroutine, public tools_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 
)

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 723 of file tools_func.F90.

Here is the caller graph for this function:

◆ lct_r2d()

subroutine, public tools_func::lct_r2d ( real(kind_real), intent(in)  r,
real(kind_real), intent(out)  D 
)

From support radius to Daley tensor diagonal element.

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

Definition at line 774 of file tools_func.F90.

Here is the caller graph for this function:

◆ lonlat2xyz()

subroutine, public tools_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 
)

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 188 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lonlathash()

real(kind_real) function, public tools_func::lonlathash ( real(kind_real), intent(in)  lon,
real(kind_real), intent(in)  lat,
integer, intent(in), optional  il 
)

Define a unique real from a lon/lat pair.

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

Definition at line 95 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lonlatmod()

subroutine, public tools_func::lonlatmod ( real(kind_real), intent(inout)  lon,
real(kind_real), intent(inout)  lat 
)

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 65 of file tools_func.F90.

Here is the caller graph for this function:

◆ matern()

real(kind_real) function tools_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 832 of file tools_func.F90.

Here is the caller graph for this function:

◆ pseudoinv()

subroutine, public tools_func::pseudoinv ( 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,
integer, intent(out)  ierr,
integer, intent(in), optional  mmax,
real(kind_real), intent(in), optional  var_th 
)

Definition at line 982 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduce_arc()

subroutine, public tools_func::reduce_arc ( real(kind_real), intent(in)  lon_i,
real(kind_real), intent(in)  lat_i,
real(kind_real), intent(inout)  lon_f,
real(kind_real), intent(inout)  lat_f,
real(kind_real), intent(in)  maxdist,
real(kind_real), intent(out)  dist 
)

Reduce arc to a given distance.

Parameters
[in]lon_iInitial point longitude (radians)
[in]lat_iInitial point latitude (radians)
[in,out]lon_fFinal point longitude (radians)
[in,out]lat_fFinal point latitude (radians)
[in]maxdistMaximum distance
[out]distEffective distance

Definition at line 151 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sphere_dist()

subroutine, public tools_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 
)

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 longilatitudetude (radians)
[out]distGreat-circle distance

Definition at line 125 of file tools_func.F90.

Here is the caller graph for this function:

◆ syminv()

subroutine, public tools_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,
integer, intent(out)  ierr 
)

Compute inverse of a symmetric matrix.

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

Definition at line 929 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vector_product()

subroutine, public tools_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 
)

Compute normalized vector product.

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

Definition at line 264 of file tools_func.F90.

Here is the caller graph for this function:

◆ vector_triple_product()

subroutine, public tools_func::vector_triple_product ( 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 
)

Compute vector triple product.

Parameters
[in]v1First vector
[in]v2Second vector
[in]v3Third vector
[out]pTriple product
[out]cflagConfidence flag

Definition at line 291 of file tools_func.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xyz2lonlat()

subroutine, public tools_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 
)

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 227 of file tools_func.F90.

Here is the caller graph for this function:

Variable Documentation

◆ condmax

real(kind_real), parameter tools_func::condmax = 1.0e3

Definition at line 23 of file tools_func.F90.

◆ dmin

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

Definition at line 22 of file tools_func.F90.

◆ gau2gc

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

Definition at line 21 of file tools_func.F90.

◆ gc2gau

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

Definition at line 20 of file tools_func.F90.

◆ m

integer, parameter, public tools_func::m = 0

Definition at line 24 of file tools_func.F90.