mattritchey commited on
Commit
80d3325
1 Parent(s): 77a46c3

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +18 -18
main.py CHANGED
@@ -104,24 +104,24 @@ def get_data(address, start_date, end_date, radius_miles, get_max):
104
  disk_mask = np.where(disk(radius_miles) == 1, True, False)
105
  data_mat = np.where(disk_mask, data_mat, -1).round(3)
106
 
107
- # # Process to DataFrame
108
- # # Find Max of Data
109
- # if get_max == True:
110
- # data_max = np.max(data_mat, axis=(1, 2))
111
- # df_data = pd.DataFrame({'Date': dates_all,
112
- # 'APCP_max': data_max})
113
- # # Get all Data
114
- # else:
115
- # data_all = list(data_mat)
116
- # df_data = pd.DataFrame({'Date': dates_all,
117
- # 'APCP_all': data_all})
118
-
119
- # df_data['Date'] = pd.to_datetime(df_data['Date'], format='%Y%m%d%H')
120
- # df_data = df_data.set_index('Date')
121
-
122
- # df_data = df_data.reindex(date_range_days, fill_value=0).reset_index().rename(
123
- # columns={'index': 'Date'})
124
- # df_data['Date'] = df_data['Date'].dt.strftime('%Y-%m-%d:%H')
125
 
126
  # return df_data
127
  return lat, lon, row, col
 
104
  disk_mask = np.where(disk(radius_miles) == 1, True, False)
105
  data_mat = np.where(disk_mask, data_mat, -1).round(3)
106
 
107
+ # Process to DataFrame
108
+ # Find Max of Data
109
+ if get_max == True:
110
+ data_max = np.max(data_mat, axis=(1, 2))
111
+ df_data = pd.DataFrame({'Date': dates_all,
112
+ 'APCP_max': data_max})
113
+ # Get all Data
114
+ else:
115
+ data_all = list(data_mat)
116
+ df_data = pd.DataFrame({'Date': dates_all,
117
+ 'APCP_all': data_all})
118
+
119
+ df_data['Date'] = pd.to_datetime(df_data['Date'], format='%Y%m%d%H')
120
+ df_data = df_data.set_index('Date')
121
+
122
+ df_data = df_data.reindex(date_range_days, fill_value=0).reset_index().rename(
123
+ columns={'index': 'Date'})
124
+ df_data['Date'] = df_data['Date'].dt.strftime('%Y-%m-%d:%H')
125
 
126
  # return df_data
127
  return lat, lon, row, col