{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "import rasterio as rio\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from rasterio.plot import show\n", "from numpy.random import choice\n", "import geopandas as gpd\n", "import earthpy as et\n", "import datetime as dt" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.display import HTML\n", "\n", "HTML('''\n", "\n", "
''')\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "sjer_plot_locations = gpd.read_file('/home/vdo/Downloads/September_2018_Cargo_Tracks.shp')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(533577, 28)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sjer_plot_locations.shape" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
OBJECTIDTRACKIDMMSIELP_SECST_DATEEN_DATESOGPT1SOGPT2AVG_SOGDISTSPDKTS...Fuel_TypeFuel_CategOil_Cargo_Oil_Cargo1Fuel_CapacOil_Carg_1F9Shape_LengDISTSPDKMgeometry
010.02091090005.02018-09-10 22:42:232018-09-10 22:42:2811.711.811.87.2...Low Sulfur Fuel OilHeavy FloaterN/AN/A=1.81*10^6+(-5713*Length)+(5.92*Length)^2'N/ANone18.51048722LINESTRING (1009186.073899999 331727.304199999...
121.020910900053.02018-09-10 22:42:282018-09-10 22:43:2111.811.911.911.9...Low Sulfur Fuel OilHeavy FloaterN/AN/A=1.81*10^6+(-5713*Length)+(5.92*Length)^2'N/ANone324.50801522LINESTRING (1009201.6467 331737.3104999997, 10...
232.0209109000169.02018-09-10 22:43:212018-09-10 22:46:1011.911.911.912.1...Low Sulfur Fuel OilHeavy FloaterN/AN/A=1.81*10^6+(-5713*Length)+(5.92*Length)^2'N/ANone1048.43025022LINESTRING (1009483.9781 331897.2930999994, 10...
343.020910900046.02018-09-10 22:46:102018-09-10 22:46:5611.912.112.012.1...Low Sulfur Fuel OilHeavy FloaterN/AN/A=1.81*10^6+(-5713*Length)+(5.92*Length)^2'N/ANone285.78402422LINESTRING (1010401.274499999 332405.006899999...
454.02091090009.02018-09-10 22:46:562018-09-10 22:47:0512.112.012.110.7...Low Sulfur Fuel OilHeavy FloaterN/AN/A=1.81*10^6+(-5713*Length)+(5.92*Length)^2'N/ANone49.51663522LINESTRING (1010648.4014 332548.5366999991, 10...
\n", "

5 rows × 28 columns

\n", "
" ], "text/plain": [ " OBJECTID TRACKID MMSI ELP_SEC ST_DATE \\\n", "0 1 0.0 209109000 5.0 2018-09-10 22:42:23 \n", "1 2 1.0 209109000 53.0 2018-09-10 22:42:28 \n", "2 3 2.0 209109000 169.0 2018-09-10 22:43:21 \n", "3 4 3.0 209109000 46.0 2018-09-10 22:46:10 \n", "4 5 4.0 209109000 9.0 2018-09-10 22:46:56 \n", "\n", " EN_DATE SOGPT1 SOGPT2 AVG_SOG DISTSPDKTS ... \\\n", "0 2018-09-10 22:42:28 11.7 11.8 11.8 7.2 ... \n", "1 2018-09-10 22:43:21 11.8 11.9 11.9 11.9 ... \n", "2 2018-09-10 22:46:10 11.9 11.9 11.9 12.1 ... \n", "3 2018-09-10 22:46:56 11.9 12.1 12.0 12.1 ... \n", "4 2018-09-10 22:47:05 12.1 12.0 12.1 10.7 ... \n", "\n", " Fuel_Type Fuel_Categ Oil_Cargo_ Oil_Cargo1 \\\n", "0 Low Sulfur Fuel Oil Heavy Floater N/A N/A \n", "1 Low Sulfur Fuel Oil Heavy Floater N/A N/A \n", "2 Low Sulfur Fuel Oil Heavy Floater N/A N/A \n", "3 Low Sulfur Fuel Oil Heavy Floater N/A N/A \n", "4 Low Sulfur Fuel Oil Heavy Floater N/A N/A \n", "\n", " Fuel_Capac Oil_Carg_1 F9 Shape_Leng \\\n", "0 =1.81*10^6+(-5713*Length)+(5.92*Length)^2' N/A None 18.510487 \n", "1 =1.81*10^6+(-5713*Length)+(5.92*Length)^2' N/A None 324.508015 \n", "2 =1.81*10^6+(-5713*Length)+(5.92*Length)^2' N/A None 1048.430250 \n", "3 =1.81*10^6+(-5713*Length)+(5.92*Length)^2' N/A None 285.784024 \n", "4 =1.81*10^6+(-5713*Length)+(5.92*Length)^2' N/A None 49.516635 \n", "\n", " DISTSPDKM geometry \n", "0 22 LINESTRING (1009186.073899999 331727.304199999... \n", "1 22 LINESTRING (1009201.6467 331737.3104999997, 10... \n", "2 22 LINESTRING (1009483.9781 331897.2930999994, 10... \n", "3 22 LINESTRING (1010401.274499999 332405.006899999... \n", "4 22 LINESTRING (1010648.4014 332548.5366999991, 10... \n", "\n", "[5 rows x 28 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sjer_plot_locations.head()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OBJECTID\n", "TRACKID\n", "MMSI\n", "ELP_SEC\n", "ST_DATE\n", "EN_DATE\n", "SOGPT1\n", "SOGPT2\n", "AVG_SOG\n", "DISTSPDKTS\n", "SEG_LEN_KM\n", "COARSE_TYP\n", "SIMPLE_TYP\n", "IMO\n", "LENGTH\n", "OBJECTID_1\n", "AIS_Numeri\n", "AIS_Shipty\n", "Fuel_Type\n", "Fuel_Categ\n", "Oil_Cargo_\n", "Oil_Cargo1\n", "Fuel_Capac\n", "Oil_Carg_1\n", "F9\n", "Shape_Leng\n", "DISTSPDKM\n", "geometry\n" ] } ], "source": [ "for c in sjer_plot_locations.columns:\n", " print(c)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 LINESTRING (1009186.073899999 331727.304199999...\n", "1 LINESTRING (1009201.6467 331737.3104999997, 10...\n", "2 LINESTRING (1009483.9781 331897.2930999994, 10...\n", "3 LINESTRING (1010401.274499999 332405.006899999...\n", "4 LINESTRING (1010648.4014 332548.5366999991, 10...\n", " ... \n", "533572 LINESTRING (1240605.2652 356043.8478999995, 12...\n", "533573 LINESTRING (1240771.4081 355933.5546000004, 12...\n", "533574 LINESTRING (1242768.457699999 354447.005799999...\n", "533575 LINESTRING (1244290.4827 353259.1302000005, 12...\n", "533576 LINESTRING (1247415.304400001 350791.126800000...\n", "Name: geometry, Length: 533577, dtype: object" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sjer_plot_locations.geometry" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "" ], "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sjer_plot_locations.geometry[0]" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "shapely.geometry.linestring.LineString" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(sjer_plot_locations.geometry[0])" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[(1009186.0738999993, 331727.3041999992),\n", " (1009201.6467000004, 331737.3104999997)]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sjer_plot_locations.geometry[0].coords[:]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 4 }