maxwell_precipΒΆ

A sample script.

'''A sample script.
'''

import matplotlib.pyplot as plt
from irfpy.util import maxwell

def main():

    # First plot the vth contribution.
    vth = 10e3
    plt.figure()

    # The precipitating flux is calculated
    # for different vz.
    for vz in range(-50e3, 50e3, 1e3):
        print(vz)
        f = maxwell.flux_precip(1, vz, vth)
        print('--->', f)

        plt.plot([vz], [f], 'bo')

    plt.text(-50000, 0, 'Precipitating flux')

    # The net flux is the multiple of n and vz.
    plt.plot([-50e3, 50e3], [-50e3, 50e3], 'b:')
    plt.text(-40000, -40000, 'Net flux')

    # Then, the sum of plus minus fluxes are
    # calculated. Should be unity by definition
    # of precipitating flux.
    plt.figure()
    for vz in range(0, 50e3, 1e3):
        print(vz)
        fp = maxwell.flux_precip(1, vz, vth)
        fn = maxwell.flux_precip(1, -vz, vth)
        plt.plot([vz], [(fp - fn) / vz], 'ro')


if __name__ == "__main__":
    main()