Beispiel #1
0
def f_widget_std_names(server, valid_standard_names):
    """Create a dropdown menu widget with all the valid standard_name values found"""
    widget_std_names = ipyw.Dropdown(
        options=valid_standard_names,
        value=server.get("standard_name"),
    )
    return widget_std_names
Beispiel #2
0
def f_widget_plot_stop_time(server):
    """Create a text widget to enter the search maximum time for the time series plot"""
    widget_plot_stop_time = ipyw.Text(
        value=server.get("max_time").to_datetime_string(),
        description="Plot Max",
        disabled=False,
    )
    return widget_plot_stop_time
Beispiel #3
0
def f_widget_search_max_time(server):
    """Create a text widget to enter the search maximum time for the datasets search"""
    widget_search_max_time = ipyw.Text(
        value=server.get("max_time").to_datetime_string(),
        description="Search Max",
        disabled=False,
    )
    return widget_search_max_time
Beispiel #4
0
def widget_search_button_handler(change):
    """The widget_search_button_handler function updates the map when the
    Update Search button is selected"""
    from erddap_app.layout import (
        e,
        map,
        server,
        widget_dsnames,
        widget_search_max_time,
        widget_search_min_time,
        widget_std_names,
    )

    min_time = pendulum.parse(widget_search_min_time.value)
    max_time = pendulum.parse(widget_search_max_time.value)

    standard_name = widget_std_names.value

    features, datasets = stdname2geojson(
        e,
        standard_name,
        server.get("cdm_data_type"),
        min_time,
        max_time,
        server.get("skip_datasets"),
    )

    feature_layer = ipyl.GeoJSON(data=features)
    constraints = {"time>=": min_time, "time<=": max_time}
    # feature_layer.on_click(map_click_handler)
    map.layers = [map.layers[0], feature_layer]

    dataset_id = datasets[0]
    widget_dsnames.options = datasets
    widget_dsnames.value = dataset_id

    update_timeseries_plot(
        e,
        dataset=dataset_id,
        standard_name=standard_name,
        constraints=constraints,
    )