#!/usr/bin/env python # coding: utf-8 # # inter-run comparisons of N contained in phytoplankton # - S3 # - Sentry Shoal # - Central Node # - JDF # In[1]: import pandas as pd import netCDF4 as nc import datetime as dt import subprocess import requests import matplotlib.pyplot as plt import cmocean import numpy as np import os import re import dateutil as dutil from salishsea_tools import viz_tools, places import glob import pickle import matplotlib.dates as mdates import matplotlib as mpl mpl.rc('xtick', labelsize=14) mpl.rc('ytick', labelsize=16) mpl.rc('legend', fontsize=16) mpl.rc('axes', titlesize=16) mpl.rc('figure', titlesize=16) mpl.rc('axes', labelsize=16) mpl.rc('font', size=16) mpl.rcParams['font.size'] = 16 mpl.rcParams['axes.titlesize'] = 16 mpl.rcParams['legend.numpoints'] = 1 get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: plist=['Sentry Shoal','S3','Central node','Central SJDF'] # In[3]: df1=pd.read_csv('/ocean/eolson/MEOPAR/obs/ONC/turbidity/nearSurface/search3928586/BritishColumbiaFerries_Tsawwassen-DukePoint_Turbidity-ChlorophyllandFluorescence_20140804T234330Z_20150604T070614Z-clean.csv', skiprows=78,header=None, names=('TimeUTC','CDOM','CDOMQC','Chlorophyll_ug','ChlQC','Turbidity_NTU','TurbQC','Lat','LatQC','Lon','LongQC')) # In[4]: df2=pd.read_csv('/ocean/eolson/MEOPAR/obs/ONC/turbidity/nearSurface/search3928586/BritishColumbiaFerries_Tsawwassen-DukePoint_Turbidity-ChlorophyllandFluorescence_20150604T070624Z_20160307T160206Z-clean.csv', skiprows=78,header=None, names=('TimeUTC','CDOM','CDOMQC','Chlorophyll_ug','ChlQC','Turbidity_NTU','TurbQC','Lat','LatQC','Lon','LongQC')) # In[ ]: df=pd.concat([df1.drop(df1[df1.TimeUTC<'2015'].index),df2.drop(df2[df2.TimeUTC>'2016'].index)],ignore_index=True) # In[ ]: dts=[dt.datetime(int(r[0:4]),int(r[5:7]),int(r[8:10]),int(r[11:13]),int(r[14:16]),int(r[17:19])) for r in df['TimeUTC']] # In[ ]: df=df.assign(dts=dts) # In[ ]: df['Lat']=pd.to_numeric(df['Lat'],errors='coerce') df['Lon']=pd.to_numeric(df['Lon'],errors='coerce') # In[ ]: df.head() # In[ ]: df['Lon'][0] # In[ ]: places.PLACES['S3'] # In[ ]: 111*.0226 # In[ ]: llon=places.PLACES['S3']['lon lat'][0]-.01 ulon=places.PLACES['S3']['lon lat'][0]+.01 llat=places.PLACES['S3']['lon lat'][1]-.01 ulat=places.PLACES['S3']['lon lat'][1]+.01 iidfnd=(df.Lon>llon)&(df.Lonllat)&(df.Lat