Ceilo toolbox (Auxiliary functions)

Ceilo tools module

This is the main toolbox designed to aid main processsing by reading and writing to files and processing data.

ceilotools.algmlh(allprf, method, mlh, i, z, tarr, t, uplim)[source]
Algorithms used for Mixed-layer Height determination.This script computes the mlh through an iterative approach and calls the relevant method.

A combined approach, named C2, due to the fact that it was the second version of a Combined algorithm uses both the gradient method and the wavelet method to find the boundary layer top. This was the algorithm used in [GarciaFSB+18].

Parameters

allprf: np.nadarray
backscattering matrix
method: string
String calling a MLH determination method, either of the following strings are accepted: ‘WT’, ‘Gradient’, ‘IPM’, ‘C2’.
tarr : np.array
Time-array, usually decimal hours.
mlh : numpy.nadarray
Mixed-layer height array, usually len(mlh)=144.
i : int
Integer of current time-step. Ranging from 0-143.
z : np.array
Height-array usually length 500, start=10, end=5000, t_step=10 [m]
t : numpy.narray-float
Time float of this specific computation.
uplim : string
Upper-limit of maximum MLH possible.
rtype:mlh: float

Note

See Also functions to estimate and write mlh

writemlh() ipf() wavelets()

ceilotools.writemlh(outputfile, horas, mlhs, station)[source]

Write of mixed-layer file to txt file, using standard heading. For instance:

Parameters

outputfile: string
Output filename. Usually a ‘txt’.
horas : numpy.narray-float
Time vector as hourly decimals. 0., 0.166, …, 23.83.
mlhs : numpy.narray-float
Mixed-layer heights vector.
**station*: string
Station string
Return type:None

See Also

secondary.

ceilotools.writematrix(outputfile, matrix, zeta, hour_vec, station, date, runv)[source]

Write of backscattering matrix to txt file, using standard heading. For instance:

Parameters

outputfile: string
Output filename. Usually a ‘txt’.
matrix: numpy.nadarray
Backscattering matrix mxn where m is the length of time vector, or number of decimal hours in the particular day and n is the length of height vector, usually 500 (10-5000 m every 10 m).
hour_vec : numpy.narray-float
Time vector as hourly decimals. 0., 0.166, …, 23.83.
date : string
Date of measurement (typically %Y%m%d)
**station*: string
Station string
Return type:None

See Also

writemlh

ceilotools.cloudfilter(allprf, tarr, z, datestring)[source]

Cloud filter

This function computes the cloud filter equations described in [Teschke (2008),Garcia-Franco (2017), Garcia-Franco et.al. (2018)]

Parameters

allprf: np.nadarray
backscattering matrix
tarr : np.array
Time-array, usually decimal hours.
z : np.array
Height-array usually length 500, start=10, end=5000, t_step=10 [m]
datestring : string
String for date, typically %Y%m%d, e.g., 20160305
Return type:datetimearray, flag vector: temps returns all datetimes where cloud or precipitation

has been found, flag vector is a numpy array with the dimensions of tarr where clouds are depicted as 1 and clear-sky conditions as 0.

Statistical filter

\[\beta_\sigma (z,t)=B(z,t)\sigma(t)\]
\[\mu=\frac{1}{N_zN_t}\sum_z\sum_t\beta_\sigma(z,t)\]
\[\sum=\frac{1}{N_zN_t-1}\sum_z\sum_t[\beta_\sigma(z,t)-\mu]^2.\]
\[B_N=\mu+3\sqrt{\sum}\]
  • \(B(z,t)\) Backscattering matrix
  • \(\sigma(t)\) Variance over time $t$.
  • \(\mu\) Global mean of beta_sigma(z,t)
  • \(\sum\) Global variance of beta_sigma(z,t)
  • \(z_{max}\) Maximum integration level [m]
  • \(B_N\) Threshold for determining cloud or no cloud, function of both global mean and variance.

B_N defines the threshold value used for determining whether or not a profile at time t presents cloud and precipiation or not. If B(z,t)>B_N then cloud and precipitation are present. Else, clear-sky conditions are considered.

ceilotools.runningMeanFast(x, N)[source]

Running mean of array x over a window of size N.

Parameters

x: np.array
Numpy array, usually 1D, to average over a moving or running mean.
N: numpy.nadarray
Size of moving average window.
rtype:np.array averaged with running mean.

Note

This script makes use of numpy.convolve.

ceilotools.writenumofprof(outputfile, numofprof, t, estacion, date)[source]

Write number of backscattering profiles used for every 10-min averaged window.

Parameters

outputfile: string
Output filename. Usually a ‘txt’.
numofprof: int
Number of profiles used for average
t : numpy.narray-float
Time vector as hourly decimals. 0., 0.166, …, 23.83.
date : string
Date of measurement (typically %Y%m%d)
**estacion*: string
Station string
rtype:None

See Also

writematrix()

ceilotools.readmatrixfile(filename)[source]

Write of backscattering matrix to txt file, using standard heading. For instance:

Parameters

filename: string
Input filename. Usually a ‘txt’.
Return type:z,tarr,allprf height and time vector and backscattering matrix.

See Also

writemlh()

ceilotools.readmlh(filename)[source]

Write of backscattering matrix to txt file, using standard heading. For instance:

Parameters

filename:string
Input filename. Usually a ‘txt’.

:rtype:time-array, mlh-array: time and MLH vector.

See Also

writemlh() , readmatrixfile()