In [1]:
import netCDF4 as nc
import numpy as np
import matplotlib.pyplot as plt
from salishsea_tools import geo_tools, nc_tools, tidetools, viz_tools
import xarray as xr
import datetime
import pandas as pd
import datetime as dt
#import h5py
import matplotlib.patches as patches
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:90% !important; }</style>"))

%matplotlib inline
In [2]:
from IPython.display import HTML

HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 } else {
 $('div.input').show();
 }
 code_show = !code_show
} 
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
Out[2]:
In [ ]:
 
In [ ]:
 
In [3]:
setup = pd.DataFrame(columns = ['spill_date_hour', 'run_days', 'spill_lon', 
                                'spill_lat', 'Lagranian_template'])
In [4]:
lons = np.array([-123.235, -123.238, -123.241, -123.240, -123.243])
lats = np.array([48.670, 48.700, 48.691, 48.694, 48.698])
In [5]:
setup.spill_lat = lats
setup.spill_lon = lons
In [6]:
day = datetime.datetime(2017, 11, 21, 2)
In [7]:
setup = setup.assign(run_days = '7')
setup = setup.assign(Lagranian_template = 'Lagrangian_AKNS_crude.dat')
setup = setup.assign(spill_date_hour = day.strftime("%Y-%m-%d %H:00"))
In [8]:
setup
Out[8]:
spill_date_hour run_days spill_lon spill_lat Lagranian_template
0 2017-11-21 02:00 7 -123.235 48.670 Lagrangian_AKNS_crude.dat
1 2017-11-21 02:00 7 -123.238 48.700 Lagrangian_AKNS_crude.dat
2 2017-11-21 02:00 7 -123.241 48.691 Lagrangian_AKNS_crude.dat
3 2017-11-21 02:00 7 -123.240 48.694 Lagrangian_AKNS_crude.dat
4 2017-11-21 02:00 7 -123.243 48.698 Lagrangian_AKNS_crude.dat
In [9]:
setup.to_csv('/ocean/vdo/MIDOSS/InOneSSGrid3.csv', index=False)
In [ ]: