Do not hardcode pressure steps
This commit is contained in:
		
							parent
							
								
									b3eeeab4d7
								
							
						
					
					
						commit
						9be71c7e44
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -101,7 +101,8 @@ def moist_lapse_rate(temp: float, pressure: float) -> float:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def loft_parcel(start_temp: float,
 | 
					def loft_parcel(start_temp: float,
 | 
				
			||||||
                start_pressure: float,
 | 
					                start_pressure: float,
 | 
				
			||||||
                lapse_rate: Callable):
 | 
					                lapse_rate: Callable,
 | 
				
			||||||
 | 
					                step: float=10.0):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Loft a parcel of air from a given pressure, at a given temperature,
 | 
					    Loft a parcel of air from a given pressure, at a given temperature,
 | 
				
			||||||
    yielding a Tuple containing the temperature and pressure of that parcel
 | 
					    yielding a Tuple containing the temperature and pressure of that parcel
 | 
				
			||||||
| 
						 | 
					@ -136,7 +137,7 @@ def loft_parcel(start_temp: float,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if pressure == PRESSURE_MIN:
 | 
					        if pressure == PRESSURE_MIN:
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
        elif pressure - 10.0 < PRESSURE_MIN:
 | 
					        elif pressure - step < PRESSURE_MIN:
 | 
				
			||||||
            pressure = PRESSURE_MIN
 | 
					            pressure = PRESSURE_MIN
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            pressure -= 10.0
 | 
					            pressure -= step
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue