mattritchey commited on
Commit
8fbedd2
·
verified ·
1 Parent(s): 24ff6f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -33
app.py CHANGED
@@ -40,38 +40,38 @@ def geocode(address):
40
  return pd.DataFrame({'Lat': lat, 'Lon': lon}, index=[0])
41
 
42
 
43
- def get_data(row, col, radius=8):
44
- files = [
45
- "data/2023_hail.h5",
46
- "data/2022_hail.h5",
47
- "data/2021_hail.h5",
48
- "data/2020_hail.h5"
49
- ]
50
- all_data = []
51
- all_dates = []
52
- for f in files:
53
- with h5py.File(f, 'r') as f:
54
- data = f['hail'][:, row - radius: row + radius+ 1, col-radius: col+radius+1]
55
- dates = f['dates'][:]
56
- all_data.append(data)
57
- all_dates.append(dates)
58
-
59
- data_mat = np.concatenate(all_data)
60
- data_mat = np.where(data_mat < 0, 0, data_mat)*0.0393701
61
- dates_mat = np.concatenate(all_dates)
62
-
63
- data_actual = [i[radius, radius] for i in data_mat]
64
- data_max = np.max(data_mat, axis=(1, 2))
65
- data_max_2 = np.max(data_mat, axis=0)
66
-
67
- df = pd.DataFrame({'Date': dates_mat,
68
- 'Actual': data_actual,
69
- 'Max': data_max})
70
-
71
- df['Date'] = pd.to_datetime(df['Date'], format='%Y%m%d')
72
- df['Date']=df['Date']+pd.Timedelta(days=1)
73
-
74
- return df, data_max_2
75
 
76
 
77
  def map_folium(lat, lon,files_dates_selected, within_days ):
@@ -224,7 +224,6 @@ for i in files:
224
  with h5py.File(i, 'r') as f:
225
  data = f['hail'][:, 100 - radius:100 + radius+ 1,
226
  100-radius: 100+radius+1]
227
- st.write(data)
228
  dates = f['dates'][:]
229
  all_data.append(data)
230
  all_dates.append(dates)
 
40
  return pd.DataFrame({'Lat': lat, 'Lon': lon}, index=[0])
41
 
42
 
43
+ # def get_data(row, col, radius=8):
44
+ # files = [
45
+ # "data/2023_hail.h5",
46
+ # "data/2022_hail.h5",
47
+ # "data/2021_hail.h5",
48
+ # "data/2020_hail.h5"
49
+ # ]
50
+ # all_data = []
51
+ # all_dates = []
52
+ # for f in files:
53
+ # with h5py.File(f, 'r') as f:
54
+ # data = f['hail'][:, row - radius: row + radius+ 1, col-radius: col+radius+1]
55
+ # dates = f['dates'][:]
56
+ # all_data.append(data)
57
+ # all_dates.append(dates)
58
+
59
+ # data_mat = np.concatenate(all_data)
60
+ # data_mat = np.where(data_mat < 0, 0, data_mat)*0.0393701
61
+ # dates_mat = np.concatenate(all_dates)
62
+
63
+ # data_actual = [i[radius, radius] for i in data_mat]
64
+ # data_max = np.max(data_mat, axis=(1, 2))
65
+ # data_max_2 = np.max(data_mat, axis=0)
66
+
67
+ # df = pd.DataFrame({'Date': dates_mat,
68
+ # 'Actual': data_actual,
69
+ # 'Max': data_max})
70
+
71
+ # df['Date'] = pd.to_datetime(df['Date'], format='%Y%m%d')
72
+ # df['Date']=df['Date']+pd.Timedelta(days=1)
73
+
74
+ # return df, data_max_2
75
 
76
 
77
  def map_folium(lat, lon,files_dates_selected, within_days ):
 
224
  with h5py.File(i, 'r') as f:
225
  data = f['hail'][:, 100 - radius:100 + radius+ 1,
226
  100-radius: 100+radius+1]
 
227
  dates = f['dates'][:]
228
  all_data.append(data)
229
  all_dates.append(dates)