示例#1
0
def updateWeatherImagePage(n_intervals, id, value):
    #print("+++++++++++++updateWImageP n_intervals", n_intervals)
    #print("+++++++++++++updateWImageP (n_intervals %6)", n_intervals% 6)
    if ((n_intervals %
         (1 * 6)) == 0) or (n_intervals == 0):  # 1 minutes -10 second timer
        print("--->>>updateSkyCamImage", datetime.datetime.now(), n_intervals)
        try:
            '''
            # delete old file names

            fileList = glob.glob("/home/pi/SDL_Pi_SkyWeather2/dash_app/assets/imagedisplay*")
            # Iterate over the list of filepaths & remove each file.
            for filePath in fileList:
                    os.remove(filePath)
                        
            # build names
            basename = "imagedisplay"+str(n_intervals)+".jpg?"
            htmlname =  "/assets/"+ basename
            newname = "/home/pi/SDL_Pi_SkyWeather2/dash_app/assets/"+basename 
            # move camera file to new name
            shutil.copy('/home/pi/SDL_Pi_SkyWeather2/dash_app/assets/skycamera.jpg', newname)

            '''
            htmlname = "/assets/skycamera.jpg?"
            value = html.Div([
                html.Img(height=350, width=350 * 1.77, src=htmlname),
                #html.Figcaption("SkyWeather2 Cam"),
                html.Figcaption(htmlname)
            ])
            print("+++++++value=", value)

        except:
            print(traceback.format_exc())
            print("camera file not found")
            htmlname = "/assets/SW2Textcolor.png"
            value = html.Div([
                html.Img(height=150, width=150 * 2.86, src=htmlname),
                html.Figcaption("SkyWeather2 Cam"),
            ])

            pass

    else:
        raise PreventUpdate
    return [value]
示例#2
0
 def show_figure(children, caption=None):
     if not isinstance(children, list):
         children = [children]
     if caption:
         children = [
             html.Figcaption(className='mv2 pa0 f4 header-font b',
                             children=caption)
         ] + children
     return html.Figure(className='mh0 mv4 pa0', children=children)
示例#3
0
def chart_title(title, subtitle=None, description=None):
    return html.Figcaption(
        className='',
        children=[
            html.H2(className='results-page__body__section-title',
                    children=title),
            (html.P(className='results-page__body__section-subtitle',
                    children=subtitle) if subtitle else None),
            (dcc.Markdown(className='results-page__body__section-description',
                          children=description) if description else None),
        ])
示例#4
0
def create_dash_launcher(dash_name):
    """
    Generate an individual Dash launcher element. This element
    exposes the "description", "thumbnail" and "name" elements of 
    a dash app's metadata and launches them in a new browser window
    """
    dash = dash_meta[dash_name]
    return html.Figure(className="gallery__item",
                       children=[
                           html.H2(html.A(
                               dash["name"],
                               className="gallery__item-link u-stretched-link",
                               target="_blank",
                               href="{}/".format(dash_name)),
                                   className="gallery__item-title"),
                           html.Img(src=app.get_asset_url(
                               thumbnail_path(dash_name, dash["thumbnail"])),
                                    className="gallery__item-figure"),
                           html.Figcaption(dash["description"],
                                           className="gallery__item-desc")
                       ])
示例#5
0
def render_tab_content(tab):
    if tab == "state-positive":
        return html.Div([
            html.Div([
                html.H2("States over Time"),
                dcc.Dropdown(id="states",
                            options=[{'label':i,'value':i} for i in data["state"].unique()],
                            value = ["MD"],
                            multi=True),
                dcc.RadioItems(
                    id='yaxis-type',
                    options=[{'label': i, 'value': i} for i in ['linear', 'log']],
                    value='linear',
                    labelStyle={'display': 'inline-block'}),
                dcc.Dropdown(
                    id='xaxis-value',
                    options=[{'label':i[0],'value':i[1]} for i in plot_values.items()],
                    value="positive",
                    multi=False
                )
                ],
                style = {'width':'25%'}
                ),
            html.Div([
                html.Div([
                    dcc.Graph(id="state-pos-fig")
                    ],
                    style = {"width":"60%","float":"center","display":"inline-block"}),
                html.Div([
                    html.Figcaption(["this is a test figure caption.  State positive tests as reported by ... "])],
                    style= {"width":"40%","float":"right","display":"inline-block"})
            ])
        ])

    elif tab == "us-state-map":
        return html.Div([
            html.H2("State Heatmap of Positive Tests"),
            dcc.Graph(id="us-state-map-fig",figure=state_map_fig)])
示例#6
0
                            html.Th(children='Last name'),
                            html.Th(children='Birth Date'),
                            html.Th(children='Is the person disabled ?')
                        ]),
                        html.Tr(id='person-data')
                    ])

                ]
            ),

        ]),
        html.Figure(children=[
            html.Img(src='/assets/feet.png',
                     style={'textAlign': 'center'}
                     ),
            html.Figcaption('Sensors placement on feet'),
        ],
            style={'textAlign': 'center'}
        ),
    ], style={'columnCount': 2}),
    html.H2(children='Live Walking View',
            style={
                'textAlign': 'center'
            }),
    dcc.Graph(
        id='example-graph',
        animate=True
    ),
    html.H2(children='Historic Data Viewer',
            style={
                'textAlign': 'center'
示例#7
0
                    'label': 'Katie Couric',
                    'value': 'Katie_Couric.csv'
                }, {
                    'label': 'Vicki Zhao Wei',
                    'value': 'Vicki_Zhao_Wei.csv'
                }],
                               value='LeBron_James.csv',
                               id='subject_options')
            ],
                     id='subject'),

            # creates divs for images
            html.Div([
                html.Div([
                    html.Img(id='img1'),
                    html.Figcaption(id='name1'),
                    html.Figcaption(id='sim1')
                ],
                         id='result1',
                         className='result1'),
                html.Div([
                    html.Img(id='img2'),
                    html.Figcaption(id='name2'),
                    html.Figcaption(id='sim2')
                ],
                         id='result2',
                         className='result2'),
                html.Div([
                    html.Img(id='img3'),
                    html.Figcaption(id='name3'),
                    html.Figcaption(id='sim3')
示例#8
0
     "Tabela do SUS",
     href="http://sigtap.datasus.gov.br/tabela-unificada/app/sec/inicio.jsp",
 ),
 html.
 P("Para a classificação de atendimentos como excessivos nós partimos da constatação de que, "
   "para quase todos os alvos que estudamos, a distribuição das "
   "taxas de atendimento por habitante observadas nos municípios "
   "ajusta-se bem a uma distribuição log-normal, como os  exemplos mostrados na Figura 1."
   ),
 html.Figure([
     html.Img(
         src="./assets/ajuste_LogNormal.png",
         width="70%",
         #                         height=400,
         className="figBorderCenter"),
     html.Figcaption("Figura 1", style={"text-align": "center"})
 ]),
 html.P("Isso nos permitiu definir, para qualquer alvo "
        "e para qualquer município, um ponto de corte para o que "
        "consideramos como normal ou anormal em uma taxa de "
        "atendimentos por habitante."),
 html.
 P('Decidimos então arbitrar que taxas de atendimento por '
   'habitante serão consideradas anormais quando se situarem '
   'à direita do ponto que divide a área sob a curva em '
   'uma parte “normal”, com 99% de probabilidade; e em uma '
   'parte “anormal”, com 1% de probabilidade. Esse limiar de '
   'anormalidade que escolhemos poderá ser ajustado para mais ou para menos, '
   'em função de resultados de auditorias que eventualmente sejam realizadas '
   'por órgãos de controle.'),
 html.Figure([
示例#9
0
def WeatherPage():
    global CWJSON
    maintextsize = "2.0em"
    subtextcolor = "green"
    maintextcolor = "black"

    print("WP-CWSJON=", CWJSON)
    Row1 = html.Div([
        #dbc.Row( dbc.Col(html.Div(id="Weather Instruments"))),
        dbc.Row(
            dbc.Col(
                html.Div(
                    html.H6(id={
                        'type': 'WPdynamic',
                        'index': "StringTime"
                    },
                            children="Weather Instruments")))),
        dbc.Row(
            [
                dbc.Col(
                    html.Div(
                        [
                            html.Div(
                                [
                                    html.H1(id={
                                        'type': 'WPdynamic',
                                        'index': "OutdoorTemperature"
                                    },
                                            children=str(
                                                CWJSON["OutdoorTemperature"]) +
                                            TUnits(),
                                            style={
                                                "font-size": maintextsize,
                                                "color": maintextcolor
                                            }),
                                    #children=str(round(CTUnits(CWJSON["OutdoorTemperature"]),1))+TUnits(), style={"font-size": maintextsize,"color":maintextcolor}),
                                    html.P("Outdoor Temperature",
                                           style={"color": subtextcolor})
                                ],
                                id="ot1",
                                className="mini_container",
                            ),
                            html.Div(
                                [
                                    html.H1(
                                        id={
                                            'type': 'WPdynamic',
                                            'index': "OutdoorHumidity"
                                        },
                                        children=str(
                                            round(CWJSON["OutdoorHumidity"],
                                                  1)) + " %",
                                        style={
                                            "font-size": maintextsize,
                                            "color": maintextcolor
                                        }),
                                    html.P("Outdoor Humidity",
                                           style={"color": subtextcolor})
                                ],
                                id="ot1",
                                className="mini_container",
                            ),
                            html.Div(
                                [
                                    html.H1(id={
                                        'type': 'WPdynamic',
                                        'index': "IndoorTemperature"
                                    },
                                            children=str(
                                                CWJSON["IndoorTemperature"]) +
                                            TUnits(),
                                            style={
                                                "font-size": maintextsize,
                                                "color": maintextcolor
                                            }),
                                    html.P("Indoor Temperature",
                                           style={"color": subtextcolor})
                                ],
                                id="ot1",
                                className="mini_container",
                            ),
                            html.Div(
                                [
                                    html.H1(id={
                                        'type': 'WPdynamic',
                                        'index': "IndoorHumidity"
                                    },
                                            children=str(
                                                round(CWJSON["IndoorHumidity"],
                                                      1)) + " %",
                                            style={
                                                "font-size": maintextsize,
                                                "color": maintextcolor
                                            }),
                                    html.P("Indoor Humidity",
                                           style={"color": subtextcolor})
                                ],
                                id="ot1",
                                className="mini_container",
                            ),
                            html.Div(
                                [
                                    html.H1(
                                        id={
                                            'type': 'WPdynamic',
                                            'index': "SunlightVisible"
                                        },
                                        children=str(
                                            round(CWJSON["SunlightVisible"])) +
                                        " lux",
                                        style={
                                            "font-size": maintextsize,
                                            "color": maintextcolor
                                        }),
                                    html.P("Sunlight",
                                           style={"color": subtextcolor})
                                ],
                                id="ot1",
                                className="mini_container",
                            ),
                        ], ),
                    width=3,
                ),
                dbc.Col(
                    html.Div([
                        html.Div(
                            [
                                html.H1(id={
                                    'type': 'WPdynamic',
                                    'index': "BarometricPressureSeaLevel"
                                },
                                        children=str(CWJSON[
                                            "BarometricPressureSeaLevel"]) +
                                        BUnits(),
                                        style={
                                            "font-size": maintextsize,
                                            "color": maintextcolor
                                        }),
                                html.P("Barometric Pressure",
                                       style={"color": subtextcolor})
                            ],
                            id="ot1",
                            className="mini_container",
                        ),
                        html.Div(
                            [
                                html.H1(id={
                                    'type': 'WPdynamic',
                                    'index': "WindSpeed"
                                },
                                        children=str(CWJSON["WindSpeed"]) +
                                        WUnits(),
                                        style={
                                            "font-size": maintextsize,
                                            "color": maintextcolor
                                        }),
                                html.P("Wind Speed",
                                       style={"color": subtextcolor})
                            ],
                            id="ot1",
                            className="mini_container",
                        ),
                        html.Div(
                            [
                                html.H1(id={
                                    'type': 'WPdynamic',
                                    'index': "WindGust"
                                },
                                        children=str(CWJSON["WindGust"]) +
                                        WUnits(),
                                        style={
                                            "font-size": maintextsize,
                                            "color": maintextcolor
                                        }),
                                html.P("Wind Gust",
                                       style={"color": subtextcolor})
                            ],
                            id="ot1",
                            className="mini_container",
                        ),
                        html.Div(
                            [
                                html.H1(id={
                                    'type': 'WPdynamic',
                                    'index': "WindDirection"
                                },
                                        children=str(CWJSON["WindDirection"]) +
                                        " deg",
                                        style={
                                            "font-size": maintextsize,
                                            "color": maintextcolor
                                        }),
                                html.P("Wind Direction",
                                       style={"color": subtextcolor})
                            ],
                            id="ot1",
                            className="mini_container",
                        ),
                        html.Div(
                            [
                                html.H1(id={
                                    'type': 'WPdynamic',
                                    'index': "SunlightUVIndex"
                                },
                                        children=str(
                                            round(CWJSON["SunlightUVIndex"],
                                                  1)),
                                        style={
                                            "font-size": maintextsize,
                                            "color": maintextcolor
                                        }),
                                html.P("Sunlight UV Index",
                                       style={"color": subtextcolor})
                            ],
                            id="ot1",
                            className="mini_container",
                        ),
                    ], ),
                    width=3,
                ),
                dbc.Col(html.Div(buildCompassRose())),
            ], ),
    ])

    Row2 = html.Div([
        dbc.Row([
            dbc.Col(html.Div("Rain / Air Quality")),
        ]),
        dbc.Row([
            dbc.Col(
                html.Div([
                    html.Div(
                        [
                            html.H1(
                                id={
                                    'type': 'WPdynamic',
                                    'index': "TotalRain"
                                },
                                children=str(CWJSON["TotalRain"]) + RUnits(),
                                style={
                                    "font-size": maintextsize,
                                    "color": maintextcolor
                                }),
                            html.P("Total Rain", style={"color": subtextcolor})
                        ],
                        id="ot1",
                        className="mini_container",
                    ),
                    html.Div(
                        [
                            html.H1(id={
                                'type': 'WPdynamic',
                                'index': "CalendarDayRain"
                            },
                                    children=str(CWJSON["CalendarDayRain"]) +
                                    RUnits(),
                                    style={
                                        "font-size": maintextsize,
                                        "color": maintextcolor
                                    }),
                            html.P("Daily Rain", style={"color": subtextcolor})
                        ],
                        id="ot1",
                        className="mini_container",
                    ),
                    html.Div(
                        [
                            html.H1(id={
                                'type': 'WPdynamic',
                                'index': "CalendarMonthRain"
                            },
                                    children=str(CWJSON["CalendarMonthRain"]) +
                                    RUnits(),
                                    style={
                                        "font-size": maintextsize,
                                        "color": maintextcolor
                                    }),
                            html.P("Calendar Month",
                                   style={"color": subtextcolor})
                        ],
                        id="ot1",
                        className="mini_container",
                    ),
                    html.Div(
                        [
                            html.H1(
                                id={
                                    'type': 'WPdynamic',
                                    'index': "30DayRain"
                                },
                                children=str(CWJSON["30DayRain"]) + RUnits(),
                                style={
                                    "font-size": maintextsize,
                                    "color": maintextcolor
                                }),
                            html.P("Last 30 Days",
                                   style={"color": subtextcolor})
                        ],
                        id="ot1",
                        className="mini_container",
                    ),
                ], ),
                width=3,
            ),
            dbc.Col(
                html.Div([
                    html.Div(
                        [
                            html.H1(id={
                                'type': 'WPdynamic',
                                'index': "24HourRain"
                            },
                                    children=str(CWJSON["24HourRain"]) +
                                    RUnits(),
                                    style={
                                        "font-size": maintextsize,
                                        "color": maintextcolor
                                    }),
                            html.P("Last 24 Hours",
                                   style={"color": subtextcolor})
                        ],
                        id="ot1",
                        className="mini_container",
                    ),
                    html.Div(
                        [
                            html.H1(id={
                                'type': 'WPdynamic',
                                'index': "7DaysRain"
                            },
                                    children=str(CWJSON["7DaysRain"]) +
                                    RUnits(),
                                    style={
                                        "font-size": maintextsize,
                                        "color": maintextcolor
                                    }),
                            html.P("Last 7 Days",
                                   style={"color": subtextcolor})
                        ],
                        id="ot1",
                        className="mini_container",
                    ),
                    html.Div(
                        [
                            html.H1(id={
                                'type': 'WPdynamic',
                                'index': "AQI"
                            },
                                    children=str(CWJSON["AQI"]),
                                    style={
                                        "font-size": maintextsize,
                                        "color": maintextcolor
                                    }),
                            html.P("Current AQI",
                                   style={"color": subtextcolor})
                        ],
                        id="ot1",
                        className="mini_container",
                    ),
                    html.Div(
                        [
                            html.H1(id={
                                'type': 'WPdynamic',
                                'index': "AQI24Average"
                            },
                                    children=str(CWJSON["AQI24Average"]),
                                    style={
                                        "font-size": maintextsize,
                                        "color": maintextcolor
                                    }),
                            html.P("24 Hour AQI Average",
                                   style={"color": subtextcolor})
                        ],
                        id="ot1",
                        className="mini_container",
                    ),
                ]),
                width=3,
            ),
            dbc.Col(
                html.Div(
                    html.Figure([
                        html.Div(id={
                            'type': 'WPIdynamic',
                            'index': "SkyCamImage"
                        },
                                 children=[
                                     html.Img(height=350,
                                              width=350 * 1.77,
                                              src="/assets/skycamera.jpg"),
                                     html.Figcaption("SkyWeather Cam"),
                                 ]),
                    ]), ),
                width=6,
                align="center",
            ),
        ], ),
    ])

    # graphs
    Row3 = html.Div([
        dbc.Row([
            dbc.Col(
                [
                    buildOutdoorTemperature_Humidity_Graph(),
                    buildSunlight_UVIndex_Graph(),
                    buildAQI_Graph(),
                ],
                width=12,
            )
        ]),
    ])

    #########
    # combined layout
    #########

    layout = dbc.Container(
        [Row1, Row2, Row3],
        className="p-5",
    )
    return layout
示例#10
0
               ), ' and data scrapped from ',
             html.A('BitInfoCharts.com',
                    href='http://bitinfocharts.com'), '.'
         ])
     ]),
 html.Div(
     className='wrap',
     children=[
         html.Ul(
             className='flexblock gallery',
             children=[
                 html.Li(
                     html.A(html.Figure([
                         html.Img(src='/static/arnobio.jpeg'),
                         html.Figcaption([
                             html.H2('Arnobio Morelix'),
                             'Startup Genome'
                         ])
                     ]),
                            href=
                            'https://www.linkedin.com/in/arnobiomorelix/'
                            )),
                 html.Li(
                     html.A(
                         html.Figure(
                             [
                                 html.Img(src='/static/felipe.jpg'),
                                 html.Figcaption(
                                     [html.H2('Felipe Campos'), 'IBM'])
                             ]),
                         href='https://www.linkedin.com/in/fneiva/')),
                 html.Li(
示例#11
0
            [dbc.Label("Select One Parameter to Show in 3D View"), dropdown2]))
])
# glider tracks in map view vs transformed coordinate
track = html.Div(children=[
    dbc.Row([
        dbc.Col(dcc.Graph(id="glider_map"), className='col-6'),
        dbc.Col(dcc.Graph(id="map_tc"), className='col-6')
    ])
], )

track_caption = html.Div(children=[
    html.Figcaption(children=[
        html.H5(
            "Glider Trajectory before and after coordinate transformation"),
        html.P(
            "On the left is the glider trajectory in the original map view. "
            "On the right is the glider trajectory in transformed semi-Lagrangian Coordinate. "
            "In this coordinate, the trajectory shows glider's movement relative to the water rather than the ground. ",
        ),
    ])
])

# water velocity from glider
vel = html.Div(children=[
    dcc.Graph(id="time_series"),
])
vel_caption = html.Div(children=[
    html.Figcaption(children=[
        html.H5("Depth Averaged Water Velocity from Glider"),
        html.
        P("Under the assumption of homogenous flow, we used the depth averaged water velocity "