sharppy / SHARPpy

Sounding/Hodograph Analysis and Research Program in Python
https://sharppy.github.io/SHARPpy/index.html
Other
219 stars 112 forks source link

All parameter functions need to have at least one argument object, the Profile object. #14

Open wblumberg opened 9 years ago

wblumberg commented 9 years ago

When Patrick began writing different param.py functions, each of them accepted a Profile object argument, but also had keyword arguments optionally passed to the function that could be used for the calculation of the parameter so precomputed indices could be used (for example, the effective_inflow_layer() would look for a mupcl keyword argument and a precomputed mupcl in the Profile object). If the precomputed indices weren't available in either the Profile object or the keyword arguments, the function would calculate the needed index.

For research purposes, I think each function in the params.py, sars.py and other functions need to follow this framework. That way someone running parameters (i.e. STP_CIN) on a large dataset would not need to worry about explicitly computing each individual term on their own when writing code. They would only need to use the one function. This would simplify the backend and make it easier to use and understand how to use.

I've started this process and already have these functions in this framework: params.precip_eff() params.sig_severe() params.wndg() params.mmp() params.sherb() params.esp() params.ship()

I've been using the hasattr() and the kwargs.get() functions to pull this off. Patrick previously used the try, except to do the hasattr().

These functions are a little more complex and will need more heavy lifting to implement this framework (especially those that require effective inflow layer calculations): params.scp() params.stp_fixed() params.stp_cin() watch.possible_watch() sars.hail() sars.supercell() watch.best_guess_precip()

wblumberg commented 9 years ago

Going to make a check.py file to include certain checking routines for the parameters functions to a) identify which variables exist and b) compute them if they don't exist.