Do not compute lapse on first height
This commit is contained in:
parent
cae2cb0b3f
commit
362ee0a2f4
1 changed files with 10 additions and 10 deletions
|
@ -123,19 +123,17 @@ def loft_parcel(start_temp: float,
|
|||
while pressure >= PRESSURE_MIN:
|
||||
height = pressure_height(pressure)
|
||||
|
||||
if height_last is None:
|
||||
height_last = height
|
||||
if height_last is not None:
|
||||
try:
|
||||
rate = lapse_rate(temp, pressure)
|
||||
except OverflowError:
|
||||
break
|
||||
|
||||
try:
|
||||
rate = lapse_rate(temp, pressure)
|
||||
except OverflowError:
|
||||
break
|
||||
height_delta = height - height_last
|
||||
|
||||
temp = lapse(temp, height - height_last, rate)
|
||||
temp = lapse(temp, height_delta, rate)
|
||||
|
||||
yield temp, pressure
|
||||
|
||||
height_last = height
|
||||
yield temp, pressure
|
||||
|
||||
if pressure == PRESSURE_MIN:
|
||||
break
|
||||
|
@ -144,6 +142,8 @@ def loft_parcel(start_temp: float,
|
|||
else:
|
||||
pressure -= step
|
||||
|
||||
height_last = height
|
||||
|
||||
def follow_dry_adiabat(temp: float, pressure: float) -> Series:
|
||||
"""
|
||||
Follow a dry adiabat starting at a given temp and pressure level, returning
|
||||
|
|
Loading…
Add table
Reference in a new issue