 political science.
A suburban-oriented Family Dollar under construction at the intersection of Kings Road and Myrtle Avenue. In a historical walkable community like New Town, the City of Jacksonville could possibly be the neighborhood's worst enemy. Like many areas of the urban core, new construction is incompatible with existing development due to large setbacks and lot coverage requirements allowed by the City. With every new incompatible development, New Town loses a little more of its historical character.
The City of Jacksonville's S-Line ROW could eventually become a commuter rail and bike trail corridor bringing economic revitalization and job creation to New Town.
Approximately 13 to 21% of New Town residents rely on public transportation to journey to work. The addition of the 2030 Mobility Plan's commuter rail line along the S-Line corridor should create significant accessibility and economic opportunities for New Town residents, college students and businesses.
A portion of the future S-Line, a recreational trail extending from Myrtle Avenue to the CSX railroad behind Norwood Plaza, has been constructed by the Jacksonville Housing Authority as part of the HOPE IV projecti. The S-Line is an urban rail-to-trail project planned for Jacksonville. This trail is sited on an abandoned stretch of CSX railroad Right-of-Way (ROW). The width of this 4.3 mile trail will be sufficient for pedestrian and bicycle traffic. The intention of this trail is not to create a destination recreational trail, but rather to offer residents of the surrounding neighborhoods an alternative to vehicle-dominated streets.
New Town is located west of downtown Jacksonville between Kings Road, Myrtle Avenue, Beaver Street and CSX's Moncrief Yard.
Article by Ennis Davis. Historical photos courtesy of Florida State Archives.# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension:.py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# %load_ext autoreload
# %autoreload 2
import os
import warnings
warnings.filterwarnings("ignore")
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import torch
from train_main import create_dataset
from train_main import pre_process
import utils
from utils import device
from models import *
import constants
from matplotlib.pyplot import savefig
import forecaster


# ## Batch Scheduler to train

# +
# ##!sbatch --gres=gpu:titanxp:1 --mem=32G run.sh
# -

# ## Test for latest data points

df = pd.read_csv('data/weatherstats_montreal_daily_inter.csv',index_col=0)
df = pre_process(df[:360], save_plots=True)

max_v = create_dataset(df[df['Year'] >= 2018], look_back=28, forecast_horizon=15, batch_size=1)

max_y_plot = []
for input_x, max_y, no_z in max_v:
    max_y_plot.append(max_y[0][0])

# +
print (len(max_y_plot))
plt.figure(figsize=(16,3.5))
plt.title("Maxima Temprature per Forecasting Horizon")
plt.xlabel("Date/Time")
plt.ylabel("Values")
plt.plot(max_y_plot,c="red",alpha=5,label='maxima temprature')

plt.legend()

# +
plt.figure(1,figsize=(7,5.5))
plt.subplot(211)
plt.title('Full time series data',fontsize=14)
plt.xlabel("Days",fontsize=14)
plt.ylabel("Values",fontsize=14)
plt.plot(df[['max_temperature']][:360],'r')


plt.subplot(212)
plt.title('Maxima Temprature per Forecasting Horizon',fontsize=14)

plt.xlabel("Forecasting Horizon",fontsize=14)
plt.ylabel("Values",fontsize=14)

plt.plot(max_y_plot[:360])

plt.tight_layout()
from matplotlib.pyplot import savefig
savefig('./plots/data_maxi.eps')

plt.show()

# -

#ax = df[['max_temperature', 'avg_hourly_temperature','avg_temperature','min_temperature']].plot(title='Full Time Series Data',fontsize=13, figsize = (7,2.5))


# ## LSTM Forecaster

ep_loss, mean, rms, lower, upper, mae, acc, test_true_y, test_pred_y = forecaster.LSTMForecaster(df)

print (rms,mae)

# +
forecast_fi = {}
fn = 0
for i in range(0, len(ep_loss), 15):
    sp = i
    ep = i + 15
    forecast_fi[fn] = ep_loss[sp:ep]
    fn+=1
    

fig, axs = plt.subplots(nrows=5, ncols=6, figsize=(20,10 ))

for ax, i in zip(axs.flat, forecast_fi):
    ax.plot(forecast_fi[i])
    ax.set_title(str(i)+"\'th Forecasting Cycle Error in oC")

plt.tight_layout()
plt.show()
# forecast_fi
# -



fig, ax = plt.subplots(figsize=(7,4))
ax.plot(np.array(test_true_y[:100]).reshape(-1),c='blue', label='GT', alpha=5)
ax.plot(mean[:100], label='Prediction', c='green', linestyle='--', alpha=5)
ax.set(title="Maxima Forecasting (LSTM)", ylabel="Max temprature", xlabel="Days") #ylim=(12.7, 13.8))
ax.legend();
savefig("plots/lstm_pred.eps")

# +
pred_fo = {}
gt_fo = {}
fn = 0
for i in range(0, len(mean), 15):
    sp = i
    ep = i + 15
    pred_fo[fn] = mean[sp:ep]
    fn+=1
fn = 0
for i in range(0, len(test_true_y), 15):
    sp = i
    ep = i + 15
    gt_fo[fn] = test_true_y[sp:ep]
    fn+=1
    

fig, axs = plt.subplots(nrows=5, ncols=6, figsize=(20,10 ))

for ax, i in zip(axs.flat, pred_fo):
    ax.plot(pred_fo[i])
    ax.plot(gt_fo[i])
    ax.set_title(str(i)+"\'th Forecasting Cycle")

plt.tight_layout()
plt.show()
savefig("plots/lstm_forecast_cycle.eps")
# -

# ## GU-LSTM Forecaster

ep_loss, mean, rms, lower, upper, mae, acc, test_true_y, test_pred_y = forecaster.LSTMGUForecaster(df)

print (rms,mae)

# +
forecast_fi = {}
fn = 0
for i in range(0, len(ep_loss), 15):
    sp = i
    ep = i + 15
    forecast_fi[fn] = ep_loss[sp:ep]
    fn+=1
    

fig, axs = plt.subplots(nrows=5, ncols=6, figsize=(20,10 ))

for ax, i in zip(axs.flat, forecast_fi):
    ax.plot(forecast_fi[i])
    ax.set_title(str(i)+"\'th Forecasting Cycle Error in oC")

plt.tight_layout()
plt.show()
# -

fig, ax = plt.subplots(figsize=(7,4))
ax.plot(np.array(test_true_y[:100]).reshape(-1),c='blue', label='GT', alpha=5)
ax.plot(mean[:100], label='Prediction', c='green', linestyle='--', alpha=5)
ax.set(title="Maxima Forecasting (GU