<jupyter_start><jupyter_text>Salinity at M8 (top and bottom) - 31m & 55m<jupyter_code>%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import datetime

df =pd.read_excel('/Users/bell/in_and_outbox/2018/stabeno/mar/m8_salinities/ALL_topandbottom.xlsx',sheet_name='Hourly',usecols=[0,2,3,4],dateparse=True)
df.set_index(pd.DatetimeIndex(df['time']),inplace=True,drop=True)

df2 = df[['31m','55m']].copy()
df2.plot()

#monthly climatology
climatology = df2.groupby(df2.index.month).mean()

#monthly mean
monthly_mean = df2.resample('1M').mean()<jupyter_output><empty_output><jupyter_text>***Export to csv and use excel to calculate anomalies***<jupyter_code>df3 =pd.read_excel('/Users/bell/in_and_outbox/2018/stabeno/mar/m8_salinities/ALL_topandbottom.xlsx',
                   sheet_name='Monthly',dateparse=True,na_values=[' '])
df3.set_index(pd.DatetimeIndex(df3['time']),inplace=True,drop=True)
plt.figure(1, figsize=(18, 3), facecolor='w', edgecolor='w')
plt.subplot(1,1,1)
plt.plot(df3.index,df3['31m_anom'])
plt.plot(df3.index,df3['55m_anom'])
plt.legend()
from matplotlib.dates import YearLocator, MonthLocator, DateFormatter
import matplotlib.ticker as ticker
import matplotlib as mpl

mpl.rcParams['ytick.direction'] = 'in'
mpl.rcParams['xtick.direction'] = 'in'
mpl.rcParams['xtick.major.size'] = 0
mpl.rcParams['xtick.minor.size'] = 4
mpl.rcParams['font.size'] = 12
mpl.rcParams['font.sans-serif'] = "Arial"
mpl.rcParams['font.family'] = "sans-serif"
mpl.rcParams['font.weight'] = 'light'
mpl.rcParams['svg.fonttype'] = 'none'
plt.figure(1, figsize=(18, 3), facecolor='w', edgecolor='w')
plt.subplot(1,1,1)
plt.plot(df3.index,df3['31m_anom'])
plt.plot(df3.index,df3['55m_anom'])
ax1=plt.gca()
ax1.xaxis.set_major_locator(YearLocator(day=15,month=7))
ax1.xaxis.set_minor_locator(YearLocator(day=1,month=1))
ax1.xaxis.set_minor_formatter(ticker.NullFormatter())
ax1.xaxis.set_major_formatter(DateFormatter('%Y'))
#plt.legend()

#highlight DJF
for baryear in range(2005,2017,1):
    ax1.axvspan(datetime.datetime(baryear,12,1), datetime.datetime(baryear+1,3,1), alpha=0.25, color='grey')

ax1.set_xlim([datetime.datetime(2005,1,1),datetime.datetime(2018,1,1)])

#final plot spruced up in Illustrator<jupyter_output><empty_output><jupyter_text>Follow up with M4 Bottom Salinity Analysis<jupyter_code>df =pd.read_excel('/Volumes/WDC_internal/Users/bell/in_and_outbox/2018/stabeno/mar/m4_salinities/ALL_topandbottom.xlsx',sheet_name='Hourly',usecols=[0,1,2,3,4],dateparse=True)
df.set_index(pd.DatetimeIndex(df['time']),inplace=True,drop=True)

df2 = df[['24m','30m','55m','67m']].copy()
df2.plot()
#monthly climatology
climatology = df2.groupby(df2.index.month).mean()

#monthly mean
monthly_mean = df2.resample('1M').mean()
df4 =pd.read_excel('/Volumes/WDC_internal/Users/bell/in_and_outbox/2018/stabeno/mar/m4_salinities/ALL_topandbottom.xlsx',
                   sheet_name='Monthly',dateparse=True,na_values=[' '])
df4.set_index(pd.DatetimeIndex(df4['time']),inplace=True,drop=True)
plt.figure(1, figsize=(18, 3), facecolor='w', edgecolor='w')
plt.subplot(1,1,1)
plt.plot(df4.index,df4['30m_anom'])
plt.plot(df4.index,df4['55m_anom'])
plt.legend()
plt.figure(1, figsize=(18, 3), facecolor='w', edgecolor='w')
plt.subplot(1,1,1)
plt.plot(df4.index,df4['30m_anom'])
plt.plot(df4.index,df4['55m_anom'])
ax1=plt.gca()
ax1.xaxis.set_major_locator(YearLocator(day=15,month=7))
ax1.xaxis.set_minor_locator(YearLocator(day=1,month=1))
ax1.xaxis.set_minor_formatter(ticker.NullFormatter())
ax1.xaxis.set_major_formatter(DateFormatter('%Y'))
#plt.legend()

#highlight DJF
for baryear in range(2005,2017,1):
    ax1.axvspan(datetime.datetime(baryear,12,1), datetime.datetime(baryear+1,3,1), alpha=0.25, color='grey')

ax1.set_xlim([datetime.datetime(2005,1,1),datetime.datetime(2018,1,1)])

#final plot spruced up in Illustrator<jupyter_output><empty_output><jupyter_text>Temperature and Temperature Anomalies from JPL MUR SST dataset<jupyter_code>df4 =pd.read_excel('/Users/bell/in_and_outbox/Ongoing_Analysis/M8_IntegratedTemp/3source_sst_comparison.xlsx',
                   sheet_name='JPL MUR SST Monthly Mean (M8)',dateparse=True,na_values=[' '],index_col='Date')
df4.plot()
plt.figure(1, figsize=(18, 3), facecolor='w', edgecolor='w')
plt.subplot(2,1,1)
plt.plot(df4.index,df4['sst_MUR_jpl'])
ax1=plt.gca()
ax1.xaxis.set_major_locator(YearLocator(day=15,month=7))
ax1.xaxis.set_minor_locator(YearLocator(day=1,month=1))
ax1.xaxis.set_minor_formatter(ticker.NullFormatter())
ax1.xaxis.set_major_formatter(DateFormatter(''))
plt.subplot(2,1,2)
plt.plot(df4.index,df4['sst_MUR_jpl_anom'])
ax1=plt.gca()
ax1.xaxis.set_major_locator(YearLocator(day=15,month=7))
ax1.xaxis.set_minor_locator(YearLocator(day=1,month=1))
ax1.xaxis.set_minor_formatter(ticker.NullFormatter())
ax1.xaxis.set_major_formatter(DateFormatter('%Y'))


plt.figure(1, figsize=(6, 6), facecolor='w', edgecolor='w')
plt.subplot(1,1,1)
plt.plot(df4['Unnamed: 2'][7:19],df4['02-18 mean'][7:19])
ax1=plt.gca()
ax1.xaxis.set_major_locator(MonthLocator(bymonthday=15))
ax1.xaxis.set_minor_locator(MonthLocator(bymonthday=1))
ax1.xaxis.set_minor_formatter(ticker.NullFormatter())
ax1.xaxis.set_major_formatter(DateFormatter('%b'))
df4['Unnamed: 2'][7:19]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.180334092634776, 'fraction_numerical': 0.053910402429764616, 'mean_word_length': 8.830223880597014, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '202433', 'license': 'MIT', 'n_tokens_mistral': 2386, 'n_tokens_neox': 2213, 'n_words': 231, 'path': '2018/M8 Analysis (ICE Paper)/M8 Salinity Trends.ipynb', 'repo_name': 'shaunwbell/ipythonnb', 'size': '5268'}