CAPE_CIN {aiRthermo} | R Documentation |

Taking into account the data obtained in a radiosonde, and after defining the initial values of the parcel, this function calculates the values of CAPE and CIN for the sounding.

CAPE_CIN(Ps, Ts, ws, deltaP = 5, P0 = NA, T0 = NA, w0 = NA, PlowTop = NA, precoolType = "none", doLog = 0, getLiftedBack = FALSE, upToTop = TRUE, checkBuoyancy = 0)

`Ps` |
Pressures (Pa) defining the sounding. |

`Ts` |
Temperatures (K) defining the sounding. |

`ws` |
Mixing ratios (kg/kg) defining the sounding. |

`deltaP` |
The width (Pa) of the layers used in the calculation of the numerical solution for the vertical evolution. A default value of 5 Pa is used. It must be positive. |

`P0` |
The initial pressure (Pa) for the parcel that is lifted (may be the lowest level of the sounding). Missing value is used by default. |

`T0` |
The initial temperature (K) of the parcel being lifted. Missing value is used by default. |

`w0` |
The initial mixing ratio (kg/kg) of the parcel being lifted. |

`PlowTop` |
If some layers must be averaged in the bottom of the sounding this argument provides the pressure (Pa) at the top of the layer that must be averaged in the bottom of the sounding. |

`precoolType` |
If requested, an adiabatic or an isobaric precooling of the initial parcel is performed. "none" is used by default, but "adiabatic" and "isobaric" are also accepted. |

`doLog` |
Use logarithmic vertical interpolation between sounding levels if doLog=1. The default value is doLog=0. |

`getLiftedBack` |
TRUE/FALSE requests that the evolution of the lifted particle until the top level of the soundig is returned as a set of vectors for P, T and w (fields Pl, Tl and wl respectively). FALSE is used by default. |

`upToTop` |
TRUE(FALSE) requests that the lifted particle continues(stops) after the first crossing with the ambient sounding (EL) (until the sounding finishes). If TRUE, remaining negative areas above are accumulated into CIN only if the parcel becomes buoyant again in upper levels depending on the setting of |

`checkBuoyancy` |
If |

CAPE and CIN (J/kg) are calculated from a sounding given by 1D arrays for pressure Ps (Pa), for temperature Ts (K) and for mixing ratio ws (kg/kg).

If *P_0*/*T_0*/*w_0* are provided, no low vertical averaging is done and these values are used as initial points for the parcel. Missing value is used by default for these arguments.

This function returns some error codes in field *outCode* in the return value if the computation of CAPE and CIN failed.

Returns:

`airStart` |
The real starting variable of the air parcel. It is a vector with 6 elements: P (Pa), Temp (K), w (kg/kg), theta (K), Tvirtual (K) and wsat (kg/kg). The values are computed depending on the input arguments. |

`cape` |
CAPE index (J/kg). |

`cin` |
CIN index (J/kg) as a negative number. |

`apLCL` |
Variables of the air parcel at the Lifting Condensation Level (LCL). It is returned as a vector with 6 elements: P (Pa), Temp (K), w (kg/kg), theta (K), virtualT (K) and wsat (kg/kg). |

`apLFC` |
Variables of the Level of Free Convection (LFC). If LFC is found, it is returned as a vector with six elements: P (Pa), Temp (K), w (kg/kg), theta (K), virtualT (K) and wsat (kg/kg). |

`apEL` |
End Level (EL). If EL is found, it is returned as a vector with six elements: P (Pa), Temp (K), w (kg/kg), theta (K), virtualT (K) and wsat (kg/kg). |

`gotLCL` |
TRUE/FALSE whether the LCL has been found or not. |

`gotLFC` |
TRUE/FALSE whether the LFC has been found or not. |

`gotEL` |
TRUE/FALSE whether the EL has been found or not. |

`Pl` |
Pressure (Pa) at every step of the lifted particle during its evolution. If requested by using getLiftedBack==TRUE, every step until the end of the radiosonde is returned. |

`Tl` |
Temp (K) at every step of the lifted particle during its evolution. If requested by using getLiftedBack==TRUE, every step until the end of the radiosonde is returned. |

`wl` |
Mixing-ratio of the lifted particle during its evolution. If requested by using getLiftedBack==TRUE, every step until the end of the radiosonde is returned. |

`Olifted` |
Number of elements in Pl/Tl/wl. |

`upToTop` |
Process the whole sounding even after finding the first "EL level". |

`outCode` |
The error code returned by the C routine that computes CAPE/CIN. If 0, everything has been OK! |

data(RadiosondeA) aPs<-RadiosondeA[,1]*100 aTs<-C2K(RadiosondeA[,3]) aws<-RadiosondeA[,6]/1000 capeCin<-CAPE_CIN(PlowTop=98000,precoolType="adiabatic", Ps=aPs,Ts=aTs,ws=aws,doLog=0,deltaP=5, getLiftedBack=TRUE,upToTop=TRUE) print(min(capeCin$Tl)) pdf("stuve.pdf") stuveA<-stuve_diagram(Pres = aPs/100,Temp=aTs-273.15) lines(capeCin$Tl-273.15,capeCin$Pl/100,col="red",lwd=2) dev.off()

[Package *aiRthermo* version 1.2.1 Index]