-
Notifications
You must be signed in to change notification settings - Fork 445
Description
What should we add?
I wasn't sure if the overloading proposed below was Pythonic, but I see xarray does it frequently (e.g. date_range).
Here's my specification:
- All existing code works as is (i.e., no tests break)
- Code like the following does not produce errors, but generates the results described:
# Set up code omitted
results = mpcalc.parcel_profile(p, T, Td)
# Equivalent to:
results = mpcalc.parcel_profile(p, T[0], Td[0])
results = mpcalc.parcel_profile(p, T, Td, with_lcl=True)
# Equivalent to:
results = mpcalc.parcel_profile_with_lcl(p, T, Td)
results = mpcalc.parcel_profile(p, T, Td, with_lcl=True, as_dataset=True)
# Equivalent to:
results = mpcalc.parcel_profile_with_lcl_as_dataset(p, T, Td)
results = mpcalc.parcel_profile(p, T, Td, as_dataset=True)
# No equivalent, but akin to previous example with LCL omitted-
An additional optional argument
start_indexis allowed. It defaults to 0, but allows the user to lift a parcel not at the first index.(It is an error to specify anything other than 0 if the input temperature and dewpoint profiles are not arrays as in the current implementation onNot an error, but means to generate the profile with the given temperature and dewpoint, but starting atparcel_profile.)pressure[start_index]. The general rule is the returned array(s) contain(s)np.nans at the levels below the starting point. -
An additional optional argument
start_pressureis allowed. It defaults topressure[0], but allows the user to lift the parcel at pressurestart_pressure. (Theshowalter_indeximplements a special case of this functionality.) An error is raised ifstart_pressureis not in the interval [min(pressure), max(pressure)]. It is an error to specify bothstart_pressureandstart_index. -
(Bonus) The restriction that the array(s) are in order of decreasing order of pressure is relaxed to a restriction that the array(s) are monotonic with respect to pressure. If the inputs are in increasing order, the default
start_indexis -1, and the defaultstart_pressureispressure[-1].
Reference
No response