Spaces:
Runtime error
Runtime error
Commit
•
235c5cc
1
Parent(s):
07ed14c
Upload precipitation_function.py
Browse files- precipitation_function.py +11 -20
precipitation_function.py
CHANGED
@@ -23,24 +23,16 @@ warnings.filterwarnings("ignore")
|
|
23 |
from pandarallel import pandarallel
|
24 |
pandarallel.initialize(progress_bar=True)
|
25 |
|
26 |
-
from google.oauth2 import service_account
|
27 |
-
from google.cloud import storage
|
28 |
-
|
29 |
-
# Create API client.
|
30 |
-
# credentials = service_account.Credentials.from_service_account_info(
|
31 |
-
# st.secrets["gcp_service_account"]
|
32 |
-
# )
|
33 |
-
# client = storage.Client(credentials=credentials)
|
34 |
-
#
|
35 |
-
# @st.cache(allow_output_mutation = True)
|
36 |
-
# def read_file(bucket_name, file_path):
|
37 |
-
# bucket = client.bucket(bucket_name)
|
38 |
-
# data = bucket.blob(file_path).download_as_bytes()
|
39 |
-
# df = pd.read_csv(io.BytesIO(data),compression='zip')
|
40 |
-
# return df
|
41 |
-
|
42 |
|
|
|
|
|
|
|
|
|
43 |
|
|
|
|
|
|
|
|
|
44 |
|
45 |
@st.cache
|
46 |
def date_split(df):
|
@@ -61,8 +53,8 @@ def drop_dup_funct(x):
|
|
61 |
return x
|
62 |
|
63 |
@st.cache(allow_output_mutation = True)
|
64 |
-
def concat_func(x,y
|
65 |
-
z = pd.concat([x,y
|
66 |
return z
|
67 |
|
68 |
@st.cache
|
@@ -111,7 +103,7 @@ def daily_precp_plot(df):
|
|
111 |
fig.update_layout(title = "Daily Precipitation")
|
112 |
return fig
|
113 |
|
114 |
-
|
115 |
def start_end_date_ui(start,end,key1,key2):
|
116 |
st.markdown('**Enter Start Date**')
|
117 |
start = st.date_input("",value = start,key = key1)
|
@@ -122,7 +114,6 @@ def start_end_date_ui(start,end,key1,key2):
|
|
122 |
end = st.date_input("",value = end, key = key2)
|
123 |
if end > pd.to_datetime('2019/12/31'):
|
124 |
st.write('End date should not be greater than 2019/12/31')
|
125 |
-
|
126 |
return start,end
|
127 |
|
128 |
|
|
|
23 |
from pandarallel import pandarallel
|
24 |
pandarallel.initialize(progress_bar=True)
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
@st.cache(allow_output_mutation=True)
|
28 |
+
def main_concat(a,b):
|
29 |
+
z = pd.concat([a,b],ignore_index = True)
|
30 |
+
return z
|
31 |
|
32 |
+
@st.cache(allow_output_mutation=True)
|
33 |
+
def load_data(path):
|
34 |
+
df = pd.read_csv(path,compression = 'zip')
|
35 |
+
return df
|
36 |
|
37 |
@st.cache
|
38 |
def date_split(df):
|
|
|
53 |
return x
|
54 |
|
55 |
@st.cache(allow_output_mutation = True)
|
56 |
+
def concat_func(x,y):
|
57 |
+
z = pd.concat([x,y],ignore_index = True)
|
58 |
return z
|
59 |
|
60 |
@st.cache
|
|
|
103 |
fig.update_layout(title = "Daily Precipitation")
|
104 |
return fig
|
105 |
|
106 |
+
@st.cache(suppress_st_warning=True)
|
107 |
def start_end_date_ui(start,end,key1,key2):
|
108 |
st.markdown('**Enter Start Date**')
|
109 |
start = st.date_input("",value = start,key = key1)
|
|
|
114 |
end = st.date_input("",value = end, key = key2)
|
115 |
if end > pd.to_datetime('2019/12/31'):
|
116 |
st.write('End date should not be greater than 2019/12/31')
|
|
|
117 |
return start,end
|
118 |
|
119 |
|