pykpp package

Subpackages

Submodules

pykpp.main module

pykpp.main.main(globals={}, options=None)[source]

pykpp.mech module

class pykpp.mech.Mech(path=None, mechname=None, keywords=['hv', 'PROD', 'EMISSION'], incr=300, monitor_incr=3600, timeunit='local', add_default_funcs=True, doirr=False, verbose=0)[source]

Bases: object

Mech object must be able to interpret kpp inputs and translate the results to create a reaction function (Mech.dy), a jacobian (Mech.ddy), and run the model (Mech.run)

path - path to kpp inputs mechname - name for output keywords - ignore certain keywords from reactants in

calculate reaction rates

timeunit - ‘local’ or ‘utc’ add_default_funcs - if True, then add Update_THETA, Update_SUN, and

Update_M if THETA, SUN, or M appear in the rate constant expressions.

incr - default functions will be called when simulated

time has progressed more than incr seconds

monitor_incr - If monitor_incr is not None, add a monitor function

updaters, so it has a special optional keyword

doirr - save reaction rates for further analysis verbose - add printing

Special functions (e.g., Update_World) for physical environment can be added through PY_INIT in the definiton file e.g.,

#MODEL small_strato #INTEGRATOR lsoda #INLINE PY_INIT TSTART = (12*3600) TEND = TSTART + (3*24*3600) DT = 0.25*3600 TEMP = 270 updated_phys = -inf temp_times = array([TSTART, TEND]) temps = array([270., 290.]) press_times = array([TSTART, TEND]) pressures = array([1013.25, 1050.])

def NewUpdater(mech, world):

global updated_phys global temp_times global temps global press_times global pressures t = world[‘t’]

if abs(t - updated_phys) > 1200.:

world[‘TEMP’] = interp(t, temp_times, temps) world[‘P’] = interp(t, press_times, pressures) updated_phys = t

Update_SUN(world) # Note that Update_RATE should be called or # rates will never be evaluated Update_RATE(mech, world)

add_world_updater(NewUpdater) #ENDINLINE

see Mech.resetworld for special values that can be added to F90_INIT or INITVALUES to control the environment

Update_World(world=None, forceupdate=False)[source]

world - dictionary defining current state forceupdate - boolean that forces all functions to update Calls

  • user added functions (added using add_world_updater)

update_func_world(world) Update_RATE(mech, world)

*Note: Update_SUN, Update_THETA, and Update_M can be added by

the mechanism heuristically.

see these functions for more details

add_constraint(func)[source]

Constraints are used to prevent concentration changes. Usually, the intent is to alter reaction rates.

func - a function that takes a mechanism object

and a world dictionary. The function should edit the species in world and in the world y vector to ensure

def func_example_nox_constraint(mech, world):

TOTALNOx = world[‘TOTALNOx’] y = world[‘y’] ind_NO, ind_NO2, ind_HO2NO2, ind_NO3, ind_N2O5 = eval(

‘ind_NO, ind_NO2, ind_HO2NO2, ind_NO3, ind_N2O5’, None, world

) fNOx = (TOTALNOx /

y[[ind_NO, ind_NO2, ind_HO2NO2, ind_NO3, ind_N2O5]].sum())

world[‘NO’] = y[ind_NO] = y[ind_NO] * fNOx world[‘NO2’] = y[ind_NO2] = y[ind_NO2] * fNOx world[‘NO3’] = y[ind_NO3] = y[ind_NO3] * fNOx world[‘N2O5’] = y[ind_N2O5] = y[ind_N2O5] * fNOx world[‘HO2NO2’] = y[ind_HO2NO2] = y[ind_HO2NO2] * fNOx

add_constraint(func_example_nox_constraint)

add_func_updater(*args, **keywords)[source]
add_funcs()[source]

Add default functions (e.g., Update_THETA, Update_SUN, Update_M, Monitor) if they are needed.

add_world_updater(updater)[source]
archive()[source]
check_rates(**kwds)[source]
ddy(y, t)[source]

Returns the derivative of the species change rate with respect to species

dy(y, t)[source]

Function that returns the change in species with respect to time

get_output()[source]
get_rates(**kwds)[source]
get_rxn_strs(fmt=None)[source]

Generate reaction string representations from parsed reaction objects

get_y(world=None)[source]

Return a vector of species values in order of self.allspcs Optional:

world - special dictionary to create vector (defaults to

self.world)

integrate(t0, t1, y0, solver=None, jac=True, verbose=False, debug=False, **solver_keywords)[source]
Parameters:
  • in (t1 - ending time) –

  • in

  • concentrations (y0 - vector of) –

  • - (solver_keywords) –

    • None if not provided, defaults to integrator set in mechanism defintion

    • ’odeint’ use odeint with lsoda from ODEPACK (scipy.integrate.odeint)

    • ’lsoda’, ‘vode’, ‘zvode’, ‘dopri5’, ‘dopri853’ use named

      solver with ode object (see scipy.integrate.ode)

  • -

  • -

  • -

    solver; see scipy.integrate.ode for more details

    on keywords

    • with odeint, defaults to dict(atol=1e-3, rtol=1e-4, maxstep=1000, hmax=self.world[‘DT’], mxords=2, mxordn=2)

    • with ode, no defaults are set

Returns:

ts - array of times (start, end) Y - array of states with dimensions (time, spc)

output(outpath=None)[source]
plot(**kwds)[source]
print_monitor(y, t)[source]
print_rxns(fmt=None)[source]

Print reaction stings joined by line returns

print_world(out_keys=None, format='%.8e', verbose=0)[source]
reorder()[source]
resetworld()[source]

Resets the world to the parsed state and then adds default values that control the SUN and THETA (solar angle)

Special values can be added to INITVALUES or F90_INIT to control solar properties

StartDate = datetime.today() StartJday = int(StartDate.strftime(‘%j’)) Latitude_Degrees = 45. # if Latitude_Radians is provided: degrees(Latitude_Radians) Latitude_Radians = radians(Latitude_Degrees) SunRise = 4.5 or noon - degrees(

arccos(-tan(LatRad) * tan(SolarDeclination))

) / 15. SunSet = 19.5 or noon - degrees(

arccos(-tan(LatRad) * tan(SolarDeclination))

) / 15.

run(solver=None, tstart=None, tend=None, dt=None, jac=True, verbose=0, debug=False, **solver_keywords)[source]

Load solvers with Mech object function (Mech.dy), jacobian (Mech.ddy), and mechanism specific options

Optional:
solver - (optional; default None) string indicating solver approach
  • None if not provided, defaults to integrator set in mechanism defintion

  • ‘odeint’ use odeint with lsoda from ODEPACK (scipy.integrate.odeint)

  • ‘lsoda’, ‘vode’, ‘zvode’, ‘dopri5’, ‘dopri853’ use named solver with ode object (see scipy.integrate.ode)

tstart - starting time in unit of kinetic rates (optional; default

TSTART in initial values)

tend - ending time in unit of kinetic rates (optional; default

TEND in initial values)

dt - time step in unit of kinetic rates (optional; default DT in

initial values)

jac - Use jacobian to speed up solution (default: True) verbose - add additional printing (optional; default 0)

  • 0 no additional printing

  • 1 printing in run command and in first integration call

  • 2 or above add rpinting in run command and in all integration calls

debug - set to true to enable pdb step-by-step execution solver_keywords - (optional) solver keywords are specific to each

solver; see scipy.integrate.ode for more details on keywords

  • with odeint, defaults to dict(atol=1e-3, rtol=1e-4, maxstep=1000, hmax=self.world[‘DT’], mxords=2, mxordn=2)

  • with ode, no defaults are set

Returns:

duration of simluation

Output:

mechname + ‘.tsv’ - file with simulation

set_all_spc()[source]

Any undefined species are set to ALL_SPEC keyword or 0 if ALL_SPEC is undefined

set_dy_exp()[source]
set_incr(incr=None)[source]

Sets incr property

incr - time increment (in rate unit); if None, select minimum time from

updaters and constraints

set_mechname(mechname)[source]
set_rate_exp()[source]

This function serves three major goals:

  1. Define the rate_const_exp and rate_const_exp_str rate_const_exp - is evaluated to calculate all rate coefficients

  2. Define the rate_exp and rate_exp_str rate_exp - is evaluated to calculate all reaction rates

  3. Define drate_exp, fill_drate_exp (and _str’s) drate_exp - can be evaluated to calculate the derivative of the

    rate_exp with respect to y. This is currently deprecated in favor of fill_drate_exp

    fill_drate_exp - can be executed to fill the drate_per_dspc array,

    which must exist. This fills the same roll as drate_exp, but is much faster because it only allocates the memory once.

set_spcidx()[source]
set_spcs(**spcs)[source]

Set each spcs to values in world and world[‘y’]

summary(verbose=0)[source]

return a string with species number, reaction number, and string representations of each

update_rate_const()[source]
update_world_from_y(y=None)[source]

Update world state from y

update_y_from_world()[source]

Create y vector in world with values for each species in allspcs

update_y_from_y(y)[source]

Update y if it exists or create it, if it does not

pykpp.mech.addtojac(rxni, reaction, jac, allspcs)[source]

From parsed reaction, add a jacobian element

rxni - reaction list index reaction - reaction tokens

dict(reactants = [(stoic, spc), …],

products = [(stoic, spc), …])

Future work should reduce the jacobian size by banding or LU decomp.

jac[i,j] = d f[i] / d y[j]

pykpp.parse module

pykpp.plot module

pykpp.plot.plot(mech, world, fig=None, ax=None, ax_props=None, path=None, **kwds)[source]

mech - Not used unless now kwds are provided world - dictionary to find data in fig - optional figure to append ax - axes bounding box or axes object to be added to fig ax_props - properties of the axes kwds - each named keyword is a set of options to plot;

if kwds == {}; then kwds = dict([(k, {}) for i, k in mech.monitor])

pykpp.plot.plot_from_file(path, **kwds)[source]

See plot for more details.

Note that kwds that are explicit in plot will be removed from kwds before plot evaluates these keywords

pykpp.stdfuncs module

stdfuncs

stdfuncs provides an natural environment and functions for evaluating rate constants from rate expressions in the context of that environment.

Environment:

The uninitialized environment includes a default temperature (298. K), pressure (101325 Pa), M, O2, N2, and H2.

Rate Evaluation:

Because many models use different forms (e.g., signs), several models native forms are provided:

GEOS-Chem associates different forms with a letter. The basic form is provided by GEOS_STD, and then other forms are provided by GEOS_S+ where S+ is one or more non-white space (e.g., GEOS_A or GEOS_B).

MOZART4 uses normal mathematical expressions and several special functions. Special functions include a troe form (MZ4_TROE) and numbered user expressions (MZ4_USRd+) where d+ is one or more digits.

CMAQ uses special characters to key to numbered forms documented in the Science documentation appendix. CMAQ_1to4 is the most basic where all 4 forms can be represented by supplying a 0 for one or more parameters. CMAQ_d+ where d+ is 5 to 10 are special functions (10 is the troe fall off equation).

CHIMERE uses basic expressions and two special functions. Special functions are two forms of the TROE equation (CHIMERE_TROE and CHIMERE_MTROE).

pykpp.stdfuncs.AM3_STD(A0, B0, C0)[source]
pykpp.stdfuncs.AM3_TROE(A0, B0, A1, B1, factor)[source]
pykpp.stdfuncs.AM3_USR1()[source]
pykpp.stdfuncs.AM3_USR10()[source]
pykpp.stdfuncs.AM3_USR11()[source]
pykpp.stdfuncs.AM3_USR12()[source]
pykpp.stdfuncs.AM3_USR13()[source]
pykpp.stdfuncs.AM3_USR14()[source]
pykpp.stdfuncs.AM3_USR15()[source]
pykpp.stdfuncs.AM3_USR16()[source]
pykpp.stdfuncs.AM3_USR17()[source]
pykpp.stdfuncs.AM3_USR18()[source]
pykpp.stdfuncs.AM3_USR19()[source]
pykpp.stdfuncs.AM3_USR2()[source]
pykpp.stdfuncs.AM3_USR21()[source]
pykpp.stdfuncs.AM3_USR22()[source]
pykpp.stdfuncs.AM3_USR24()[source]
pykpp.stdfuncs.AM3_USR25()[source]
pykpp.stdfuncs.AM3_USR3()[source]
pykpp.stdfuncs.AM3_USR4()[source]
pykpp.stdfuncs.AM3_USR5()[source]
pykpp.stdfuncs.AM3_USR51()[source]
pykpp.stdfuncs.AM3_USR52()[source]
pykpp.stdfuncs.AM3_USR53()[source]
pykpp.stdfuncs.AM3_USR54()[source]
pykpp.stdfuncs.AM3_USR57()[source]
pykpp.stdfuncs.AM3_USR58()[source]
pykpp.stdfuncs.AM3_USR59()[source]
pykpp.stdfuncs.AM3_USR6()[source]
pykpp.stdfuncs.AM3_USR60()[source]
pykpp.stdfuncs.AM3_USR61()[source]
pykpp.stdfuncs.AM3_USR7()[source]
pykpp.stdfuncs.AM3_USR8()[source]
pykpp.stdfuncs.AM3_USR8a()[source]
pykpp.stdfuncs.AM3_USR9()[source]
pykpp.stdfuncs.ARR(A0, B0, C0)[source]

A0, B0 and C0 - numeric values used to calculate a reaction rate (1/s) based on the Arrhenius equation in the following form:

A0 * exp(-B0/TEMP) * (TEMP / 300.)**(C0)

Returns a rate in per time

pykpp.stdfuncs.ARR2(A0, B0)[source]

A0 and B0 - numeric values used to calculate a reaction rate (1/s) based on the Arrhenius equation in the following form:

A0 * exp(B0/TEMP)

Returns a rate in per time

Note: ARR2 sign of B0 is different than ARR

pykpp.stdfuncs.CAMX_4(A0, Ea0, B0, Tr0, A1, Ea1, B1, Tr1, F, n)[source]
pykpp.stdfuncs.CAMX_6(A0, Ea0, B0, Tr0, A2, Ea2, B2, Tr2, A3, Ea3, B3, Tr3)[source]
pykpp.stdfuncs.CHIMERE_JO3(rate)[source]
pykpp.stdfuncs.CHIMERE_MTROE(A0, B0, C0, A1, B1, C1, N)[source]
Mapping:

A0 = tabrate(1,nr) B0 = tabrate(2,nr) C0 = tabrate(3,nr) A1 = tabrate(4,nr) B1 = tabrate(5,nr) C1 = tabrate(6,nr) N = tabrate(7,nr) M = ai TEMP = te 1. = dun

Original Code:
c1 = tabrate(1,nr)*exp(-tabrate(2,nr)/te) &

*(300d0/te)**tabrate(3,nr)

c2 = tabrate(4,nr)*exp(-tabrate(5,nr)/te) &

*(300d0/te)**tabrate(6,nr)

c3 = ai*c1 c4 = c3/c2 ex = dun/(dun + ((log10(c4) - 0.12d0)/1.2d0)**2) rate(nr,izo,ime,ivert) = c1*tabrate(7,nr)**ex/(dun + c4)

pykpp.stdfuncs.CHIMERE_SPECIAL_1(A1, C1, A2, C2)[source]

f1 = A1*exp(-C1/TEMP) f2 = A2*exp(-C2/TEMP) rate = f1 * f2/(1. + f2)

pykpp.stdfuncs.CHIMERE_SPECIAL_2(A1, C1, A2, C2)[source]

f1 = A1*exp(-C1/TEMP) f2 = A2*exp(-C2/TEMP) rate = f1/(1. + f2)

pykpp.stdfuncs.CHIMERE_SPECIAL_3(A1, C1, A2, C2, A3, C3, A4, C4)[source]

f1 = A1*exp(-C1/TEMP) f2 = A2*exp(-C2/TEMP) f3 = A3*exp(-C3/TEMP) f4 = A4*exp(-C4/TEMP) rate = 2.*(f1 * f2 * f3 * f4/((1.+f3)*(1.+f4)))**(0.5)

pykpp.stdfuncs.CHIMERE_SPECIAL_4(A1, C1, A2, C2, A3, C3, A4, C4)[source]

f1 = A1*exp(-C1/TEMP) f2 = A2*exp(-C2/TEMP) f3 = A3*exp(-C3/TEMP) f4 = A4*exp(-C4/TEMP) f3 = f3 / (1. + f3) f4 = f4 / (1. + f4) rate = 2.0*(f1*f2)**(0.5)*(1.-(f3*f4)**(0.5))*(1.-f4)/(2.-f3-f4)

pykpp.stdfuncs.CHIMERE_TROE(A0, B0, C0, A1, B1, C1, N)[source]
Mapping:

A0 = tabrate(1,nr) B0 = tabrate(2,nr) C0 = tabrate(3,nr) A1 = tabrate(4,nr) B1 = tabrate(5,nr) C1 = tabrate(6,nr) N = tabrate(7,nr)

M = ai; M = third body concentration (molecules/cm3) and must be defined in the stdfuncs namespace

TEMP = te = bulk air temperature

  1. = dun

Original Code:
c1 = tabrate(1,nr)*exp(-tabrate(2,nr)/te) &

*(300d0/te)**tabrate(3,nr)

c2 = tabrate(4,nr)*exp(-tabrate(5,nr)/te) &

*(300d0/te)**tabrate(6,nr)

c3 = ai*c1 c4 = c3/c2 ex = dun/(dun + log10(c4)**2) rate(nr,izo,ime,ivert) = c1*tabrate(7,nr)**ex/(dun + c4)

pykpp.stdfuncs.CMAQ_10(A0, B0, C0, A1, B1, C1, CF, N)[source]

CMAQ reaction rate form 10

K0 = CMAQ_1to4(A0, B0, C0) K1 = CMAQ_1to4(A1, B1, C1) K0 = K0 * M K1 = K0 / K1

M = third body concentration (molecules/cm3) and must be

defined in the stdfuncs namespace

Returns (K0 / (1.0 + K1))* (CF)**(1.0 / (1.0 / (N) + (log10(K1))**2))

pykpp.stdfuncs.CMAQ_10D(A0, B0, C0, A1, B1, C1, CF, N)[source]

Same as reaction rate form 10, but implemented to provide compatibility for fortran code that need a DOUBLE form

pykpp.stdfuncs.CMAQ_1to4(A0, B0, C0)[source]

CMAQ reaction rates form 1-4 have the form K = A * (T/300.0)**B * EXP(-C/T)

pykpp.stdfuncs.CMAQ_5(A0, B0, C0, Kf)[source]

CMAQ reaction form 5

K1 = CMAQ_1to4(A0, B0, C0)

Returns Kf / K1

pykpp.stdfuncs.CMAQ_6(A0, B0, C0, Kf)[source]

CMAQ reaction form 6

K1 = CMAQ_1to4(A0, B0, C0)

Returns Kf * K1

pykpp.stdfuncs.CMAQ_7(A0, B0, C0)[source]

CMAQ reaction form 6

K0 = CMAQ_1to4(A0, B0, C0)

Returns K0 * (1 + .6 * PRESS / 101325.) # Pressure is in Pascals

pykpp.stdfuncs.CMAQ_8(A0, C0, A2, C2, A3, C3)[source]

CMAQ reaction form 8

K0 = (A0) * exp(-(C0) / TEMP) K2 = (A2) * exp(-(C2) / TEMP) K3 = (A3) * exp(-(C3) / TEMP) K3 = K3 * M

Returns K0 + K3 / (1.0 + K3 / K2 )

pykpp.stdfuncs.CMAQ_9(A1, C1, A2, C2)[source]

CMAQ reaction rate form 9

K1 = (A1) * exp(-(C1) / TEMP) K2 = (A2) * exp(-(C2) / TEMP)

M = third body concentration (molecules/cm3) and must be

defined in the stdfuncs namespace

Returns K1 + K2 * M

exception pykpp.stdfuncs.ConstantWarning[source]

Bases: DeprecationWarning

Accessing a constant no longer in current CODATA data set

pykpp.stdfuncs.DP3(A1, C1, A2, C2)

A1, C1, A2, and C2 - numeric values used to calculate 3 rates (K0, K2, and K3), each of the form A * exp(-C / TEMP), to return a rate of the following form:

K1 + K2 * M * 1e6

Returns a rate in per time

pykpp.stdfuncs.EP2(A0, C0, A2, C2, A3, C3)[source]

A0, C0, A2, C2, A3, and C3 - numeric values used to calculate 3 rates (K0, K2, and K3), each of the form A * exp(-C / TEMP), to return a rate of the following form:

K0 + K3 * M * 1e6 / (1. + K3 * M * 1e6 / K2)

Returns a rate in per time

pykpp.stdfuncs.EP3(A1, C1, A2, C2)[source]

A1, C1, A2, and C2 - numeric values used to calculate 3 rates (K0, K2, and K3), each of the form A * exp(-C / TEMP), to return a rate of the following form:

K1 + K2 * M * 1e6

Returns a rate in per time

pykpp.stdfuncs.FALL(A0, B0, C0, A1, B1, C1, CF)[source]

Troe fall off equation

A0, B0, C0, A1, B1, C1 - numeric values to calculate 2 reaction rates (K0, K1) using ARR function; returns a rate in the following form

K0M = K0 * M * 1e6 KR = K0 / K1

Returns (K0M / (1.0 + KR))* CF**(1.0 / (1.0 + (log10(KR))**2))

pykpp.stdfuncs.FYRNO3(CN)[source]

GEOS-Chem equation FYRNO3 implemented based on GEOS-Chem version 9

pykpp.stdfuncs.GCARR(A0, B0, C0)[source]
pykpp.stdfuncs.GCIUPAC3(ko_300, n, ki_300, m, Fc)[source]
pykpp.stdfuncs.GCJPL3(k0_300, n, ki_300, m)[source]
pykpp.stdfuncs.GCJPLEQ(A0, B0, C0, A1, B1, C1, A2, B2, C2, FV, FCT1, FCT2)[source]
pykpp.stdfuncs.GCJPLPR(A0, B0, C0, A1, B1, C1, FV, FCT1, FCT2)[source]
pykpp.stdfuncs.GC_DMSOH(A0, B0, C0, A1, B1, C1)[source]
pykpp.stdfuncs.GC_GLYCOHA(A0, B0, C0)[source]
pykpp.stdfuncs.GC_GLYCOHB(A0, B0, C0)[source]
pykpp.stdfuncs.GC_GLYXNO3(A0, B0, C0)[source]
pykpp.stdfuncs.GC_HACOHA(A0, B0, C0)[source]
pykpp.stdfuncs.GC_HACOHB(A0, B0, C0)[source]
pykpp.stdfuncs.GC_HO2NO3(A0, B0, C0, A1, B1, C1)[source]
pykpp.stdfuncs.GC_OHCO(A0, B0, C0)[source]
pykpp.stdfuncs.GC_OHHNO3(A0, B0, C0, A1, B1, C1, A2, B2, C2)[source]
pykpp.stdfuncs.GC_RO2HO2(A0, B0, C0, A1, B1, C1)[source]
pykpp.stdfuncs.GC_RO2NO(B, A0, B0, C0, A1, B1, C1)[source]
pykpp.stdfuncs.GC_TBRANCH(A0, B0, C0, A1, B1, C1)[source]
pykpp.stdfuncs.GEOS_A(A0, B0, C0, A1, B1, C1)[source]

GEOS-Chem reaction form A

TMP_A0 = A0 * FYRNO3(A1)

Returns GEOS_STD(TMP_A0, B0, C0)

pykpp.stdfuncs.GEOS_B(A0, B0, C0, A1, B1, C1)[source]

GEOS-Chem reaction form B

TMP_A0 = A0 * ( 1. - FYRNO3(A1) )

Returns GEOS_STD(TMP_A0, B0, C0)

pykpp.stdfuncs.GEOS_C(A0, B0, C0)[source]

GEOS-Chem reaction form C

K1 = GEOS_STD(A0, B0, C0)

Returns K1 * (O2 + 3.5e18) / (2.0 * O2 + 3.5e18)

pykpp.stdfuncs.GEOS_E(A0, B0, C0, Kf)[source]

GEOS-Chem reaction form E

K1 = GEOS_STD(A0, B0, C0)

Returns Kf / K1

pykpp.stdfuncs.GEOS_F(A0, B0, C0)[source]
pykpp.stdfuncs.GEOS_G(A0, B0, C0, A1, B1, C1)[source]

GEOS-Chem reaction form A

K1 = GEOS_STD(A0, B0, C0) K2 = GEOS_STD(A1, B1, C1)

Returns K1 / ( 1.0 + K1 * O2 )

pykpp.stdfuncs.GEOS_HR(A0, B0, C0, A1, B1, C1)[source]

GEOS-Chem reaction form HR

** Not implemented returns 0.

pykpp.stdfuncs.GEOS_JO3(O3J)[source]

GEOS-Chem reaction form ozone photolysis

T3I = 1.0/TEMP Returs O3J * 1.45e-10 * exp( 89.0 * T3I) * H2O / ( 1.45e-10 * exp( 89.0 * T3I) * H2O + 2.14e-11 * exp(110.0 * T3I) * N2 + 3.20e-11 * exp( 70.0 * T3I) * O2 )

pykpp.stdfuncs.GEOS_JO3_2(O3J)[source]
pykpp.stdfuncs.GEOS_K(A0, B0, C0)[source]

GEOS-Chem reaction form K

** Not implemented returns 0.

pykpp.stdfuncs.GEOS_KHO2(A0, B0, C0)[source]

Implemented KHO2 based on GEOS-Chem version 9

pykpp.stdfuncs.GEOS_L(A0, B0, C0)[source]
pykpp.stdfuncs.GEOS_N(A0, B0, C0)[source]

GEOS-Chem reaction form N

** Not implemented returns 0.

pykpp.stdfuncs.GEOS_O(A0, B0, C0)[source]

GEOS-Chem reaction form O

** Not implemented returns 0.

pykpp.stdfuncs.GEOS_P(A0, B0, C0, A1, B1, C1, FCV, FCT1, FCT2)[source]

GEOS-Chem pressure dependent TROE falloff equation

if (FCT2 != 0.000000e+00):

CF = exp(-TEMP / FCT1) + exp(-FCT2 / TEMP)

elif (FCT1 != 0.000000e+00):

CF = exp(-TEMP / FCT1)

else:

CF = FCV

K0M = GEOS_STD(A0, B0, C0) * M

K1 = GEOS_STD(A1, B1, C1) K1 = K0M / K1

return (K0M / (1.0 + K1))* (CF)**(1.0 / (1.0 + (log10(K1))**2))

pykpp.stdfuncs.GEOS_Q(A0)[source]

GEOS-Chem reaction form Q

** Not implemented returns 0.

pykpp.stdfuncs.GEOS_STD(A0, B0, C0)[source]

GEOS-Chem standard reaction rate with the form K = A * (300 / T)**B * EXP(C / T)

Returns A0 * (300. / TEMP)**B0 * exp(C0 / TEMP)

pykpp.stdfuncs.GEOS_T(A0, B0, C0)[source]

GEOS-Chem reaction form T

** Not implemented returns 0.

pykpp.stdfuncs.GEOS_V(A0, B0, C0, A1, B1, C1)[source]

GEOS-Chem reaction form V

K1 = GEOS_STD(A0, B0, C0) K2 = GEOS_STD(A1, B1, C1) return K1 / (1 + K2)

pykpp.stdfuncs.GEOS_X(A0, B0, C0, A1, B1, C1, A2, B2, C2)[source]

GEOS-Chem reaction rate form Z

K0 = GEOS_STD(A0, B0, C0) K2 = GEOS_STD(A1, B1, C1) K3 = GEOS_STD(A2, B2, C2) K3 = K3 * M

Returns K0 + K3 / (1.0 + K3 / K2 )

pykpp.stdfuncs.GEOS_Y(A0, B0, C0)[source]

GEOS-Chem reaction form Y

A0, B0, and C0 are numeric inputs that are ignored IGNORES INPUTS per v08-02-04 update

pykpp.stdfuncs.GEOS_Z(A0, B0, C0, A1, B1, C1, A2, B2, C2)[source]

GEOS-Chem Z reaction rate form

K0 = GEOS_STD(A0, B0, C0) K1 = GEOS_STD(A1, B1, C1)*M K2 = GEOS_STD(A2, B2, C2)

Returns (K0 + K1) * (1 + H2O * K2)

pykpp.stdfuncs.HET(spc_idx, rct_idx)[source]
pykpp.stdfuncs.HO2_H2O(H2O, TEMP)[source]
pykpp.stdfuncs.JHNO4_NEAR_IR(HNO4J)[source]

Adding 1e-5 (1/s) to HNO4 photolysis to account for near IR

pykpp.stdfuncs.MCMJ(idx, THETA)[source]
Parameters:
  • export (idx - index from MCM) –

  • degrees (THETA - zenith angle in) –

Returns:

photolysis frequency (s**-1) from TUV_J for closest surrogate.

pykpp.stdfuncs.MCM_KBPAN()[source]
pykpp.stdfuncs.MCM_KFPAN()[source]
pykpp.stdfuncs.MZ4_TROE(A0, B0, A1, B1, factor)[source]

Troe fall off equation as calculated in MOZART4

pykpp.stdfuncs.MZ4_USR1()[source]

USR1 reaction rate as defined in MOZART4

Returns 6.e-34 * (300.e0/TEMP)**2.4

pykpp.stdfuncs.MZ4_USR10()[source]

USR10 reaction rate as defined in MOZART4

Returns MZ4_TROE(8.e-27, 3.5e0, 3.e-11, 0e0, .5e0)

pykpp.stdfuncs.MZ4_USR11()[source]

USR11 reaction rate as defined in MOZART4

Returns MZ4_TROE(8.5e-29, 6.5e0, 1.1e-11, 1.0, .6e0)

pykpp.stdfuncs.MZ4_USR12()[source]

USR12 reaction rate as defined in MOZART4

Return MZ4_USR11() * 1.111e28 * exp( -14000.0 / TEMP )

pykpp.stdfuncs.MZ4_USR14()[source]

USR14 reaction rate as defined in MOZART4

Return 1.1e-11 * 300.e0/ TEMP / M

pykpp.stdfuncs.MZ4_USR2()[source]

USR2 reaction rate as defined in MOZART4

Returns MZ4_TROE(8.5e-29, 6.5e0, 1.1e-11, 1.e0, .6e0)

pykpp.stdfuncs.MZ4_USR21()[source]

USR21 reaction rate as defined in MOZART4

Returns TEMP**2 * 7.69e-17 * exp( 253.e0/TEMP )

pykpp.stdfuncs.MZ4_USR22()[source]

USR22 reaction rate as defined in MOZART4

Returns 3.82e-11 * exp( -2000.0/TEMP ) + 1.33e-13

pykpp.stdfuncs.MZ4_USR23()[source]

USR23 reaction rate as defined in MOZART4

fc = 3.0e-31 *(300.0/TEMP)**3.3e0 ko = fc * M / (1.0 + fc * M / 1.5e-12) Returns ko * .6e0**(1. + (log10(fc * M / 1.5e-12))**2.0)**(-1.0)

pykpp.stdfuncs.MZ4_USR24()[source]

USR24 reaction rate as defined in MOZART4

#REAL(kind=dp) ko ko = 1.0 + 5.5e-31 * exp( 7460.0/TEMP ) * M * 0.21e0 return 1.7e-42 * exp( 7810.0/TEMP ) * M * 0.21e0 / ko

pykpp.stdfuncs.MZ4_USR3()[source]

USR3 reaction rate as defined in MOZART4

Returns MZ4_USR2() * 3.333e26 * exp( -10990.e0/TEMP )

pykpp.stdfuncs.MZ4_USR4()[source]

USR4 reaction rate as defined in MOZART4

Returns MZ4_TROE(2.0e-30, 3.0e0, 2.5e-11, 0.e0, .6e0)

pykpp.stdfuncs.MZ4_USR5()[source]

USR5 reaction rate as defined in MOZART4

TINV = 1/TEMP ko = M * 6.5e-34 * exp( 1335.*tinv ) ko = ko / (1. + ko/(2.7e-17*exp( 2199.*tinv )))

Returns ko + 2.4e-14*exp( 460.*tinv )

pykpp.stdfuncs.MZ4_USR6()[source]

USR6 reaction rate as defined in MOZART4

Returns MZ4_TROE(1.8e-31, 3.2e0, 4.7e-12, 1.4e0, .6e0)

pykpp.stdfuncs.MZ4_USR7()[source]

USR7 reaction rate as defined in MOZART4

Returns MZ4_USR6() * exp( -10900./TEMP )/ 2.1e-27

pykpp.stdfuncs.MZ4_USR8()[source]

USR8 reaction rate as defined in MOZART4

Returns 1.5e-13 * (1. + 6.e-7 * boltz * M * TEMP)

pykpp.stdfuncs.MZ4_USR9()[source]

USR9 reaction rate as defined in MOZART4

REAL(kind = dp) ko, kinf, fc, tinv tinv = 1.0/TEMP ko = 2.3e-13 * exp( 600.0*tinv ) kinf = 1.7e-33 * M * exp( 1000.0*tinv ) fc = 1.0 + 1.4e-21 * H2O * exp( 2200.0*tinv )

Returns (ko + kinf) * fc

pykpp.stdfuncs.Monitor(mech, world=None)[source]
pykpp.stdfuncs.OH_CO(A0, B0, C0, A1, B1, C1, CF, N)[source]

OH + CO reaction rate

*Note: Mostly like CMAQ_10, but slight difference in K1

K0 = CMAQ_1to4(A0, B0, C0) K1 = CMAQ_1to4(A1, B1, C1) K0 = K0 K1 = K0 / (K1 / M)

M = third body concentration (molecules/cm3) and must be

defined in the stdfuncs namespace

return (K0 / (1.0 + K1))* (CF)**(1.0 / (1.0 / (N) + (log10(K1))**2))

pykpp.stdfuncs.OH_O1D(J, H2O, TEMP, NUMDEN)[source]

REAL*8 J, H2O, TEMP, NUMDEN REAL*8 K1, K2, K3 REAL*8 N2, O2

pykpp.stdfuncs.PHOTOL(pidx)[source]
pykpp.stdfuncs.TUV_J4pt1(idx, zenithangle, scale=1.0)

idx = TUV 4.1 reaction string (e.g., jlabel) or TUV 4.1 numeric index zenithangle = angle of the sun from zenith in degrees

1 O2 + hv -> O + O 2 O3 -> O2 + O(1D) 3 O3 -> O2 + O(3P) 4 NO2 -> NO + O(3P) 5 NO3 -> NO + O2 6 NO3 -> NO2 + O(3P) 7 N2O5 -> NO3 + NO + O(3P) 8 N2O5 -> NO3 + NO2 9 N2O + hv -> N2 + O(1D) 10 HO2 + hv -> OH + O 11 H2O2 -> 2 OH 12 HNO2 -> OH + NO 13 HNO3 -> OH + NO2 14 HNO4 -> HO2 + NO2 15 CH2O -> H + HCO 16 CH2O -> H2 + CO 17 CH3CHO -> CH3 + HCO 18 CH3CHO -> CH4 + CO 19 CH3CHO -> CH3CO + H 20 C2H5CHO -> C2H5 + HCO 21 CHOCHO -> products 22 CH3COCHO -> products 23 CH3COCH3 24 CH3OOH -> CH3O + OH 25 CH3ONO2 -> CH3O+NO2 26 PAN + hv -> products 27 ClOO + hv -> Products 28 ClONO2 + hv -> Cl + NO3 29 ClONO2 + hv -> ClO + NO2 30 CH3Cl + hv -> Products 31 CCl2O + hv -> Products 32 CCl4 + hv -> Products 33 CClFO + hv -> Products 34 CF2O + hv -> Products 35 CF2ClCFCl2 (CFC-113) + hv -> Products 36 CF2ClCF2Cl (CFC-114) + hv -> Products 37 CF3CF2Cl (CFC-115) + hv -> Products 38 CCl3F (CFC-11) + hv -> Products 39 CCl2F2 (CFC-12) + hv -> Products 40 CH3CCl3 + hv -> Products 41 CF3CHCl2 (HCFC-123) + hv -> Products 42 CF3CHFCl (HCFC-124) + hv -> Products 43 CH3CFCl2 (HCFC-141b) + hv -> Products 44 CH3CF2Cl (HCFC-142b) + hv -> Products 45 CF3CF2CHCl2 (HCFC-225ca) + hv -> Product 46 CF2ClCF2CHFCl (HCFC-225cb) + hv -> Produ 47 CHClF2 (HCFC-22) + hv -> Products 48 BrONO2 + hv -> Br + NO3 49 BrONO2 + hv -> BrO + NO2 50 CH3Br + hv -> Products 51 CHBr3 52 CF3Br (Halon-1301) + hv -> Products 53 CF2BrCF2Br (Halon-2402) + hv -> Products 54 CF2Br2 (Halon-1202) + hv -> Products 55 CF2BrCl (Halon-1211) + hv -> Products 56 Cl2 + hv -> Cl + Cl

pykpp.stdfuncs.Update_M(mech, world)[source]
Adds concentrations (molecules/cm3) to world namespace for:

M (air), O2 (0.20946 M), N2 (0.78084 M), and H2 (500 ppb)

based on:

Pressure (P in Pascals), Temperature (TEMP in Kelvin), and R is provided in m**3 * Pascals/K/mol

TEMP and P must be defined either in world or in stdfuncs

pykpp.stdfuncs.Update_RCONST(mech, world=None)[source]
pykpp.stdfuncs.Update_SUN(mech, world)[source]
Updates world dectionary to contain

SUN - scaling variable between 0 and 1 (following Sandu et al.)

if t < SunRise or t > SunSet: SUN = 0.

hour = time since noon squared = abs(hour) * hour

pykpp.stdfuncs.Update_THETA(mech, world)[source]

Adds solar zenith angle (THETA; angle from solar noon) in degrees to the world dictionary based on time

THETA = arccos(sin(lat) * sin(dec) + cos(lat) * cos(dec) * cos(houra))

pykpp.stdfuncs.add_code_updater(code, incr=0, verbose=False, message='code')[source]

Shortcut to: add_world_updater(

code_updater(code=code, incr=incr, verbose=verbose, message=message)

)

pykpp.stdfuncs.add_time_interpolated(time, incr=0, verbose=False, **props)[source]
Shortcut to
add_world_updater(

interp_updater(time=time, incr=incr, verbose=verbose, **props)

)

pykpp.stdfuncs.add_time_interpolated_from_csv(path, timekey, incr=0)[source]

Shortcut to add_time_interpolated from data in a csv file

class pykpp.stdfuncs.code_updater(code, incr, allowforce=True, verbose=False, message='code')[source]

Bases: updater

code - string that can be compiled as exec incr - frequency to re-execute code verbose - show update status message - indentify this updater as message

pykpp.stdfuncs.convert_temperature(val: npt.ArrayLike, old_scale: str, new_scale: str) Any[source]

Convert from a temperature scale to another one among Celsius, Kelvin, Fahrenheit, and Rankine scales.

Parameters:
  • val (array_like) – Value(s) of the temperature(s) to be converted expressed in the original scale.

  • old_scale (str) – Specifies as a string the original scale from which the temperature value(s) will be converted. Supported scales are Celsius (‘Celsius’, ‘celsius’, ‘C’ or ‘c’), Kelvin (‘Kelvin’, ‘kelvin’, ‘K’, ‘k’), Fahrenheit (‘Fahrenheit’, ‘fahrenheit’, ‘F’ or ‘f’), and Rankine (‘Rankine’, ‘rankine’, ‘R’, ‘r’).

  • new_scale (str) – Specifies as a string the new scale to which the temperature value(s) will be converted. Supported scales are Celsius (‘Celsius’, ‘celsius’, ‘C’ or ‘c’), Kelvin (‘Kelvin’, ‘kelvin’, ‘K’, ‘k’), Fahrenheit (‘Fahrenheit’, ‘fahrenheit’, ‘F’ or ‘f’), and Rankine (‘Rankine’, ‘rankine’, ‘R’, ‘r’).

Returns:

res – Value(s) of the converted temperature(s) expressed in the new scale.

Return type:

float or array of floats

Notes

New in version 0.18.0.

Examples

>>> from scipy.constants import convert_temperature
>>> import numpy as np
>>> convert_temperature(np.array([-40, 40]), 'Celsius', 'Kelvin')
array([ 233.15,  313.15])
class pykpp.stdfuncs.datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])

Bases: date

The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.

astimezone()

tz -> convert to local time in new timezone tz

combine()

date, time -> datetime with same date and time fields

ctime()

Return ctime() style string.

date()

Return date object with same year, month and day.

dst()

Return self.tzinfo.dst(self).

fold
fromisoformat()

string -> datetime from a string in most ISO 8601 formats

fromtimestamp()

timestamp[, tz] -> tz’s local time from POSIX timestamp.

hour
isoformat()

[sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. sep is used to separate the year from the time, and defaults to ‘T’. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are ‘auto’, ‘hours’, ‘minutes’, ‘seconds’, ‘milliseconds’ and ‘microseconds’.

max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
microsecond
min = datetime.datetime(1, 1, 1, 0, 0)
minute
now()

Returns new datetime object representing current time local to tz.

tz

Timezone object.

If no tz is specified, uses local timezone.

replace()

Return datetime with new specified fields.

resolution = datetime.timedelta(microseconds=1)
second
strptime()

string, format -> new datetime parsed from a string (like time.strptime()).

time()

Return time object with same time but with tzinfo=None.

timestamp()

Return POSIX timestamp as float.

timetuple()

Return time tuple, compatible with time.localtime().

timetz()

Return time object with same time and tzinfo.

tzinfo
tzname()

Return self.tzinfo.tzname(self).

utcfromtimestamp()

Construct a naive UTC datetime from a POSIX timestamp.

utcnow()

Return a new datetime representing UTC day and time.

utcoffset()

Return self.tzinfo.utcoffset(self).

utctimetuple()

Return UTC time tuple, compatible with time.localtime().

pykpp.stdfuncs.find(sub: str | None = None, disp: bool = False) Any[source]

Return list of physical_constant keys containing a given string.

Parameters:
  • sub (str) – Sub-string to search keys for. By default, return all keys.

  • disp (bool) – If True, print the keys that are found and return None. Otherwise, return the list of keys without printing anything.

Returns:

keys – If disp is False, the list of keys is returned. Otherwise, None is returned.

Return type:

list or None

Examples

>>> from scipy.constants import find, physical_constants

Which keys in the physical_constants dictionary contain ‘boltzmann’?

>>> find('boltzmann')
['Boltzmann constant',
 'Boltzmann constant in Hz/K',
 'Boltzmann constant in eV/K',
 'Boltzmann constant in inverse meter per kelvin',
 'Stefan-Boltzmann constant']

Get the constant called ‘Boltzmann constant in Hz/K’:

>>> physical_constants['Boltzmann constant in Hz/K']
(20836619120.0, 'Hz K^-1', 0.0)

Find constants with ‘radius’ in the key:

>>> find('radius')
['Bohr radius',
 'alpha particle rms charge radius',
 'classical electron radius',
 'deuteron rms charge radius',
 'proton rms charge radius']
>>> physical_constants['classical electron radius']
(2.8179403262e-15, 'm', 1.3e-24)
class pykpp.stdfuncs.func_updater(func, incr, allowforce=True, verbose=False)[source]

Bases: updater

func - function that takes mech, and world incr - frequency to re-execute code verbose - show update status message - indentify this updater as message

pykpp.stdfuncs.h2o_from_rh_and_temp(RH, TEMP)[source]

Return H2O in molecules/cm**3 from RH (0-100) and TEMP in K

pykpp.stdfuncs.initstdenv(TEMP=298.0, P=101325.0)[source]

Initialize a std environemnt

class pykpp.stdfuncs.interp_updater(time, incr, allowforce=True, verbose=False, **props)[source]

Bases: updater

time - time array incr - frequency to re-execute code verbose - show update status props - keyword variables to update

pykpp.stdfuncs.interpolated_from_csv(path, timekey, incr=0, delimiter=',', verbose=False)[source]
pykpp.stdfuncs.k_3rd(temp, cair, k0_300K, n, kinf_300K, m, fc)[source]
pykpp.stdfuncs.k_arr(k_298, tdep, temp)[source]
pykpp.stdfuncs.lambda2nu(lambda_: npt.ArrayLike) Any[source]

Convert wavelength to optical frequency

Parameters:

lambda (array_like) – Wavelength(s) to be converted.

Returns:

nu – Equivalent optical frequency.

Return type:

float or array of floats

Notes

Computes nu = c / lambda where c = 299792458.0, i.e., the (vacuum) speed of light in meters/second.

Examples

>>> from scipy.constants import lambda2nu, speed_of_light
>>> import numpy as np
>>> lambda2nu(np.array((1, speed_of_light)))
array([  2.99792458e+08,   1.00000000e+00])
pykpp.stdfuncs.nu2lambda(nu: npt.ArrayLike) Any[source]

Convert optical frequency to wavelength.

Parameters:

nu (array_like) – Optical frequency to be converted.

Returns:

lambda – Equivalent wavelength(s).

Return type:

float or array of floats

Notes

Computes lambda = c / nu where c = 299792458.0, i.e., the (vacuum) speed of light in meters/second.

Examples

>>> from scipy.constants import nu2lambda, speed_of_light
>>> import numpy as np
>>> nu2lambda(np.array((1, speed_of_light)))
array([  2.99792458e+08,   1.00000000e+00])
pykpp.stdfuncs.precision(key: str) float[source]

Relative precision in physical_constants indexed by key

Parameters:

key (Python string) – Key in dictionary physical_constants

Returns:

prec – Relative precision in physical_constants corresponding to key

Return type:

float

Examples

>>> from scipy import constants
>>> constants.precision('proton mass')
5.1e-37
pykpp.stdfuncs.solar_declination(N)[source]

N - julian day 1-365 (1 = Jan 1; 365 = Dec 31) Returns solar declination in radians

wikipedia.org/wiki/Declination_of_the_Sun dec_deg = -23.44 * cos_deg(360./365 * (N + 10)) dec_rad = (pi / 180. * -23.44) * cos_rad(pi / 180. * 360./365 * (N + 10))

pykpp.stdfuncs.solar_noon(LonDegE)

Assumes that time is Local Time and, therefore, returns 12.

pykpp.stdfuncs.solar_noon_local(LonDegE)[source]

Assumes that time is Local Time and, therefore, returns 12.

pykpp.stdfuncs.solar_noon_utc(LonDegE)[source]

Returns solar noon in UTC based on 15degree timezones 0+-7.5 LonDegE - degrees longitude (-180, 180)

class pykpp.stdfuncs.spline_updater(time, incr, allowforce=True, verbose=False, **props)[source]

Bases: updater

time - time array incr - frequency to re-execute code verbose - show update status props - keyword variables to update

pykpp.stdfuncs.splined_from_csv(path, timekey, incr=0, delimiter=',', verbose=False)[source]
pykpp.stdfuncs.unit(key: str) str[source]

Unit in physical_constants indexed by key

Parameters:

key (Python string) – Key in dictionary physical_constants

Returns:

unit – Unit in physical_constants corresponding to key

Return type:

Python string

Examples

>>> from scipy import constants
>>> constants.unit('proton mass')
'kg'
pykpp.stdfuncs.update_func_world(mech, world)[source]

Function to update globals for user defined functions

pykpp.stdfuncs.value(key: str) float[source]

Value in physical_constants indexed by key

Parameters:

key (Python string) – Key in dictionary physical_constants

Returns:

value – Value in physical_constants corresponding to key

Return type:

float

Examples

>>> from scipy import constants
>>> constants.value('elementary charge')
1.602176634e-19

pykpp.updaters module

pykpp.updaters.Monitor(mech, world=None)[source]
pykpp.updaters.Update_M(mech, world)[source]
Adds concentrations (molecules/cm3) to world namespace for:

M (air), O2 (0.20946 M), N2 (0.78084 M), and H2 (500 ppb)

based on:

Pressure (P in Pascals), Temperature (TEMP in Kelvin), and R is provided in m**3 * Pascals/K/mol

TEMP and P must be defined either in world or in stdfuncs

pykpp.updaters.Update_RCONST(mech, world=None)[source]
pykpp.updaters.Update_SUN(mech, world)[source]
Updates world dectionary to contain

SUN - scaling variable between 0 and 1 (following Sandu et al.)

if t < SunRise or t > SunSet: SUN = 0.

hour = time since noon squared = abs(hour) * hour

pykpp.updaters.Update_THETA(mech, world)[source]

Adds solar zenith angle (THETA; angle from solar noon) in degrees to the world dictionary based on time

THETA = arccos(sin(lat) * sin(dec) + cos(lat) * cos(dec) * cos(houra))

pykpp.updaters.add_code_updater(code, incr=0, verbose=False, message='code')[source]

Shortcut to: add_world_updater(

code_updater(code=code, incr=incr, verbose=verbose, message=message)

)

pykpp.updaters.add_time_interpolated(time, incr=0, verbose=False, **props)[source]
Shortcut to
add_world_updater(

interp_updater(time=time, incr=incr, verbose=verbose, **props)

)

pykpp.updaters.add_time_interpolated_from_csv(path, timekey, incr=0)[source]

Shortcut to add_time_interpolated from data in a csv file

class pykpp.updaters.code_updater(code, incr, allowforce=True, verbose=False, message='code')[source]

Bases: updater

code - string that can be compiled as exec incr - frequency to re-execute code verbose - show update status message - indentify this updater as message

class pykpp.updaters.func_updater(func, incr, allowforce=True, verbose=False)[source]

Bases: updater

func - function that takes mech, and world incr - frequency to re-execute code verbose - show update status message - indentify this updater as message

class pykpp.updaters.interp_updater(time, incr, allowforce=True, verbose=False, **props)[source]

Bases: updater

time - time array incr - frequency to re-execute code verbose - show update status props - keyword variables to update

pykpp.updaters.interpolated_from_csv(path, timekey, incr=0, delimiter=',', verbose=False)[source]
pykpp.updaters.solar_declination(N)[source]

N - julian day 1-365 (1 = Jan 1; 365 = Dec 31) Returns solar declination in radians

wikipedia.org/wiki/Declination_of_the_Sun dec_deg = -23.44 * cos_deg(360./365 * (N + 10)) dec_rad = (pi / 180. * -23.44) * cos_rad(pi / 180. * 360./365 * (N + 10))

class pykpp.updaters.spline_updater(time, incr, allowforce=True, verbose=False, **props)[source]

Bases: updater

time - time array incr - frequency to re-execute code verbose - show update status props - keyword variables to update

pykpp.updaters.splined_from_csv(path, timekey, incr=0, delimiter=',', verbose=False)[source]

Module contents