mabuseif commited on
Commit
9c46f14
·
verified ·
1 Parent(s): 7484065

Upload 31 files

Browse files
Files changed (1) hide show
  1. data/climate_data.py +27 -7
data/climate_data.py CHANGED
@@ -179,7 +179,7 @@ class ClimateData:
179
  return design_conditions_by_zone["4A"]
180
 
181
  @staticmethod
182
- def get_monthly_temperatures(climate_zone: str) -> Dict[str, float]:
183
  """
184
  Get monthly average temperatures for a specific climate zone.
185
 
@@ -187,10 +187,30 @@ class ClimateData:
187
  climate_zone: ASHRAE climate zone (e.g., '1A', '3B', '5A')
188
 
189
  Returns:
190
- Dictionary with monthly average temperatures
 
191
  """
192
- # Default monthly temperatures by climate zone
193
- monthly_temps_by_zone = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  # Hot-Humid (like Miami)
195
  "1A": {
196
  "Jan": 20.0, "Feb": 20.5, "Mar": 22.0, "Apr": 24.0, "May": 26.0,
@@ -297,11 +317,11 @@ class ClimateData:
297
 
298
  # Return monthly temperatures for the specified climate zone
299
  # If climate zone not found, return default values
300
- if climate_zone in monthly_temps_by_zone:
301
- return monthly_temps_by_zone[climate_zone]
302
  else:
303
  # Default to 4A if climate zone not found
304
- return monthly_temps_by_zone["4A"]
305
 
306
  def _load_climate_locations(self) -> Dict[str, ClimateLocation]:
307
  """
 
179
  return design_conditions_by_zone["4A"]
180
 
181
  @staticmethod
182
+ def get_monthly_temperatures(climate_zone: str) -> Dict[int, Dict[str, float]]:
183
  """
184
  Get monthly average temperatures for a specific climate zone.
185
 
 
187
  climate_zone: ASHRAE climate zone (e.g., '1A', '3B', '5A')
188
 
189
  Returns:
190
+ Dictionary with monthly average temperatures indexed by month number (1-12)
191
+ Each month contains 'avg_db', 'max_db', and 'min_db' values
192
  """
193
+ # Helper function to convert month name format to numeric format with min/max values
194
+ def convert_month_format(month_data):
195
+ month_names = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
196
+ result = {}
197
+
198
+ for i, month in enumerate(month_names, 1):
199
+ avg_temp = month_data[month]
200
+ # Generate reasonable min/max values based on average
201
+ min_temp = avg_temp - 5.0
202
+ max_temp = avg_temp + 5.0
203
+
204
+ result[i] = {
205
+ 'avg_db': avg_temp,
206
+ 'min_db': min_temp,
207
+ 'max_db': max_temp
208
+ }
209
+
210
+ return result
211
+
212
+ # Default monthly temperatures by climate zone (in month name format)
213
+ monthly_temps_raw = {
214
  # Hot-Humid (like Miami)
215
  "1A": {
216
  "Jan": 20.0, "Feb": 20.5, "Mar": 22.0, "Apr": 24.0, "May": 26.0,
 
317
 
318
  # Return monthly temperatures for the specified climate zone
319
  # If climate zone not found, return default values
320
+ if climate_zone in monthly_temps_raw:
321
+ return convert_month_format(monthly_temps_raw[climate_zone])
322
  else:
323
  # Default to 4A if climate zone not found
324
+ return convert_month_format(monthly_temps_raw["4A"])
325
 
326
  def _load_climate_locations(self) -> Dict[str, ClimateLocation]:
327
  """