{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import netCDF4 as nc\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from salishsea_tools import geo_tools, nc_tools, tidetools, viz_tools\n", "import xarray as xr\n", "import datetime\n", "import pandas as pd\n", "import datetime as dt\n", "#import h5py\n", "import matplotlib.patches as patches\n", "from IPython.core.display import display, HTML\n", "display(HTML(\"\"))\n", "\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.display import HTML\n", "\n", "HTML('''\n", "
''')\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "setup = pd.DataFrame(columns = ['spill_date_hour', 'run_days', 'spill_lon', \n", " 'spill_lat', 'Lagranian_template'])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "lons = np.array([-123.235, -123.238, -123.241, -123.240, -123.243])\n", "lats = np.array([48.670, 48.700, 48.691, 48.694, 48.698])" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "setup.spill_lat = lats\n", "setup.spill_lon = lons" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "day = datetime.datetime(2017, 11, 21, 2)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "setup = setup.assign(run_days = '7')\n", "setup = setup.assign(Lagranian_template = 'Lagrangian_AKNS_crude.dat')\n", "setup = setup.assign(spill_date_hour = day.strftime(\"%Y-%m-%d %H:00\"))" ] }, { "cell_type": "code", "execution_count": 8, "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", "
spill_date_hourrun_daysspill_lonspill_latLagranian_template
02017-11-21 02:007-123.23548.670Lagrangian_AKNS_crude.dat
12017-11-21 02:007-123.23848.700Lagrangian_AKNS_crude.dat
22017-11-21 02:007-123.24148.691Lagrangian_AKNS_crude.dat
32017-11-21 02:007-123.24048.694Lagrangian_AKNS_crude.dat
42017-11-21 02:007-123.24348.698Lagrangian_AKNS_crude.dat
\n", "
" ], "text/plain": [ " spill_date_hour run_days spill_lon spill_lat Lagranian_template\n", "0 2017-11-21 02:00 7 -123.235 48.670 Lagrangian_AKNS_crude.dat\n", "1 2017-11-21 02:00 7 -123.238 48.700 Lagrangian_AKNS_crude.dat\n", "2 2017-11-21 02:00 7 -123.241 48.691 Lagrangian_AKNS_crude.dat\n", "3 2017-11-21 02:00 7 -123.240 48.694 Lagrangian_AKNS_crude.dat\n", "4 2017-11-21 02:00 7 -123.243 48.698 Lagrangian_AKNS_crude.dat" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "setup" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "setup.to_csv('/ocean/vdo/MIDOSS/InOneSSGrid3.csv', index=False)" ] }, { "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.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }