import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib as mpl
import netCDF4 as nc
import datetime as dt
from salishsea_tools import evaltools as et, places, viz_tools, visualisations
import xarray as xr
import pandas as pd
import pickle
import os
%matplotlib inline
bio_time,sno3,sdiat,sflag,scili,intdiat,intphyto,spar,fracdiat,sphyto,percdiat,\
u_wind,v_wind,twind,solar,wspeed,winddirec,riv_time,rivFlow=pickle.load(open(savepath,'rb'))
Method 1: the date in which the maximum phytoplankton concentration is within 4 days of the nitrate concentration going below 0.1 umol/L (Collins et. al 2009)
Method 2: the first peak in which chlorophyll concentrations are above 5 ug/L for more than two days (Olson et. al 2020)
Method 3: The median + 5% of the annual Chl concentration is deemed “threshold value” for each year. For a given year, bloom initiation is determined to be the week that first reaches the threshold value (by looking at weekly averages) as long as one of the two following weeks was >70% of the threshold value. (Karyn’s method)