{"cells":[{"metadata":{"_uuid":"091d1fedf6386d3cac0f999a7e4a8b2ca10ec6be"},"cell_type":"markdown","source":"Using [YourVenn's script](https://www.kaggle.com/c/humpback-whale-identification/discussion/78464), I grabbed the Exif data from the images to see if there was anything usefull.\n\nI saw that some of the images had GPS information. I thought that there might be some correlation between spotting locations and new vs not-new whales. I don't know if it is worth using (or alowed), but it is a nice novel plaything, good for atleast 5 minutes, so I figured it was worth a share.\n\nNote: Going from original GPS data degree-minute-seconds to decimal might have some small rounding error, so having whales spotted a few hundred meters inland is completely viable."},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import plotly\nimport plotly.plotly as py\nimport plotly.graph_objs as go\nimport pandas as pd\nimport numpy as np\nplotly.offline.init_notebook_mode()","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"whales = pd.read_csv('../input/whalegps/train_gps_info.csv')\nwhales.head(2)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"dc3804011a8dc6babd0bfb5c6c844f2e3ad7a434"},"cell_type":"raw","source":"*from plotly*\nSets the latitude coordinates (in degrees North).\nSets the longitude coordinates (in degrees East).\n******\n\n12.55° N     is the same as   +12.55°\n52.12° S     is the same as   - 52.12°\n\n12.55° E     is the same as   +12.55°\n52.12° W     is the same as   - 52.12°"},{"metadata":{"trusted":true,"_uuid":"ac324267651e0e282b80079279c4af5ce9cd7b07"},"cell_type":"code","source":"lng_plt = []\nlat_plt = []\nfor i in range(len(whales)):\n    # latitude\n    if whales.latDMSRef.iloc[i]==\"N\":\n        lat_plt+=[whales.latDD.iloc[i]]\n    else:\n        lat_plt+=[whales.latDD.iloc[i]* -1]\n    \n    # longitude\n    if whales.lngDMSRef.iloc[i]==\"E\":\n        lng_plt+=[whales.lngDD.iloc[i]]\n    else:\n        lng_plt+=[whales.lngDD.iloc[i]* -1] ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c5a9d25ccce19d33e9f403693415de80a88b298e"},"cell_type":"code","source":"whales[\"lat\"]=lat_plt\nwhales[\"lng\"]=lng_plt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9e6833696c5417ccb324a7030da2ce10afca13a5"},"cell_type":"code","source":"whales.head(2)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a3038fb46c464f3e1c4f0d73d62645505079eabb"},"cell_type":"code","source":"new_whales = whales[whales[\"Id\"]==\"new_whale\"]\nprint(len(new_whales))\nnew_coords = pd.concat([new_whales['lat'], new_whales['lng'], new_whales['Id']], axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9748df69408c1baf01a19f861e8cdea07e3ed0c1"},"cell_type":"code","source":"known_whales = whales[whales[\"Id\"]!=\"new_whale\"]\nprint(len(known_whales))\nknown_coords = pd.concat([known_whales['lat'], known_whales['lng'], known_whales['Id']], axis=1)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"3650d48d6b39d17f5d2343d0d58985d9f79690e3"},"cell_type":"raw","source":"green: 'rgb(0,128,0)'\nred  : 'rgb(255,0,0)'"},{"metadata":{"trusted":true,"_uuid":"a3382ad2b106fe429ce526a3d2f4f605a7c51dc4"},"cell_type":"code","source":"cases=[]\n\n# known whales\ncases.append(go.Scattergeo(\n    lon = known_coords['lng'],\n    lat = known_coords['lat'],\n    mode = 'markers',\n    marker = dict(\n         size = 5,\n         color = 'rgb(0,128,0)', # green\n         opacity = 0.8,\n         line = dict(width = 1.5))))\n             \n# new whales\ncases.append(go.Scattergeo(\n    lon = new_coords['lng'],\n    lat = new_coords['lat'],\n    mode = 'markers',\n    marker = dict(\n         size = 5,\n         color = 'rgb(255,0,0)', # red \n         opacity = 0.8,\n         line = dict(width = 1.5))))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"33b774aeded56184aac05d28e2d1ba093595ea3b"},"cell_type":"code","source":"layout = go.Layout(\n    title = 'Humpback Whale - Exif data',\n    autosize=False,\n    width=900,\n    height=700,\n    margin=dict(\n        t=30,\n        b=10, \n        l=5, \n        r=5),\n    geo = dict(\n        resolution = 110,\n        scope = 'world',\n        showframe = True,\n        showcoastlines = True,\n        showland = True,\n        landcolor = \"rgb(229, 229, 229)\",\n        countrycolor = \"rgb(255, 255, 255)\" ,\n        coastlinecolor = \"rgb(255, 255, 255)\",\n        projection = dict(\n            type = 'mercator'\n        )))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1bb73ad08c981fc76e002447e742f60dc5997e94"},"cell_type":"code","source":"fig = go.Figure(layout=layout, data=cases)\nplotly.offline.iplot(fig, filename='whaleSpottings')","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}