Spaces:
Sleeping
Sleeping
mattritchey
commited on
Commit
•
3d1bfb4
1
Parent(s):
6c8879c
Update main.py
Browse files
main.py
CHANGED
@@ -46,14 +46,14 @@ def geocode_address(address):
|
|
46 |
|
47 |
def get_data(address, start_date, end_date, radius_miles, get_max):
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
|
58 |
# Geocode Address
|
59 |
try:
|
@@ -69,15 +69,15 @@ def get_data(address, start_date, end_date, radius_miles, get_max):
|
|
69 |
row=col=None
|
70 |
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
|
80 |
-
|
81 |
|
82 |
|
83 |
# # Query and Collect H5 Data
|
|
|
46 |
|
47 |
def get_data(address, start_date, end_date, radius_miles, get_max):
|
48 |
|
49 |
+
start_date = pd.Timestamp(str(start_date)).strftime('%Y%m%d%H')
|
50 |
+
end_date = pd.Timestamp(str(end_date)).strftime('%Y%m%d%H')
|
51 |
+
date_years = pd.date_range(start=start_date[:-2], end=end_date[:-2], freq='M')
|
52 |
+
date_range_days = pd.date_range(start_date[:-2], end_date[:-2], freq='H')
|
53 |
+
years = list(set([d.year for d in date_years]))
|
54 |
+
|
55 |
+
if len(years) == 0:
|
56 |
+
years = [pd.Timestamp(start_date).year]
|
57 |
|
58 |
# Geocode Address
|
59 |
try:
|
|
|
69 |
row=col=None
|
70 |
|
71 |
|
72 |
+
files = [
|
73 |
+
# 'Data/APCP_2024_hrrr_v2.h5',
|
74 |
+
'Data/APCP_2020_hrrr_v3.h5',
|
75 |
+
'Data/APCP_2021_hrrr_3.h5',
|
76 |
+
'Data/APCP_2022_hrrr_v2.h5',
|
77 |
+
# 'Data/APCP_2023_hrrr_v2c.h5'
|
78 |
+
]
|
79 |
|
80 |
+
files_choosen = [i for i in files if any(i for j in years if str(j) in i)]
|
81 |
|
82 |
|
83 |
# # Query and Collect H5 Data
|