@@ -1551,24 +1551,26 @@ def process_custom_atmosphere(
15511551 # Check maximum height of custom wind input
15521552 if not callable (self .wind_velocity_x .source ):
15531553 max_expected_height = max (self .wind_velocity_x [- 1 , 0 ], max_expected_height )
1554- if not callable (self .wind_velocity_y .source ):
1555- max_expected_height = max (self .wind_velocity_y [- 1 , 0 ], max_expected_height )
15561554
1557- # Compute wind profile direction and heading
1558- wind_heading = (
1559- lambda h : np .arctan2 (self .wind_velocity_x (h ), self .wind_velocity_y (h ))
1560- * (180 / np .pi )
1561- % 360
1562- )
1555+ def wind_heading_func (h ):
1556+ return (
1557+ np .arctan2 (
1558+ self .wind_velocity_x .get_value_opt (h ),
1559+ self .wind_velocity_y .get_value_opt (h ),
1560+ )
1561+ * (180 / np .pi )
1562+ % 360
1563+ )
1564+
15631565 self .wind_heading = Function (
1564- wind_heading ,
1566+ wind_heading_func ,
15651567 inputs = "Height Above Sea Level (m)" ,
15661568 outputs = "Wind Heading (Deg True)" ,
15671569 interpolation = "linear" ,
15681570 )
15691571
15701572 def wind_direction (h ):
1571- return (wind_heading (h ) - 180 ) % 360
1573+ return (wind_heading_func (h ) - 180 ) % 360
15721574
15731575 self .wind_direction = Function (
15741576 wind_direction ,
@@ -1578,7 +1580,10 @@ def wind_direction(h):
15781580 )
15791581
15801582 def wind_speed (h ):
1581- return np .sqrt (self .wind_velocity_x (h ) ** 2 + self .wind_velocity_y (h ) ** 2 )
1583+ return np .sqrt (
1584+ self .wind_velocity_x .get_value_opt (h ) ** 2
1585+ + self .wind_velocity_y .get_value_opt (h ) ** 2
1586+ )
15821587
15831588 self .wind_speed = Function (
15841589 wind_speed ,
@@ -3197,22 +3202,26 @@ def add_wind_gust(self, wind_gust_x, wind_gust_y):
31973202 # Reset wind heading and velocity magnitude
31983203 self .wind_heading = Function (
31993204 lambda h : (180 / np .pi )
3200- * np .arctan2 (self .wind_velocity_x (h ), self .wind_velocity_y (h ))
3205+ * np .arctan2 (
3206+ self .wind_velocity_x .get_value_opt (h ),
3207+ self .wind_velocity_y .get_value_opt (h ),
3208+ )
32013209 % 360 ,
32023210 "Height (m)" ,
32033211 "Wind Heading (degrees)" ,
32043212 extrapolation = "constant" ,
32053213 )
32063214 self .wind_speed = Function (
3207- lambda h : (self .wind_velocity_x (h ) ** 2 + self .wind_velocity_y (h ) ** 2 )
3215+ lambda h : (
3216+ self .wind_velocity_x .get_value_opt (h ) ** 2
3217+ + self .wind_velocity_y .get_value_opt (h ) ** 2
3218+ )
32083219 ** 0.5 ,
32093220 "Height (m)" ,
32103221 "Wind Speed (m/s)" ,
32113222 extrapolation = "constant" ,
32123223 )
32133224
3214- return None
3215-
32163225 def info (self ):
32173226 """Prints most important data and graphs available about the
32183227 Environment.
0 commit comments