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,20 +123,18 @@ def loft_parcel(start_temp: float,
|
||||||
while pressure >= PRESSURE_MIN:
|
while pressure >= PRESSURE_MIN:
|
||||||
height = pressure_height(pressure)
|
height = pressure_height(pressure)
|
||||||
|
|
||||||
if height_last is None:
|
if height_last is not None:
|
||||||
height_last = height
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rate = lapse_rate(temp, pressure)
|
rate = lapse_rate(temp, pressure)
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
break
|
break
|
||||||
|
|
||||||
temp = lapse(temp, height - height_last, rate)
|
height_delta = height - height_last
|
||||||
|
|
||||||
|
temp = lapse(temp, height_delta, rate)
|
||||||
|
|
||||||
yield temp, pressure
|
yield temp, pressure
|
||||||
|
|
||||||
height_last = height
|
|
||||||
|
|
||||||
if pressure == PRESSURE_MIN:
|
if pressure == PRESSURE_MIN:
|
||||||
break
|
break
|
||||||
elif pressure - step < PRESSURE_MIN:
|
elif pressure - step < PRESSURE_MIN:
|
||||||
|
@ -144,6 +142,8 @@ def loft_parcel(start_temp: float,
|
||||||
else:
|
else:
|
||||||
pressure -= step
|
pressure -= step
|
||||||
|
|
||||||
|
height_last = height
|
||||||
|
|
||||||
def follow_dry_adiabat(temp: float, pressure: float) -> Series:
|
def follow_dry_adiabat(temp: float, pressure: float) -> Series:
|
||||||
"""
|
"""
|
||||||
Follow a dry adiabat starting at a given temp and pressure level, returning
|
Follow a dry adiabat starting at a given temp and pressure level, returning
|
||||||
|
|
Loading…
Add table
Reference in a new issue