Example #1
0
def handle_interactive(lon, lat):
    while True:
        choice = input('Do you want to overlay or have adjacent plots?\n'
                       'Warning: if overlay is selected the lateral axis '
                       'is in common. [O/a] (q for exiting) ')
        if choice in ('O', 'o', 'overlay', 'Overlay', ''):
            hv_climvis_plot = ig.ClimvisHVPlot(lon, lat, overlay=True)
            break
        elif choice in ('A', 'a', 'Adjacent', 'adjacent'):
            hv_climvis_plot = ig.ClimvisHVPlot(lon, lat, overlay=False)
            break
        elif choice in ('Q', 'q'):
            sys.exit()

    while True:
        choice = input('Do you want to proceed with the plotting?\n'
                       'Warning: a new webpage will be opened. Retrieving data'
                       ' might take a while so please be patient.\n'
                       'Warning: a blank plot might mean you are over '
                       'the ocean.\n\n'
                       'Proceed? [Y/n] ')
        if choice in ('Y', 'y', 'Yes', 'yes', ''):
            print('For exiting use KeyboardInterrupt\n')
            hv_climvis_plot.server_show()
            sys.exit()
        elif choice in ('N', 'n', 'No', 'no', 'Q', 'q', 'Quit', 'quit'):
            sys.exit()
Example #2
0
    def test_temperature(self):
        with pytest.raises(ValueError,
                           match="Latitude in ClimvisHVPlot.temperature is "
                           "out of bounds."):
            climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
            climvis_hv_plot.temperature(0, 250)

        climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
        assert (type(climvis_hv_plot.temperature(0,
                                                 0)) == hv.element.chart.Curve)
Example #3
0
    def test_precipitation(self):
        with pytest.raises(ValueError,
                           match="Latitude in ClimvisHVPlot.precipitation is "
                           "out of bounds."):
            climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
            climvis_hv_plot.precipitation(0, 250)

        climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
        assert (type(climvis_hv_plot.precipitation(
            0, 0)) == hv.element.chart.Bars)
Example #4
0
    def test_reinitialize(self):
        with pytest.raises(ValueError,
                           match="Latitude in ClimvisHVPlot.reinitialize is "
                           "out of bounds."):
            climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
            climvis_hv_plot.reinitialize(0, 250, False)

        climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
        climvis_hv_plot.reinitialize(10, 45, True)
        assert climvis_hv_plot._lon == 10
        assert climvis_hv_plot._lat == 45
        assert climvis_hv_plot._overlay
Example #5
0
    def test_combined(self):
        with pytest.raises(ValueError,
                           match="Latitude in ClimvisHVPlot.combined is "
                           "out of bounds."):
            climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
            climvis_hv_plot.combined(0, 250)

        climvis_hv_plot = ig.ClimvisHVPlot(0, 0, overlay=False)
        assert (type(climvis_hv_plot.combined(0, 0)) == hv.core.layout.Layout)

        climvis_hv_plot.reinitialize(0, 0, overlay=True)
        assert (type(climvis_hv_plot.combined(0,
                                              0)) == hv.core.overlay.Overlay)
Example #6
0
    def test__init__(self):

        with pytest.raises(ValueError,
                           match="Latitude in ClimvisHVPlot.__init__ is out "
                           "of bounds."):
            climvis_hv_plot = ig.ClimvisHVPlot(0, 250)

        climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
        assert climvis_hv_plot._lon == 0
        assert climvis_hv_plot._lat == 0
        assert not climvis_hv_plot._overlay

        climvis_hv_plot = ig.ClimvisHVPlot(0, 0, overlay=True)
        assert climvis_hv_plot._lon == 0
        assert climvis_hv_plot._lat == 0
        assert climvis_hv_plot._overlay
Example #7
0
    def test_app(self):
        climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
        assert (type(
            climvis_hv_plot.app) == bokeh.application.application.Application)


# TODO: test_server_show needed.
Example #8
0
 def test_dmap(self):
     climvis_hv_plot = ig.ClimvisHVPlot(0, 0)
     assert type(climvis_hv_plot.dmap) == hv.core.spaces.DynamicMap