mabuseif commited on
Commit
c10b0ca
·
verified ·
1 Parent(s): bdf99d6

Upload 4 files

Browse files
Files changed (1) hide show
  1. utils/cooling_load.py +18 -1
utils/cooling_load.py CHANGED
@@ -44,8 +44,25 @@ class CoolingLoadCalculator:
44
  Valid latitude string ('24N', '32N', '40N', '48N', '56N')
45
  """
46
  try:
 
47
  if not isinstance(latitude, str):
48
- latitude = str(latitude)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  latitude = latitude.strip().upper()
51
  if st.session_state.get('debug_mode', False):
 
44
  Valid latitude string ('24N', '32N', '40N', '48N', '56N')
45
  """
46
  try:
47
+ # Convert to string if not already
48
  if not isinstance(latitude, str):
49
+ # For numeric values, ensure we're working with the absolute value
50
+ try:
51
+ lat_val = float(latitude)
52
+ # Map directly to standard latitude without string conversion
53
+ if lat_val <= 28:
54
+ return '24N'
55
+ elif lat_val <= 36:
56
+ return '32N'
57
+ elif lat_val <= 44:
58
+ return '40N'
59
+ elif lat_val <= 52:
60
+ return '48N'
61
+ else:
62
+ return '56N'
63
+ except (ValueError, TypeError):
64
+ # If conversion to float fails, convert to string and continue
65
+ latitude = str(latitude)
66
 
67
  latitude = latitude.strip().upper()
68
  if st.session_state.get('debug_mode', False):