**Quasi-Geostrophic diagnosis and QG-Omega inversion**

The package of the QG-omega inversion codes calculates the QG forcing terms and the corresponding QG-omega components given GCM outputs or reanalysis. As an example, the package reproduces Fig. S1 of Nie et al 2020 (PNAS).

**Reference**

Nie, J.*, P.X. Dai, and A. H. Sobel, 2020: Dry and moist dynamics shape regional patterns of extreme precipitation sensitivity, Proc. Natl. Acad. Sci., 117, 8757-8763.

Nie, J.*, D. Shaevitz, and A. H. Sobel, 2016: Forcings and feedback in the 2010 Pakistan flood: modeling extreme precipitation with interactive large-scale ascent, Journal of Advances in Modeling Earth Systems, 8, doi:10.1002/2016MS 000663.

**Package Download**

https://www.amazon.com/clouddrive/share/kLXrmrAG2k9RVPm2FS88slAaFGFREyYabJLc18vH45E

**About the codes:**

There are two main functions that call everything else:

1) calcTerms: This function calculates the three terms on the RHS of the QG omega equation (vort advection, temp advection, and diabatic heating). The main inputs are the geopotential and geostrophic velocities. The diabatic heating rate is diagnosed using the temperature tendency equation and this needs the reanalysis omega and the 4-dimensional static stability (which I refer to as sigmaLoc). The laplacians are computed using a least-squares polynomial approximation to make the solution smoother.

2) invertOmega: This function inverts the laplacian to compute the QG omega for one time slice. The main input is the RHS that you want to use in the inversion. So, for example, what I did to decompose omega into a "PV" and a heating component was to call the invertOmega function first with the RHS equal to the sum of the first two terms from calcTerms and then with the RHS equal to the third term. Note that sigma used here has has spatial distributions.