コード例 #1
0
ファイル: methods.py プロジェクト: joeyoun9/thesis
def variance(
    data,
    binsize=300,
    limit=1000,
    inTime=True,
    returnfield=False,
    continuous=False,
    power=False,
    vertbin=5,
    nbins=20,
    **kwargs
):
    """
    Compute boundary layer/aerosol layer depth by evaluating temporal variance
    under the assumption that sufficient smoothing will result in variations
    of boundary layer top being apparent.
    """
    if data == "about":
        return "110Variance"
    field, time, height = u._ComputeFieldMeans(
        data, binsize, inTime=inTime, continuous=continuous, vertbin=vertbin, power=power
    )
    # Now, to preserve shape, I am going to do a running calculation of STDev
    field = runstd(field, nbins) ** 2

    if returnfield:
        return (field, time, height)
    depth = u._MaxDepth(field, height, limit=limit)
    return (depth, time)
コード例 #2
0
ファイル: methods.py プロジェクト: joeyoun9/thesis
def ipm(
    data, limit=1000, binsize=300, inTime=True, eval_dist=20, continuous=False, returnfield=False, vertbin=5, **kwargs
):
    """
    determine mixed layer/aerosol depth by determinng the maximum decrease 
    (this is not the second gradient method)

    Known as the inflection point method (IPM)
    
    note, if inTime is false, a time value is still required!!!
    """
    if data == "about":
        return "110Inflection Point Method"
    bs, times, z = u._ComputeFieldMeans(
        data, binsize, inTime=inTime, continuous=continuous, vertbin=vertbin, power=True
    )
    # Compute the gradient of the gradient'
    # FIXME - do i want negative or positive gradients!?!!'
    field = np.gradient(np.gradient(bs, eval_dist)[1], eval_dist)[1]
    field[field >= 0.0] = np.NAN
    field = np.log10(-1 * field)
    if returnfield:
        field[np.isnan(field)] = np.nanmin(field)
        return (field, times, z)
    field = field[:, 20:]
    z = z[20:]
    # We need to compute the max above 200m.
    depth = u._MaxDepth(field, z, limit=limit)
    return (depth, times)