mattritchey commited on
Commit
9bd3977
·
verified ·
1 Parent(s): cb86663

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -3
main.py CHANGED
@@ -37,6 +37,10 @@ def geocode_address(address):
37
 
38
  def get_hail_data(address, start_date, end_date, radius_miles, get_max):
39
 
 
 
 
 
40
  start_date = pd.Timestamp(str(start_date)).strftime('%Y%m%d')
41
  end_date = pd.Timestamp(str(end_date)).strftime('%Y%m%d')
42
  date_years = pd.date_range(start=start_date, end=end_date, freq='M')
@@ -77,8 +81,8 @@ def get_hail_data(address, start_date, end_date, radius_miles, get_max):
77
 
78
  # Select Data by Date and Radius
79
  dates = dates[date_idx]
80
- data = f['hail'][date_idx, row-radius_miles:row +
81
- radius_miles+1, col-radius_miles:col+radius_miles+1]
82
 
83
  all_data.append(data)
84
  all_dates.append(dates)
@@ -90,7 +94,7 @@ def get_hail_data(address, start_date, end_date, radius_miles, get_max):
90
  data_mat = np.where(data_all < 0, 0, data_all)*0.0393701
91
 
92
  # Get Radius of Data
93
- disk_mask = np.where(disk(radius_miles) == 1, True, False)
94
  data_mat = np.where(disk_mask, data_mat, -1).round(3)
95
 
96
  # Process to DataFrame
 
37
 
38
  def get_hail_data(address, start_date, end_date, radius_miles, get_max):
39
 
40
+ resolution=1 # mrms 1 and hrrr is 3
41
+ radius = int(np.ceil(radius_miles*1.6/resolution))
42
+
43
+
44
  start_date = pd.Timestamp(str(start_date)).strftime('%Y%m%d')
45
  end_date = pd.Timestamp(str(end_date)).strftime('%Y%m%d')
46
  date_years = pd.date_range(start=start_date, end=end_date, freq='M')
 
81
 
82
  # Select Data by Date and Radius
83
  dates = dates[date_idx]
84
+ data = f['hail'][date_idx, row-radius:row +
85
+ radius+1, col-radius:col+radius+1]
86
 
87
  all_data.append(data)
88
  all_dates.append(dates)
 
94
  data_mat = np.where(data_all < 0, 0, data_all)*0.0393701
95
 
96
  # Get Radius of Data
97
+ disk_mask = np.where(disk(radius) == 1, True, False)
98
  data_mat = np.where(disk_mask, data_mat, -1).round(3)
99
 
100
  # Process to DataFrame