AvailablePotentialEnergyFramework.AvailablePotentialEnergyFrameworkModule

Data filters: filter_array, filter_array_2, filter_array_time, getsmoothdata, getsmoothdata_nospace Data structures: ape_budget, cat_ape_budget, cutborders!, surf_quantities, cyclone_comp_timemean, Composite_Cyclone, Composite_Cyclone_v2, Composite_Cyclone_v3 Methods: cyclonecompositer, shifter, smoothfilter, cyclonecompositer_v2, cyclonecompositer_v3, timemean_nofalseframe, removefalseframes, getapebudget, buoyancybudget

AvailablePotentialEnergyFramework.add_allcyclones!Method

addallcyclones!(addition :: Array{T,2}, buf :: Array{T,2},array :: Array{T,2},radiusbins,array :: Array{T,3},segmentedcyclones,cyclonescenters,gridspacing)

Compute the azimuthal average of some quantity around a center. Repeats the process and averages about all the tropical cyclones detected on the array. It receives an array with the radius bins to use,the field to average, called array, each cyclone as a SegmentedImage,the centers of the cyclones and the gridspacing.

AvailablePotentialEnergyFramework.add_allcyclonesMethod

addallcyclones(array :: Array{T,2},radiusbins,array :: Array{T,3},segmentedcyclones,cyclonescenters,gridspacing)

Compute the azimuthal average of some quantity around a center. Repeats the process and averages about all the tropical cyclones detected on the array. It receives an array with the radius bins to use,the field to average, called array, each cyclone as a SegmentedImage,the centers of the cyclones and the gridspacing.

AvailablePotentialEnergyFramework.average_precipitation_per_pw_binMethod
average_precipitation_per_pw_bin(pw,precipitation,bins,binspacing)

Computes the mean precipitation as a function of the binned precipitable water following Yang, D., 2018: Boundary Layer Height and Buoyancy Determine the Horizontal Scale of Convective Self-Aggregation. J. Atmos. Sci., 75, 469–478, https://doi.org/10.1175/JAS-D-17-0150.1. It will be happy if bins is quite large (example from 0 to 300 mm).

AvailablePotentialEnergyFramework.averageallindistance!Method
averageallindistance!(radiusbin,array :: Array{T,3},center,gridspacing = 1)

Create an average of the quantity in array at all the points located between radiusbin[1] and radiusbin[2] from a center. The points should be masked by a boolean array. It assumes a uniform gridspacing.

AvailablePotentialEnergyFramework.averageallindistanceMethod
averageallindistance(radiusbin,array :: Array{T,3},mask,center,gridspacing = 1)

Create an average of the quantity in array at all the points located between radiusbin[1] and radiusbin[2] from a center. The points should be masked by a boolean array. It assumes a uniform gridspacing.

AvailablePotentialEnergyFramework.averageallindistanceMethod
averageallindistance(radiusbin,array :: Array{T,2},mask,center,gridspacing = 1)

Create an average of the quantity in array at all the points located between radiusbin[1] and radiusbin[2] from a center. The points should be masked by a boolean array. It assumes a uniform gridspacing.

AvailablePotentialEnergyFramework.azimuthalaverage_allcyclonesMethod
azimuthalaverage_allcyclones(radius_bins,array :: Array{T,3},segmentedcyclones,cyclonescenters,gridspacing)

Compute the azimuthal average of some quantity around a center. Repeats the process and averages about all the tropical cyclones detected on the array. It receives an array with the radius bins to use,the field to average, called array, each cyclone as a SegmentedImage,the centers of the cyclones and the gridspacing.

AvailablePotentialEnergyFramework.azimuthalaverage_allcyclonesMethod
azimuthalaverage_allcyclones(radius_bins,array :: Array{T,3},segmentedcyclones,cyclonescenters,gridspacing)

Compute the azimuthal average of some quantity around a center. Repeats the process and averages about all the tropical cyclones detected on the array. It receives an array with the radius bins to use,the field to average, called array, each cyclone as a SegmentedImage,the centers of the cyclones and the gridspacing.

AvailablePotentialEnergyFramework.buoyancybudget_oldMethod

––––––-This function computes the buoyancy budget–––––––- Inputs: B (buoyancy) RAD_b the radiative heating, converted to units of buoyancy Fs the Surface fluxes U,V,W The three dimensional velocities N2 The Brunt Va"isala frequency squared dx,dy,dz,dt the steps in each coordinate x,y,z,t the coordinate vectors

AvailablePotentialEnergyFramework.compute_N2Method
compute_N2(xBar_Tv,z)

Take a (1,1,size(z),size(t)) profile of temperature or virtual temperature and return the Brunt - Väisälä frequency at each z level and at each t.

AvailablePotentialEnergyFramework.filter_array!Method
filter_array!(buffer,array,smooth_x,smooth_t,position)

Filters the input array in-place using a moving mean. In the first two dimensions the window width is smoothx and the border is treated as circular (for doubly periodic domains). In the space dimension the width is smootht and the border value is replicated.

This function calls under the hood the imfilter function of Images.jl

The first argument must be a buffer of the same size of array.

AvailablePotentialEnergyFramework.filter_arrayMethod

filterarray(array,smoothx,smooth_t,position)

Filters the input arrayusing a moving mean. In the first two dimensions the window width is smoothx and the border is treated as circular (for doubly periodic domains). In the space dimension the width is smootht and the border value is replicated.

This function calls under the hood the imfilter function of Images.jl

The first argument must be a buffer of the same size of array.

AvailablePotentialEnergyFramework.filter_arrayMethod

filterarray(array,smoothx,smooth_t,position)

Filters the input arrayusing a moving mean. In the first two dimensions the window width is smoothx and the border is treated as circular (for doubly periodic domains). In the space dimension the width is smootht and the border value is replicated.

This function calls under the hood the imfilter function of Images.jl

The first argument must be a buffer of the same size of array.

AvailablePotentialEnergyFramework.filter_array_2!Method

filterarray2!(array,smoothx,smootht,position)

Filters the input array in-place using a moving mean.

In the first two dimensions the window width is smoothx and the border is treated as circular (for doubly periodic domains). In the space dimension the width is smootht and the border value is replicated.

This function calls under the hood the imfilter function of Images.jl

AvailablePotentialEnergyFramework.filter_array_2!Method
filter_array_2!(array,smooth_x,smooth_t,position)

Filter the input array in-place using a moving mean.

In the first two dimensions the window width is smoothx and the border is treated as circular (for doubly periodic domains). In the space dimension the width is smootht and the border value is replicated.

This function calls under the hood the imfilter function of Images.jl

AvailablePotentialEnergyFramework.filter_array_nospaceMethod

filterarraynospace(array,smooth_t,position)

Filters the input array using a moving mean along the third dimension. In the 3th dimension the width is smooth_t and the border value is replicated except if position = 2, in which case it only takes the inner part of the smoothed array.

This function calls under the hood the imfilter function of Images.jl

AvailablePotentialEnergyFramework.filter_array_nospaceMethod

filterarraynospace(array,smooth_t,position)

Filters the input array using a moving mean along the fourth dimension. In the 4th dimension the width is smooth_t and the border value is replicated except if position = 2, in which case it only takes the inner part of the smoothed array.

This function calls under the hood the imfilter function of Images.jl

AvailablePotentialEnergyFramework.filter_array_timeMethod

filterarraynospace(array,smooth_t,position=1)

Filters the input, 1-d array. The border value is replicated except if position = 2, in which case it only takes the inner part of the smoothed array.

This function calls under the hood the imfilter function of Images.jl

AvailablePotentialEnergyFramework.findcyclonecenters!Method

findcyclonecentersaspressureminima!(buf1,buf2,surfpresanomaly,detectionthreshold)

Takes a surface pressure anomaly array surfpresanomaly[x,y] = surfpres[x,y] .- mean(surfpres,dims(1,2)) a detection threshold for the anomaly, and return an array of tuples (x,y) where each tuple represents the centers of cyclones identified as the minima of the anomaly.

AvailablePotentialEnergyFramework.findcyclonecenters!Method

findcyclonecentersaspressureminima!(buf1,buf2,surfpresanomaly,detectionthreshold)

Takes a surface pressure anomaly array surfpresanomaly[x,y] = surfpres[x,y] .- mean(surfpres,dims(1,2)) a detection threshold for the anomaly, and return an array of tuples (x,y) where each tuple represents the centers of cyclones identified as the minima of the anomaly.

AvailablePotentialEnergyFramework.findcyclonecentersMethod

findcyclonecentersaspressureminima(surfpresanomaly,detectionthreshold)

Takes a surface pressure anomaly array surfpresanomaly[x,y] = surfpres[x,y] .- mean(surfpres,dims(1,2)) a detection threshold for the anomaly, and return an array of tuples (x,y) where each tuple represents the centers of cyclones identified as the minima of the anomaly.

AvailablePotentialEnergyFramework.get_lifted_condensation_levelMethod
get_lifted_condensation_level(temperature,relative_humidity,pressure)

Receive temperature in Kelvin, relative humidity (unitless) and pressure (hPa) and compute the lifted condensation level based on Emanuel's E94 "calcsound.f" code at http://texmex.mit.edu/pub/emanuel/BOOK/

AvailablePotentialEnergyFramework.get_mixing_ratioMethod
get_mixing_ratio(water_vapor_partial_pressure,env_pressure)

Receive a water vapor mixing ratio (unitless g/g) and environmental pressure and compute the partial pressure of water vapor in the same units as the incoming pressure.

AvailablePotentialEnergyFramework.get_saturation_vapor_pressureMethod
get_saturation_vapor_pressure(T)

Receive temperature T in Kelvin and compute the saturation vapor pressure in hPa from the August-Roche-Magnus formula that approximates the solution to the Clausius-Clapeyron relationship (Wikipedia contributors. (2020, December 19). Clausius–Clapeyron relation. In Wikipedia, The Free Encyclopedia. Retrieved 06:57, December 20, 2020, from https://en.wikipedia.org/w/index.php?title=Clausius%E2%80%93Clapeyron_relation&oldid=995159175)

AvailablePotentialEnergyFramework.get_specific_entropyMethod
get_specific_entropy(temperature,mixing_ratio,pressure)

Receive temperature in Kelvin, water vapor mixing ratio (unitless g/g) and pressure (hPa) and compute the specific entropy of a parcel using equation in Emmanuel's (E94, EQN. 4.5.9)

AvailablePotentialEnergyFramework.isindexindistancebinFunction
isindexindistancebin(binlimits,index,center = (0,0),gridspacing=1) = (binlimits[1] < distance(index,center,gridspacing) <= binlimits[2]) ? true : false

computes the distance of one index to the origin and returns true if that distance is inside a bin

AvailablePotentialEnergyFramework.isinteractingMethod
isinteracting(cyclones :: SegmentedImage,regionnumber)

Computes the adjacency of identified cyclones and returns true if the cylone-number is adjacent to a region other than the background.

AvailablePotentialEnergyFramework.isinteractingMethod
isinteracting(adjacencyMatrix :: SparseMatrixCSC,regionnumber)

Computes the adjacency of identified cyclones and returns true if the cylone-number is adjacent to a region other than the background.

AvailablePotentialEnergyFramework.kernel_1dMethod
kernel_1d(window)

Create a kernel to perform a moving average filtering of a 1-d array. It will use window as windows size unless the given vaule is even, in which case it will add one to the given value before creating the kernel. This kernel has to be passed into imfilter or imfilter!

AvailablePotentialEnergyFramework.kernel_2dFunction

kernel2d(windowh,T :: Type :: Float64) Create a kernel to perform a moving average filtering of a 2-d array along the dimensions 1,2. It will use window_h as windows size unless the given vaule is even, in which case it will add one to the given value before creating the kernel. This kernel has to be passed into imfilter or imfilter!

AvailablePotentialEnergyFramework.kernel_3dFunction

kernel3d(windowh,windowt,T :: Type :: Float64) Create a kernel to perform a moving average filtering of a 3-d array along the dimensions 1,2 and 3. It will use windowh (dimensions 1 and 2) and window_t (dimension 3) as windows sizes unless the given vaules are even, in which case it will add one to the given value before creating the kernel. This kernel has to be passed into imfilter or imfilter!

AvailablePotentialEnergyFramework.kernel_3d_tFunction

kernel3dt(windowt,T :: Type :: Float64) Create a kernel to perform a moving average filtering of a 3-d array along the dimension 3. It will use windowt as windows size unless the given vaule is even, in which case it will add one to the given value before creating the kernel. This kernel has to be passed into imfilter or imfilter!

AvailablePotentialEnergyFramework.kernel_4dFunction
kernel_4d(window_h,window_t,T :: Type :: Float64)

Create a kernel to perform a moving average filtering of a 4-d array along the dimensions 1,2 and 4. It will use windowh (dimensions 1 and 2) and windowt (dimension 4) as windows sizes unless the given vaules are even, in which case it will add one to the given value before creating the kernel. This kernel has to be passed into imfilter or imfilter!

AvailablePotentialEnergyFramework.kernel_4d_tFunction

kernel4dt(windowt,T :: Type :: Float64) Create a kernel to perform a moving average filtering of a 4-d array along the dimension 4. It will use windowt as windows size unless the given vaule is even, in which case it will add one to the given value before creating the kernel. This kernel has to be passed into imfilter or imfilter!

AvailablePotentialEnergyFramework.shifter!Method
shifter!(dest,array,time,domain_center,peak)

Stores in dest an array in which a pressure perturbation center is displaced to the center of the domain using circshift. Using it may assume periodic domain. Receives and SAM 3D+time or 2D+time array and two tuples, the (x,y) indices of the domain center, and the (x,y) indices of the location of the pressure perturbation peak.

AvailablePotentialEnergyFramework.shifterMethod
shifter(array,domain_center,peak)

Returns an array in which a pressure perturbation center is displaced to the center of the domain using circshift. Using it may assume periodic domain. Receives and SAM 3D+time or 2D+time array and two tuples, the (x,y) indices of the domain center, and the (x,y) indices of the location of the pressure perturbation peak.

AvailablePotentialEnergyFramework.smooth_and_maskFunction

smoothandmask(surfpresanomaly, threshold = -9)

Takes a 2d array and smooths it using a rolling median filter. It then returns the elements of the filtered array whose values are less than the threshold.

AvailablePotentialEnergyFramework.smooth_and_mask!Function

smoothandmask!(buf,surfpresanomaly, threshold = -9)

Takes a 2d array and smooths it using a rolling median filter. It then returns the elements of the filtered array whose values are less than the threshold.

AvailablePotentialEnergyFramework.smooth_vars_and_write_to_netcdf!Method
smooth_vars_and_write_to_netcdf!(output_file,input_file,vars_to_smooth,window_h,window_t)

Take a netcdf file, a list of variables and two integers and performs a moving mean smoothing of these variables. Write the smoothed fields into a netcdf file called output_file