Skip to content

Commit 19ebc44

Browse files
FIX: partially solve masks on json using nan
1 parent c96db9d commit 19ebc44

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

rocketpy/EnvironmentAnalysis.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ def __init__(
156156
self.surfaceDataDict = self.loaded_data["surfaceDataDict"]
157157
self.pressureLevelDataDict = self.loaded_data["pressureLevelDataDict"]
158158

159+
# Fix old masked values on surface data
160+
for days in self.surfaceDataDict.keys():
161+
for hours in self.surfaceDataDict[days].keys():
162+
for variables in self.surfaceDataDict[days][hours].keys():
163+
if self.surfaceDataDict[days][hours][variables] == "--":
164+
# TODO: is there any other value that we can use to prevent "NaN"?
165+
self.surfaceDataDict[days][hours][variables] = float("NaN")
166+
159167
# Initialize variables again, to accomplish to the data available at the loaded file
160168
self.elevation = self.loaded_data["elevation"]
161169
self.latitude = self.loaded_data["latitude"]
@@ -979,8 +987,8 @@ def process_data(self):
979987
self.calculate_record_max_surface_100m_wind_speed()
980988
self.calculate_record_min_surface_100m_wind_speed()
981989
self.calculate_percentage_of_days_with_precipitation()
982-
self.calculate_average_cloud_base_height()
983-
self.calculate_min_cloud_base_height()
990+
self.calculate_average_cloud_base_height() # Having problems with masks!
991+
self.calculate_min_cloud_base_height() # Having problems with masks!
984992
self.calculate_percentage_of_days_with_no_cloud_coverage()
985993

986994
@property

0 commit comments

Comments
 (0)