import numpy as np
import matplotlib.pyplot as plt
import netCDF4 as nc
import pickle
import pandas as pd
import os
import datetime as dt
%matplotlib inline
saveloc='/ocean/aisabell/MEOPAR/extracted_files/'
modver='201812'
loc='S3'
# loop through years
years=list()
bloomtime1=list()
for year in range(2015,2019):
fname=f'springTimeSeries_{str(year)}_{loc}_{modver}.pkl'
savepath=os.path.join(saveloc,fname)
bio_time,sno3,sdiat,sflag,scili,diat_alld,no3_alld,flag_alld,cili_alld,phyto_alld,intdiat,intphyto,spar,fracdiat,sphyto,percdiat,\
u_wind,v_wind,twind,solar,wspeed,winddirec,riv_time,rivFlow=pickle.load(open(savepath,'rb'))
# put code that calculates bloom timing here
bt1=dt.datetime(year, 3,1)
years.append(year)
bloomtime1.append(bt1)
years=np.array(years)
bloomtime1=np.array(bloomtime1)
years
array([2015, 2016, 2017, 2018])
bloomtime1
[datetime.datetime(2015, 3, 1, 0, 0), datetime.datetime(2016, 3, 1, 0, 0), datetime.datetime(2017, 3, 1, 0, 0), datetime.datetime(2018, 3, 1, 0, 0)]