<jupyter_start><jupyter_text>Import Puget Sound data and create dataframe<jupyter_code>df=pd.read_excel('/ocean/ksuchy/MOAD/observe/SSMSP_TransBoundary_Extract_2014-2019_Verticals_Keister_Lab.xlsx',engine='openpyxl',sheet_name='SSMSP 2014-2019 Density&Biomass')
df
df.keys()
df.drop(labels=['BugSampleID','Project','Sampling Group','Date Category','Tow Type','Species Size Category Aggregation','Collection Confidence','Carbon Regression EQ','C to DW multipier','DW Regression Equation','C/DW Source'
                       ],axis=1,inplace=True)
df
df.keys()
df['Broad Group'].unique()
df['Mid-Level Group'].unique()
colListBroad=('Amphipod', 'Amphipod Egg', 'Anthozoan', 'Arachnida', 'Barnacles',
       'Bivalve', 'Bryozoan', 'Cephalopod', 'Chaetognath',
       'Chaetognath Egg', 'Cladocera', 'Copepod', 'Copepod Egg',
       'Copepod Nauplius', 'Crabs', 'Ctenophore', 'Cumacea',
       'Dinoflagellate', 'Echinoderm', 'Fish', 'Fish Egg', 'Gastropod',
       'Hydrozoan', 'Insect', 'Isopod', 'Krill Egg', 'Krill Nauplius',
       'Krill-Adult Juvenile', 'Krill-Calyptopis', 'Krill-Furcilia',
       'Larvacea', 'Mollusk Egg', 'Mysid', 'Mysid Egg', 'Nematode',
       'Nemertea', 'Nudibranch', 'Ostracod', 'Phoronid',
       'Platyhelminthes', 'Polychaete', 'Pycnogonida', 'Scyphozoan',
       'Shrimp', 'Siphonophore', 'Siphonophore Gonophore', 'Tunicate',
       'Tunicate Egg', 'Unknown', 'Unknown Egg', 'Unknown Nauplius')<jupyter_output><empty_output><jupyter_text>colListMid=('Amphipoda-Hyperiidea', 'Amphipoda-Cyphocarididae',       'Amphipoda-Calliopiidae', 'Amphipoda-Gammaridae', 'Amphipoda',       'Amphipoda-Corophiidae', 'Amphipoda-Caprellidae',       'Cnidaria-Anthozoa', 'Arachnidae', 'Maxillopoda-Cirripedia',       'Bivalvia', 'Bryozoa', 'Cephalopoda-Octopus', 'Cephalopoda-Squid',       'Chaetognatha', 'Cladocera', 'Copepoda-Calanoida',       'Copepoda-Poecilostomatoida', 'Copepoda-Cyclopoida',       'Copepoda-Monstrilloida', 'Copepoda-Harpacticoida',       'Copepoda-Siphonostomatoida', 'Copepoda',       'Decapoda-Brachyura-Cancridae', 'Decapoda-Brachyura-Pinnotheridae',       'Decapoda-Anomura-Paguridae', 'Decapoda-Brachyura-Grapsoidea',       'Decapoda-Anomura-Galatheoidea', 'Decapoda-Brachyura-Majoidea',       'Decapoda-Brachyura-Xanthoidea', 'Decapoda-Anomura-Lithoidea',       'Decapoda-Brachyura', 'Decapoda-Brachyura-cheiragonidae',       'Decapoda-Anomura-Porcellanidae', 'Decapoda-Anomura', 'Ctenophora',       'Cumacea', 'Dinoflagellata', 'Echinodermata', 'Chordata-Fish',       'Gastropoda', 'Cnidaria-Hydrozoa-Leptothecata',       'Cnidaria-Hydrozoa-Trachymedusa',       'Cnidaria-Hydrozoa-Anthoathecata-Pandeidea',       'Cnidaria-Hydrozoa-Anthoathecata', 'Cnidaria-Hydrozoa-Limnomedusa',       'Cnidaria-Hydrozoa', 'Cnidaria-Hydrozoa-Narcomedusa', 'Insecta',       'Isopoda', 'Euphausiidae', 'Euphausiidae-EUPHAUSIA-Nauplii',       'Euphausiidae-Nauplii', 'Euphausiidae-THYSANOESSA-Nauplii',       'Euphausiidae-EUPHAUSIA-Adult', 'Euphausiidae-THYSANOESSA-Adult',       'Euphausiidae-NEMATOSCELIS-Adult',       'Euphausiidae-EUPHAUSIA-Calyptopes',       'Euphausiidae-THYSANOESSA-Calyptopes', 'Euphausiidae-Calyptopes',       'Euphausiidae-EUPHAUSIA-Furcillia',       'Euphausiidae-THYSANOESSA-Furcillia', 'Euphausiidae-Furcillia',       'Chordata-Larvacea', 'Mollusca', 'Mysida', 'Nematoda', 'Nemertea',       'Nudibranchia', 'Ostracoda', 'Phoronid', 'Platyhelminthes',       'Annelida-Polychaeta', 'Pycnogonida', 'Cnidaria-Scyphozoa',       'Decapoda-Caridea-Hippolytidae', 'Decapoda-Caridea-Callianassidae',       'Decapoda-Caridea-Crangonidae', 'Decapoda-Caridea-Pandalidae',       'Decapoda-Caridea-Pasiphaeaidae', 'Decapoda-Caridea',       'Decapoda-Gebiidea', 'Decapoda-Caridea-Sergestidae',       'Cnidaria-Siphonophore-Calycophoran',       'Cnidaria-Siphonophore-Physonect', 'Cnidaria-Siphonophore',       'Chordata-Tunicata', 'Unknown')<jupyter_code>#colListGenus=('METRIDIA PACIFICA','NEOCALANUS PLUMCHRUS','CALANOIDA','EUCALANUS BUNGII','CALANUS PACIFICUS','CALANUS MARSHALLAE','NEOCALANUS CRISTATUS','EUCALANUS CALIFORNICUS','EUCALANUS','METRIDIIDAE','NEOCALANUS')
#l1=set(df['order'].values)
#l2=set(df['genus species'].values)
#l3=l1|l2<jupyter_output><empty_output><jupyter_text>Convert date to proper format<jupyter_code>df['Sample Date'][0],df['Sample Time'][0]
df['Sample Date'][1000:1020]
df['dtPac']=[dt.datetime.combine(idate, itime) for idate, itime \
                 in zip(df['Sample Date'],df['Sample Time'])]
df['dtUTC']=[et.pac_to_utc(ii) for ii in df['dtPac']]
df['dtUTC']
df['Sample Month']=[ii.month for ii in df['dtUTC']]
df.rename(columns={'Sample Code':'Key','Latitude':'Lat','Longitude':'Lon'},inplace=True)
df.loc[0]
towIDlist=['Key','Station', 'Site Name', 'Basin', 'Sub Basin', 'Lat',
       'Lon', 'Sample Date', 'Sample Year', 'Sample Month',
       'Sample Time', 'Mesh Size', 'Diameter (cm)', 'Station Depth (m)',
       'Max Tow Depth (m)', 'Min Tow Depth (m)','dtUTC']
towIDlist2=['Key', 'Station', 'Sample Date','Sample Time','dtUTC']
len(df.groupby(towIDlist)),len(df.groupby(towIDlist2)),len(df.groupby(['Key']))<jupyter_output><empty_output><jupyter_text>Create a biomass dataframe<jupyter_code>biomassDF=df.groupby(towIDlist2,as_index=False).first()\
     .loc[:,towIDlist].copy(deep=True)
biomassDF
#biomassDF2=biomassDF.loc[biomassDF['Sample Year']==2015].copy(deep=True)
#df2=df.loc[df['Sample Year']==2015].copy(deep=True)
def getbiomass(colname,key,origdf,matchcol):        
    biomassArray=origdf.loc[(origdf.Key==key)&(origdf[matchcol]==colname),
                    ['Final Carbon (mg/m3)']]
    biomass=np.nansum(biomassArray)
    
    return biomass
for icol in colListBroad:
    biomassDF[icol]=[getbiomass(icol,ikey,df,'Broad Group') for ikey in biomassDF['Key']]
 
   
#for icol in colListGenus:
   #biomassDF[icol]=[getbiomass(icol,ikey,df,'Genus species') for ikey in biomassDF['Key']]
biomassDF
biomassDF.keys()
#total=biomassDF.loc[:,'Amphipod'].sum()
import netCDF4 as nc
#ftemp=nc.Dataset('/data/eolson/results/MEOPAR/NEMO-forcing-new/grid/mesh_mask201702.nc')
#ftemp.variables.keys()
#ftemp.variables['e3t_0']
#ftemp.variables['e3t_1d'][:]
fdict={'ptrc_T':1,'grid_T':1}
start_date = dt.datetime(2014,1,1)
end_date = dt.datetime(2016,12,31)
flen=1 # number of days per model output file. always 1 for 201905 and 201812 model runs
namfmt='nowcast' # for 201905 and 201812 model runs, this should always be 'nowcast'
# filemap is dictionary of the form variableName: fileType, where variableName is the name
# of the variable you want to extract and fileType designates the type of 
# model output file it can be found in (usually ptrc_T for biology, grid_T for temperature and 
# salinity)
filemap={'microzooplankton':'ptrc_T','mesozooplankton':'ptrc_T'}
# fdict is a dictionary mappy file type to its time resolution. Here, 1 means hourly output
# (1h file) and 24 means daily output (1d file). In certain runs, multiple time resolutions 
# are available
fdict={'ptrc_T':1,'grid_T':1}
PATH= '/results2/SalishSea/nowcast-green.201905/'
biomassDF.keys()
biomassDF.rename(columns={'Max Tow Depth (m)':'Z_lower','Min Tow Depth (m)':'Z_upper','Station Depth (m)':'Z'},inplace=True)
# define log transform function with slight shift to accommodate zero values
def logt(x):
  return np.log10(x+.001)
# define inverse log transform with same shift
def logt_inv(y):
    return 10**y-.001
biomassDF['Year']=[ii.year for ii in biomassDF['dtUTC']]
biomassDF['YD']=et.datetimeToYD(biomassDF['dtUTC'])

biomassDF['Total']=(biomassDF['Amphipod']+biomassDF['Amphipod Egg']+biomassDF['Anthozoan']+\
    biomassDF['Arachnida']+biomassDF['Barnacles']+biomassDF['Bivalve']+biomassDF['Bryozoan']+\
    biomassDF['Cephalopod']+biomassDF['Chaetognath']+biomassDF['Chaetognath Egg']+biomassDF['Cladocera']+\
    biomassDF['Copepod']+biomassDF['Copepod Egg']+biomassDF['Copepod Nauplius']+biomassDF['Crabs']+\
    biomassDF['Ctenophore']+biomassDF['Cumacea']+biomassDF['Dinoflagellate']+\
    biomassDF['Echinoderm']+biomassDF['Fish']+biomassDF['Fish Egg']+biomassDF['Gastropod']+\
    biomassDF['Hydrozoan']+biomassDF['Insect']+biomassDF['Isopod']+biomassDF['Krill Egg']+\
    biomassDF['Krill Nauplius']+biomassDF['Krill-Adult Juvenile']+biomassDF['Krill-Calyptopis']+\
    biomassDF['Krill-Furcilia']+biomassDF['Larvacea']+biomassDF['Mollusk Egg']+biomassDF['Mysid']+\
    biomassDF['Mysid']+biomassDF['Mysid Egg']+biomassDF['Nematode']+biomassDF['Nemertea']+\
    biomassDF['Nudibranch']+biomassDF['Ostracod']+biomassDF['Phoronid']+biomassDF['Platyhelminthes']+\
    biomassDF['Polychaete']+biomassDF['Pycnogonida']+biomassDF['Scyphozoan']+biomassDF['Shrimp']+\
    biomassDF['Siphonophore']+biomassDF['Siphonophore Gonophore']+biomassDF['Tunicate']+\
    biomassDF['Tunicate Egg']+biomassDF['Unknown']+biomassDF['Unknown Egg']+biomassDF['Unknown Nauplius'])                                                                                        
biomassDF['MainGroups']=(biomassDF['Amphipod']+biomassDF['Amphipod Egg']+biomassDF['Chaetognath']+biomassDF['Chaetognath Egg']+biomassDF['Cladocera']+\
    biomassDF['Copepod']+biomassDF['Copepod Egg']+biomassDF['Cope<NAME>']+biomassDF['Crabs']+\
    biomassDF['Gastropod']+biomassDF['Krill Egg']+biomassDF['Krill Nauplius']+biomassDF['Krill-Adult Juvenile']+biomassDF['Krill-Calyptopis']+\
    biomassDF['Krill-Furcilia']+biomassDF['Larvacea']+biomassDF['Shrimp'])<jupyter_output><empty_output><jupyter_text>'Echinoderm', 'Fish', 'Fish Egg', 'Gastropod',       'Hydrozoan', 'Insect', 'Isopod', 'Krill Egg', 'Krill Nauplius',       'Krill-Adult Juvenile', 'Krill-Calyptopis', 'Krill-Furcilia',       'Larvacea', 'Mollusk Egg', 'Mysid', 'Mysid Egg', 'Nematode',       'Nemertea', 'Nudibranch', 'Ostracod', 'Phoronid',       'Platyhelminthes', 'Polychaete', 'Pycnogonida', 'Scyphozoan',       'Shrimp', 'Siphonophore', 'Siphonophore Gonophore', 'Tunicate',       'Tunicate Egg', 'Unknown', 'Unknown Egg', 'Unknown Nauplius'<jupyter_code>biomassDF
biomassDF.keys()
biomassDF['Sample Month'][1000:1200]
print(len(df),'data points')
print('Mean values per month by basin:')
biomassDF.groupby(['Basin','Sample Month']).mean()
monthsFmt = mdates.DateFormatter('%b')


data=et.matchData(biomassDF,filemap,fdict,start_date,end_date,'nowcast',PATH,1,quiet=False,method='vertNet');
data
data.keys()
data.describe()


data['L10Total']=logt(data['Total'])
data['L10MainGroups']=logt(data['MainGroups'])

data['L10mod_microzooplankton']=logt(data['mod_microzooplankton']*5.7*14)
data['L10mod_mesozooplankton']=logt(data['mod_mesozooplankton']*5.7*14)
View2014=data.loc[data.Year==2014]
View2015=data.loc[data.Year==2015]
View2016=data.loc[data.Year==2016]

ViewCentralBasin=data.loc[data.Basin=='Central Basin']
ViewSouthBasin=data.loc[data.Basin=='South Sound']
ViewAdmiralty=data.loc[data.Basin=='Admiralty Inlet']
data
monthlymean=data.groupby(['Sample Month']).mean()
monthlysem=data.groupby(['Sample Month']).sem()
monthlymeanCentral=ViewCentralBasin.groupby(['Sample Month']).mean()
monthlysemCentral=ViewCentralBasin.groupby(['Sample Month']).sem()
monthlymeanSouth=ViewSouthBasin.groupby(['Sample Month']).mean()
monthlymeanAdmiralty=ViewAdmiralty.groupby(['Sample Month']).mean()
monthlymeanSouth
np.shape([monthlymean['L10Total']-monthlysem['L10Total'],
 monthlymean['L10Total']+monthlysem['L10Total']])
fig,ax=plt.subplots(1,2,figsize=(20,5))
fig.suptitle('Puget Sound', fontsize=24)
fig.subplots_adjust(top=0.8)
ax[0].errorbar(monthlymean.index,logt_inv(monthlymean['L10Total']),
               yerr=logt_inv(np.array([monthlymean['L10Total']-monthlysem['L10Total'],
                 monthlymean['L10Total']+monthlysem['L10Total']])),
               fmt='ro',capsize=5)
ax[0].plot(logt_inv(monthlymean['L10Total']),'b--')
ax[1].errorbar(monthlymean.index,logt_inv(monthlymean['L10MainGroups']),
               yerr=logt_inv(np.array([monthlymean['L10MainGroups']-monthlysem['L10MainGroups'],
                 monthlymean['L10MainGroups']+monthlysem['L10MainGroups']])),
               fmt='ro',capsize=5)
ax[1].plot(logt_inv(monthlymean['L10MainGroups']),'b--')

ax[0].set_title('Total Zooplankton')
ax[1].set_title('Main Groups Only')
ax[0].set_ylabel('Mean Biomass (mg C m-3)')
ax[0].set_xlim(0,12)
ax[1].set_xlim(0,12)

ax[0].set_ylim(0,50)
ax[1].set_ylim(0,50)


fig,ax=plt.subplots(1,1,figsize=(12,2.5))

ax.plot(logt_inv(monthlymean['L10Total']),'b--',label='Total Zooplankton')
ax.plot(logt_inv(monthlymean['L10MainGroups']),'--',color='lightblue',label='Main Groups Only')
ax.set_ylim(0,60)
ax.set_title('Puget Sound Observation Zooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)
ax.legend(fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(logt_inv(monthlymean['L10mod_mesozooplankton']),'--',color='red',label='Model Microzoop')
ax.set_ylim(0,70)
ax.set_title('Model Mesozooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(logt_inv(monthlymean['L10mod_microzooplankton']),'--',color='darkorange',label='Model Microzoop')
ax.set_ylim(0,70)
ax.set_title('Model Microzooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)


fig,ax=plt.subplots(1,1,figsize=(12,2.5))


ax.plot(logt_inv(monthlymeanAdmiralty['L10Total']),'b--')
ax.set_ylim(0,80)
ax.set_title('Admiralty Inlet Zooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)
#ax.legend(fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(logt_inv(monthlymeanAdmiralty['L10mod_mesozooplankton']),'--',color='red',label='Model Microzoop')
ax.set_ylim(0,80)
ax.set_title('Model Mesozooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(logt_inv(monthlymeanAdmiralty['L10mod_microzooplankton']),'--',color='darkorange',label='Model Microzoop')
ax.set_ylim(0,80)
ax.set_title('Model Microzooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)
fig,ax=plt.subplots(1,1,figsize=(12,2.5))


ax.plot(logt_inv(monthlymeanCentral['L10Total']),'--',color='darkgreen')
ax.set_ylim(0,80)
ax.set_title('Central Basin Zooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)
#ax.legend(fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(logt_inv(monthlymeanCentral['L10mod_mesozooplankton']),'--',color='red',label='Model Microzoop')
ax.set_ylim(0,80)
ax.set_title('Model Mesozooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(logt_inv(monthlymeanCentral['L10mod_microzooplankton']),'--',color='darkorange',label='Model Microzoop')
ax.set_ylim(0,80)
ax.set_title('Model Microzooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))


ax.plot(logt_inv(monthlymeanSouth['L10Total']),'--',color='purple')
ax.set_ylim(0,80)
ax.set_title('South Sound Zooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)
#ax.legend(fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(logt_inv(monthlymeanSouth['L10mod_mesozooplankton']),'--',color='red',label='Model Microzoop')
ax.set_ylim(0,80)
ax.set_title('Model Mesozooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(logt_inv(monthlymeanSouth['L10mod_microzooplankton']),'--',color='darkorange',label='Model Microzoop')
ax.set_ylim(0,80)
ax.set_title('Model Microzooplankton Seasonal Cycle')
ax.set_ylabel('Biomass (mg C m-3)',fontsize=10)
fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(10**(LogTotal2014['L10Total']),'-',color='blue',label='2014')
ax.plot(10**(LogTotal2015['L10Total']),'-.',color='orange',label='2015')
ax.plot(10**(LogTotal2016['L10Total']),'--',color='green',label='2016')
ax.set_ylim(0,80)
ax.set_xlim(0,12)
ax.set_title('Puget Sound Total Obs Zooplankton')
ax.set_ylabel('Mean Biomass (mg C m-3)',fontsize=10)
ax.legend(fontsize=10)


fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(10**(LogTotal2014['L10mod_mesozooplankton']),'-',color='blue',label='2014')
ax.plot(10**(LogTotal2015['L10mod_mesozooplankton']),'-.',color='orange',label='2015')
ax.plot(10**(LogTotal2016['L10mod_mesozooplankton']),'--',color='green',label='2016')
ax.set_ylim(0,80)
ax.set_xlim(0,12)
ax.set_title('Model Mesozooplankton')
ax.set_ylabel('Mean Biomass (mg C m-3)',fontsize=10)
ax.legend(fontsize=10)

fig,ax=plt.subplots(1,1,figsize=(12,2.5))
ax.plot(10**(LogTotal2014['L10mod_microzooplankton']),'-',color='blue',label='2014')
ax.plot(10**(LogTotal2015['L10mod_microzooplankton']),'-.',color='orange',label='2015')
ax.plot(10**(LogTotal2016['L10mod_microzooplankton']),'--',color='green',label='2016')
ax.set_ylim(0,80)
ax.set_xlim(0,12)
ax.set_title('Model Microzooplankton')
ax.set_ylabel('Mean Biomass (mg C m-3)',fontsize=10)
ax.legend(fontsize=10)
cm1=cmocean.cm.thermal
with nc.Dataset('/data/eolson/results/MEOPAR/NEMO-forcing-new/grid/bathymetry_201702.nc') as bathy:
    bathylon=np.copy(bathy.variables['nav_lon'][:,:])
    bathylat=np.copy(bathy.variables['nav_lat'][:,:])
    bathyZ=np.copy(bathy.variables['Bathymetry'][:,:])
fig, ax = plt.subplots(1,1,figsize = (6,6))
with nc.Dataset('/ocean/ksuchy/MOAD/NEMO-forcing/grid/bathymetry_201702.nc') as grid:
    viz_tools.plot_coastline(ax, grid, coords = 'map',isobath=.1)
colors=('teal','green','firebrick','darkorange','darkviolet','fuchsia',
        'royalblue','darkgoldenrod','mediumspringgreen','deepskyblue')
datreg=dict()
for ind, iregion in enumerate(data.Basin.unique()):
    datreg[iregion] = data.loc[data.Basin==iregion]
    ax.plot(datreg[iregion]['Lon'], datreg[iregion]['Lat'],'.',
            color = colors[ind], label=iregion)
ax.set_ylim(47,51)
ax.legend(bbox_to_anchor=[1,.6,0,0])
ax.set_xlim(-126, -120);
ax.set_title('Observation Locations');
ax.legend(bbox_to_anchor=(1.1, 1.05))
def byRegion(ax,obsvar,modvar,lims):
    PS=[]
    for ind, iregion in enumerate(data.Basin.unique()):
        #ax.plot(datreg[iregion]['Lon'], datreg[iregion]['Lat'],'.',
                #color = colors[ind], label=iregion)
        PS0=et.varvarPlot(ax,datreg[iregion],obsvar,modvar,
                          cols=(colors[ind],),lname=iregion)
        PS.append(PS0)
    l=ax.legend(handles=[ip[0][0] for ip in PS])
    ax.set_xlabel('Obs')
    ax.set_ylabel('Model')
    ax.plot(lims,lims,'k-',alpha=.5)
    ax.set_xlim(lims)
    ax.set_ylim(lims)
    ax.set_aspect(1)
    return PS,l
data['Month']=[ii.month for ii in data['dtUTC']]
JF=data.loc[(data.Month==1)|(data.Month==2)]
MAM=data.loc[(data.Month==3)|(data.Month==4)|(data.Month==5)]
JJA=data.loc[(data.Month==6)|(data.Month==7)|(data.Month==8)]
SOND=data.loc[(data.Month==9)|(data.Month==10)|(data.Month==11)|(data.Month==12)]
def bySeason(ax,obsvar,modvar,lims):
    for axi in ax:
        axi.plot(lims,lims,'k-')
        axi.set_xlim(lims)
        axi.set_ylim(lims)
        axi.set_aspect(1)
        axi.set_xlabel('Obs')
        axi.set_ylabel('Model')
    PS=et.varvarPlot(ax[0],JF,obsvar,modvar,cols=('crimson','darkturquoise','navy'))
    ax[0].set_title('Winter')
    PS=et.varvarPlot(ax[1],MAM,obsvar,modvar,cols=('crimson','darkturquoise','navy'))
    ax[1].set_title('Spring')
    PS=et.varvarPlot(ax[2],JJA,obsvar,modvar,cols=('crimson','darkturquoise','navy'))
    ax[2].set_title('Summer')
    PS=et.varvarPlot(ax[3],SOND,obsvar,modvar,cols=('crimson','darkturquoise','navy'))
    ax[3].set_title('Autumn')
    return 
fig, ax = plt.subplots(1,1,figsize = (16,7))     
PS,l=byRegion(ax,'L10Total','L10mod_mesozooplankton',(0,2))
ax.set_title('Log10 Total (mg C m-3) By Region')
ax.legend(bbox_to_anchor=(1.1, 1.05))

fig, ax = plt.subplots(1,4,figsize = (16,3.3))
bySeason(ax,'L10Total','L10mod_mesozooplankton',(0,2))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1906990789672354, 'fraction_numerical': 0.03397252000603956, 'mean_word_length': 6.935303514376997, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '588269', 'license': 'Apache-2.0', 'n_tokens_mistral': 8791, 'n_tokens_neox': 7974, 'n_words': 946, 'path': 'notebooks/plotExamples/PugetSoundZoop_TotalZooplankton.ipynb', 'repo_name': 'SalishSeaCast/analysis-karyn', 'size': '19875'}