import sys
import pandas as pd
import geopandas as gpd
import fiona 
import geoviews as gv
import geoviews.feature as gf
import holoviews as hv
from bokeh.models import HoverTool
# Adds %%opts line magic for bokeh plot config
hv.extension('bokeh')
import hvplot.pandas
from holoviews import streams
from holoviews import opts
import panel as pn
pn.extension()
#import utility as u
import numpy as np
import datetime
import colorcet as cc
import param
#import cartopy
#from cartopy import crs
import datetime

hv.output(widget_location='bottom')

df = pd.read_csv('data/Deck195_CleanID.csv',parse_dates=True,dtype={'ID':str,'ID_clean':str,'ID_pre':str},index_col='time')
df_subsettime = df['1945-02-01':'1945-04-30']
sst_subset = df_subsettime[['latitude','longitude','SST','ID','ID_pre']]
sst_subset.dropna(inplace=True)
sst_subset.reset_index(inplace=True)
/Users/bell/miniconda3/envs/holoviz/lib/python3.7/site-packages/pandas/util/_decorators.py:311: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  return func(*args, **kwargs)

Plot all identified Ship Class ID’s and color code by SST

sst = gv.Dataset(sst_subset,['ID','SST','time'])
tiles = gv.tile_sources.EsriTerrain
points = sst.to(gv.Points, ['longitude', 'latitude'], ['SST','ID','time'])
tiles * points.opts(
    color='SST', cmap='reds',
    tools=['hover'], global_extent=False, width=800, height=600, colorbar=True, title='crimea')
/Users/bell/miniconda3/envs/holoviz/lib/python3.7/site-packages/cartopy/crs.py:825: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the  number of parts of a multi-part geometry.
  if len(multi_line_string) > 1:
/Users/bell/miniconda3/envs/holoviz/lib/python3.7/site-packages/cartopy/crs.py:877: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
  for line in multi_line_string:
/Users/bell/miniconda3/envs/holoviz/lib/python3.7/site-packages/cartopy/crs.py:944: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the  number of parts of a multi-part geometry.
  if len(p_mline) > 0:
/Users/bell/miniconda3/envs/holoviz/lib/python3.7/site-packages/cartopy/crs.py:825: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the  number of parts of a multi-part geometry.
  if len(multi_line_string) > 1:
/Users/bell/miniconda3/envs/holoviz/lib/python3.7/site-packages/cartopy/crs.py:877: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
  for line in multi_line_string:
/Users/bell/miniconda3/envs/holoviz/lib/python3.7/site-packages/cartopy/crs.py:944: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the  number of parts of a multi-part geometry.
  if len(p_mline) > 0: