def disasternamesgetter(): global df_dis try: df_dis = ResilDashboard.FEMADisasters(statewidget.value) disaster_list = list(set(df_dis.title)) disaster_list.append('All') disasterwidget.options = disaster_list disasterwidget.value = 'All' except Exception: disasterwidget.options = ['All'] disasterwidget.value = 'All'
def filterrunner(stateinput, zipinput, searchinput): grid = ResilDashboard.DsireFilterer(dsire, stateinput, zipinput, searchinput) grid.set_index('Program Name', inplace=True) grid = grid[[ 'Implementing Sector', 'Program Category', 'Program Type', 'Technology Type', 'Energy Category' ]] col_options = { 'width': 80, } col_defs = { 'Program Name': { 'width': 400, } } qgrid_widget = qgrid.show_grid(grid, column_options=col_options, column_definitions=col_defs, show_toolbar=False) display(qgrid_widget) disasternamesgetter()
def gasrunner(stateinput, zipinput): plot = ResilDashboard.ElectricityorGasPlotter(state=stateinput, zipcode=zipinput, resource='Gas') display(HTML(plot))
def maprunner(stateinput, disasterinput): html = ResilDashboard.FEMAMapper(state=stateinput, disaster_name=disasterinput, df_dis=df_dis) display(HTML(html))
def ratesrunner(stateinput): plot = ResilDashboard.UtilityRatesPlotter(state=stateinput) display(HTML(plot))
def resourcemixrunner(stateinput): plot = ResilDashboard.ResourceMixPlotter(state=stateinput) display(HTML(plot))
import ResilDashboard import warnings import qgrid warnings.filterwarnings("ignore") from IPython.core.display import display, HTML display(HTML("<style>.container { width:85% !important; }</style>")) display( HTML( "<style>.output_wrapper, .output {height:auto !important; max-height:5000px;}.output_scroll {box-shadow:none !important; webkit-box-shadow:none !important;}</style>" )) style = {'description_width': '150px'} layout = {'width': '300px'} dsire = ResilDashboard.NewDsireChecker() def dsirelinkapplier(row): id_ = row.id name_ = row['Program Name'] link = f'<a href = "http://programs.dsireusa.org/system/program/detail/{id_}" target="_blank">{name_}</a>' return link dsire['Program Name'] = dsire.apply(dsirelinkapplier, axis=1) states = sorted(list(set(dsire['State']))) statewidget = widgets.Select(options=states, value='Florida',