a10 commited on
Commit
8aa92d6
·
1 Parent(s): 9191311

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  #%%
2
  from matplotlib.pyplot import title
3
  import tensorflow as tf
@@ -19,6 +20,7 @@ mylist = [1]
19
  df = pd.DataFrame(columns=["Date Time","p (mbar)","T (degC)","Tpot (K)","Tdew (degC)","rh (%)","VPmax (mbar)","VPact (mbar)","VPdef (mbar)","sh (g/kg)","H2OC (mmol/mol)","rho (g/m**3)","wv (m/s)","max. wv (m/s)","wd (deg)"])
20
  os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
21
  os.environ["CUDA_VISIBLE_DEVICES"] = ""
 
22
 
23
  if ("0" == ""):
24
  uri = "https://storage.googleapis.com/tensorflow/tf-keras-datasets/jena_climate_2009_2016.csv.zip"
@@ -30,7 +32,6 @@ if ("0" == ""):
30
  st.dataframe(df)
31
 
32
  if ("0" != ""):
33
- backlogmax = 4
34
  today = datetime.date.today()
35
 
36
  ayear = int(today.strftime("%Y"))-0
@@ -38,7 +39,7 @@ if ("0" != ""):
38
  amonthday = int(today.strftime("%d"))
39
 
40
  adf = pd.DataFrame(columns=["Date Time","p (mbar)","T (degC)","Tpot (K)","Tdew (degC)","rh (%)","VPmax (mbar)","VPact (mbar)","VPdef (mbar)","sh (g/kg)","H2OC (mmol/mol)","rho (g/m**3)","wv (m/s)","max. wv (m/s)","wd (deg)"])
41
- for i in range(ayear-backlogmax,ayear,1):
42
  alink = ("https://data.weather.gov.hk/weatherAPI/opendata/opendata.php?dataType=CLMTEMP&year={}&rformat=csv&station=HKO").format(str(i))
43
  df = pd.read_csv(alink, skiprows=[0,1,2], skipfooter=3, engine='python', on_bad_lines='skip')
44
 
@@ -168,7 +169,7 @@ val_data = features.loc[train_split:]
168
  start = past + future
169
  end = start + train_split
170
 
171
- x_train = train_data[[i for i in range(7)]].values
172
  y_train = features.iloc[start:end][[1]]
173
 
174
  sequence_length = int(past / step)
@@ -176,7 +177,7 @@ x_end = len(val_data) - past - future
176
 
177
  label_start = train_split + past + future
178
 
179
- x_val = val_data.iloc[:x_end][[i for i in range(7)]].values
180
  y_val = features.iloc[label_start:][[1]]
181
 
182
  dataset_val = keras.preprocessing.timeseries_dataset_from_array(
@@ -226,4 +227,4 @@ def plot():
226
  fig = plot()
227
  st.pyplot(fig)
228
 
229
- # %%
 
1
+
2
  #%%
3
  from matplotlib.pyplot import title
4
  import tensorflow as tf
 
20
  df = pd.DataFrame(columns=["Date Time","p (mbar)","T (degC)","Tpot (K)","Tdew (degC)","rh (%)","VPmax (mbar)","VPact (mbar)","VPdef (mbar)","sh (g/kg)","H2OC (mmol/mol)","rho (g/m**3)","wv (m/s)","max. wv (m/s)","wd (deg)"])
21
  os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
22
  os.environ["CUDA_VISIBLE_DEVICES"] = ""
23
+ mybacklogmax = 4
24
 
25
  if ("0" == ""):
26
  uri = "https://storage.googleapis.com/tensorflow/tf-keras-datasets/jena_climate_2009_2016.csv.zip"
 
32
  st.dataframe(df)
33
 
34
  if ("0" != ""):
 
35
  today = datetime.date.today()
36
 
37
  ayear = int(today.strftime("%Y"))-0
 
39
  amonthday = int(today.strftime("%d"))
40
 
41
  adf = pd.DataFrame(columns=["Date Time","p (mbar)","T (degC)","Tpot (K)","Tdew (degC)","rh (%)","VPmax (mbar)","VPact (mbar)","VPdef (mbar)","sh (g/kg)","H2OC (mmol/mol)","rho (g/m**3)","wv (m/s)","max. wv (m/s)","wd (deg)"])
42
+ for i in range((ayear-mybacklogmax),ayear,1):
43
  alink = ("https://data.weather.gov.hk/weatherAPI/opendata/opendata.php?dataType=CLMTEMP&year={}&rformat=csv&station=HKO").format(str(i))
44
  df = pd.read_csv(alink, skiprows=[0,1,2], skipfooter=3, engine='python', on_bad_lines='skip')
45
 
 
169
  start = past + future
170
  end = start + train_split
171
 
172
+ x_train = train_data[[i for i in range(mybacklogmax)]].values
173
  y_train = features.iloc[start:end][[1]]
174
 
175
  sequence_length = int(past / step)
 
177
 
178
  label_start = train_split + past + future
179
 
180
+ x_val = val_data.iloc[:x_end][[i for i in range(mybacklogmax)]].values
181
  y_val = features.iloc[label_start:][[1]]
182
 
183
  dataset_val = keras.preprocessing.timeseries_dataset_from_array(
 
227
  fig = plot()
228
  st.pyplot(fig)
229
 
230
+ # %%