{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## DFO Nutrient Comparison" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import sqlalchemy\n", "from sqlalchemy import (create_engine, Column, String, Integer, Float, MetaData, \n", " Table, type_coerce, ForeignKey, case)\n", "from sqlalchemy.orm import mapper, create_session, relationship, aliased, Session\n", "from sqlalchemy.ext.declarative import declarative_base\n", "from sqlalchemy import case\n", "import numpy as np\n", "from sqlalchemy.ext.automap import automap_base\n", "import matplotlib.pyplot as plt\n", "import sqlalchemy.types as types\n", "from sqlalchemy.sql import and_, or_, not_, func\n", "from sqlalchemy.sql import select\n", "import os\n", "from os.path import isfile\n", "import pandas as pd\n", "import netCDF4 as nc\n", "import datetime as dt\n", "from salishsea_tools import evaltools as et, viz_tools\n", "import datetime\n", "import glob\n", "import gsw\n", "\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
YearMonthDayHourLatLonPressureDepthAmmoniumAmmonium_unitsChlorophyll_ExtractedChlorophyll_Extracted_unitsNSiSilicate_unitsAbsSalConsTZdtUTC
01982.07.016.01.3549.25-123.943NaN12.0NaNNone5.28mg/m^36.613.6umol/LNaNNaN12.01982-07-16 01:21:00
11982.07.016.01.3549.25-123.943NaN21.5NaNNone0.61mg/m^321.245.0umol/LNaNNaN21.51982-07-16 01:21:00
21982.07.016.01.3549.25-123.943NaN30.5NaNNoneNaNmg/m^323.547.4umol/LNaNNaN30.51982-07-16 01:21:00
31982.07.016.01.3549.25-123.943NaN52.3NaNNoneNaNmg/m^328.050.2umol/LNaNNaN52.31982-07-16 01:21:00
41982.07.016.01.3549.25-123.943NaN75.4NaNNoneNaNmg/m^326.549.1umol/LNaNNaN75.41982-07-16 01:21:00
\n", "
" ], "text/plain": [ " Year Month Day Hour Lat Lon Pressure Depth Ammonium \\\n", "0 1982.0 7.0 16.0 1.35 49.25 -123.943 NaN 12.0 NaN \n", "1 1982.0 7.0 16.0 1.35 49.25 -123.943 NaN 21.5 NaN \n", "2 1982.0 7.0 16.0 1.35 49.25 -123.943 NaN 30.5 NaN \n", "3 1982.0 7.0 16.0 1.35 49.25 -123.943 NaN 52.3 NaN \n", "4 1982.0 7.0 16.0 1.35 49.25 -123.943 NaN 75.4 NaN \n", "\n", " Ammonium_units Chlorophyll_Extracted Chlorophyll_Extracted_units N \\\n", "0 None 5.28 mg/m^3 6.6 \n", "1 None 0.61 mg/m^3 21.2 \n", "2 None NaN mg/m^3 23.5 \n", "3 None NaN mg/m^3 28.0 \n", "4 None NaN mg/m^3 26.5 \n", "\n", " Si Silicate_units AbsSal ConsT Z dtUTC \n", "0 13.6 umol/L NaN NaN 12.0 1982-07-16 01:21:00 \n", "1 45.0 umol/L NaN NaN 21.5 1982-07-16 01:21:00 \n", "2 47.4 umol/L NaN NaN 30.5 1982-07-16 01:21:00 \n", "3 50.2 umol/L NaN NaN 52.3 1982-07-16 01:21:00 \n", "4 49.1 umol/L NaN NaN 75.4 1982-07-16 01:21:00 " ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "PATH= '/data/eolson/MEOPAR/SS36runs/linkHC201812/'\n", "start_date = datetime.datetime(2016,1,1)\n", "end_date = datetime.datetime(2016,12,31)\n", "flen=1\n", "namfmt='nowcast'\n", "#varmap={'N':'nitrate','Si':'silicon','Ammonium':'ammonium'}\n", "filemap={'nitrate':'ptrc_T','silicon':'ptrc_T','ammonium':'ptrc_T','diatoms':'ptrc_T','ciliates':'ptrc_T','flagellates':'ptrc_T','vosaline':'grid_T','votemper':'grid_T'}\n", "#gridmap={'nitrate':'tmask','silicon':'tmask','ammonium':'tmask'}\n", "fdict={'ptrc_T':1,'grid_T':1}\n", "\n", "df1=et.loadDFO()\n", "df1.head()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "data=et.matchData(df1,filemap, fdict, start_date, end_date, namfmt, PATH, flen)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(figsize = (6,6))\n", "viz_tools.set_aspect(ax, coords = 'map')\n", "ax.plot(data['Lon'], data['Lat'], 'ro',label='data')\n", "ax.plot(data.loc[(data.Lon < -123.5) & (data.Lat < 48.6),['Lon']], \n", " data.loc[(data.Lon < -123.5) & (data.Lat < 48.6),['Lat']], \n", " 'bo', label = 'Juan de Fuca')\n", "\n", "ax.plot(data.loc[data.Si>75,['Lon']],data.loc[data.Si>75,['Lat']],'*',color='y',label='high Si')\n", "grid = nc.Dataset('/data/vdo/MEOPAR/NEMO-forcing/grid/bathymetry_201702.nc')\n", "viz_tools.plot_coastline(ax, grid, coords = 'map')\n", "ax.set_ylim(48, 50.5)\n", "ax.legend()\n", "ax.set_xlim(-125.7, -122.5);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Nitrate" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "N_s, modmean_s, obsmean_s, bias_s, RMSE_s, WSS_s = et.stats(data.loc[data.Z<15,['N']],data.loc[data.Z<15,['mod_nitrate']])\n", "N_i, modmean_i, obsmean_i, bias_i, RMSE_i, WSS_i = et.stats(data.loc[(data.Z>=15)&(data.Z<22),['N']],data.loc[(data.Z>=15)&(data.Z<22),['mod_nitrate']])\n", "N_d, modmean_d, obsmean_d, bias_d, RMSE_d, WSS_d = et.stats(data.loc[data.Z>=22,['N']],data.loc[data.Z>=22,['mod_nitrate']])\n", "N, modmean, obsmean, bias, RMSE, WSS = et.stats(data.loc[:,['N']],data.loc[:,['mod_nitrate']])\n", "print('Nitrate')\n", "print('z<15 m:')\n", "print(' N: {}\\n bias: {}\\n RMSE: {}\\n WSS: {}'.format(N_s,bias_s,RMSE_s,WSS_s))\n", "print('15 m<=z<22 m:')\n", "print(' N: {}\\n bias: {}\\n RMSE: {}\\n WSS: {}'.format(N_i,bias_i,RMSE_i,WSS_i))\n", "print('z>=22 m:')\n", "print(' N: {}\\n bias: {}\\n RMSE: {}\\n WSS: {}'.format(N_d,bias_d,RMSE_d,WSS_d))\n", "print('all:')\n", "print(' N: {}\\n bias: {}\\n RMSE: {}\\n WSS: {}'.format(N,bias,RMSE,WSS))\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(figsize = (8,8))\n", "ps=et.varvarPlot(ax,data,'N','mod_nitrate','Z',(15,22),'z','m',('mediumseagreen','darkturquoise','navy'))\n", "ax.legend(handles=ps)\n", "ax.set_xlabel('Obs')\n", "ax.set_ylabel('Model')\n", "ax.set_title('NO$_3$ ($\\mu$M)')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(1,4,figsize = (24,6))\n", "for axi in ax:\n", " axi.plot(np.arange(0,30),np.arange(0,30),'k-')\n", "ps=et.varvarPlot(ax[0],data.loc[(data.Z<15)&(data.dtUTC<=dt.datetime(2015,4,1)),:],'N','mod_nitrate',cols=('crimson','darkturquoise','navy'))\n", "ax[0].set_title('Feb-Mar')\n", "ii1=(data.Z < 15)&(data.dtUTC<=dt.datetime(2015,5,1))&(data.dtUTC>dt.datetime(2015,4,1))\n", "ps=et.varvarPlot(ax[1],data.loc[ii1,:],'N','mod_nitrate',cols=('crimson','darkturquoise','navy'))\n", "ax[1].set_title('April')\n", "ii2=(data.Z < 15)&(data.dtUTC<=dt.datetime(2015,9,1))&(data.dtUTC>dt.datetime(2015,5,1))\n", "ps=et.varvarPlot(ax[2],data.loc[ii2,:],'N','mod_nitrate',cols=('crimson','darkturquoise','navy'))\n", "ax[2].set_title('May-Jun')\n", "ii3=(data.Z < 15)&(data.dtUTC<=dt.datetime(2015,12,1))&(data.dtUTC>dt.datetime(2015,9,1))\n", "ps=et.varvarPlot(ax[3],data.loc[ii3,:],'N','mod_nitrate',cols=('crimson','darkturquoise','navy'))\n", "ax[3].set_title('Sep-Oct')\n", "\n", "#ii4=(data.Z < 15)&(data.dtUTC<=dt.datetime(2016,4,1))&(data.dtUTC>dt.datetime(2016,2,1))\n", "#ps=et.varvarPlot(ax[0],data.loc[ii4,:],obsvar,modvar,cols=('darkturquoise','navy'))\n", "#ii5=(data.Z < 15)&(data.dtUTC<=dt.datetime(2016,5,1))&(data.dtUTC>dt.datetime(2016,4,1))\n", "#ps=et.varvarPlot(ax[1],data.loc[ii5,:],obsvar,modvar,cols=('darkturquoise','navy'))\n", "\n", "print('Nitrate, z<15')\n", "print('Feb-Mar:')\n", "et.printstats(data.loc[(data.Z<15)&(data.dtUTC<=dt.datetime(2015,4,1)),:],'N','mod_nitrate')\n", "print('April:')\n", "et.printstats(data.loc[ii1,:],'N','mod_nitrate')\n", "print('May-Jun:')\n", "et.printstats(data.loc[ii2,:],'N','mod_nitrate')\n", "print('Sep-Oct:')\n", "et.printstats(data.loc[ii3,:],'N','mod_nitrate')\n", "fig,ax=plt.subplots(1,1,figsize=(24,1))\n", "plt.plot(data.dtUTC,np.ones(np.shape(data.dtUTC)),'k.')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(figsize = (8,8))\n", "viz_tools.set_aspect(ax, coords = 'map')\n", "ax.plot(data['Lon'], data['Lat'], 'ro',label='data')\n", "dJDF=data.loc[(data.Lon<-123.6)&(data.Lat<48.6)]\n", "ax.plot(dJDF['Lon'],dJDF['Lat'],'b.',label='JDF')\n", "dSJGI=data.loc[(data.Lon>=-123.6)&(data.Lat<48.9)]\n", "ax.plot(dSJGI['Lon'],dSJGI['Lat'],'c.',label='SJGI')\n", "dSOG=data.loc[(data.Lat>=48.9)&(data.Lon>-124.0)]\n", "ax.plot(dSOG['Lon'],dSOG['Lat'],'y.',label='SOG')\n", "dNSOG=data.loc[(data.Lat>=48.9)&(data.Lon<=-124.0)]\n", "ax.plot(dNSOG['Lon'],dNSOG['Lat'],'m.',label='NSOG')\n", "grid = nc.Dataset('/data/vdo/MEOPAR/NEMO-forcing/grid/bathymetry_201702.nc')\n", "viz_tools.plot_coastline(ax, grid, coords = 'map')\n", "ax.set_ylim(48, 50.5)\n", "ax.legend()\n", "ax.set_xlim(-125.7, -122.5);" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(figsize = (8,8))\n", "ps1=et.varvarPlot(ax,dJDF,'N','mod_nitrate',cols=('b','darkturquoise','navy'),lname='SJDF')\n", "ps2=et.varvarPlot(ax,dSJGI,'N','mod_nitrate',cols=('c','darkturquoise','navy'),lname='SJGI')\n", "ps3=et.varvarPlot(ax,dSOG,'N','mod_nitrate',cols=('y','darkturquoise','navy'),lname='SOG')\n", "ps4=et.varvarPlot(ax,dNSOG,'N','mod_nitrate',cols=('m','darkturquoise','navy'),lname='NSOGF')\n", "ax.legend(handles=[ps1[0][0],ps2[0][0],ps3[0][0],ps4[0][0]])\n", "ax.set_xlabel('Obs')\n", "ax.set_ylabel('Model')\n", "ax.set_title('NO$_3$ ($\\mu$M)')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(1,2,figsize = (17,8))\n", "cols=('crimson','red','orangered','darkorange','gold','chartreuse','green','lightseagreen','cyan','darkturquoise','royalblue',\n", " 'lightskyblue','blue','darkblue','mediumslateblue','blueviolet','darkmagenta','fuchsia','deeppink','pink')\n", "ii0=start_date\n", "for ii in range(0,int((end_date-start_date).days/30)):\n", " iii=(data.dtUTC>=(start_date+dt.timedelta(days=ii*30)))&(data.dtUTC<(start_date+dt.timedelta(days=(ii+1)*30)))\n", " ax[0].plot(data.loc[iii,['mod_nitrate']].values-data.loc[iii,['N']].values, data.loc[iii,['Z']].values, \n", " '.', color = cols[ii],label=str(ii))\n", " ax[1].plot(data.loc[iii,['mod_silicon']].values-data.loc[iii,['Si']].values, data.loc[iii,['Z']].values, \n", " '.', color = cols[ii],label=str(ii))\n", "for axi in (ax[0],ax[1]):\n", " axi.legend(loc=4)\n", " axi.set_ylim(400,0)\n", " axi.set_ylabel('depth (m)')\n", "ax[0].set_xlabel('model - obs N')\n", "ax[1].set_xlabel('model - obs Si')\n", "ax[1].set_xlim(-40,20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Silicate" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print('Nitrate')\n", "print('z<15 m:')\n", "et.printstats(data.loc[data.Z<15,:],'Si','mod_silicon')\n", "print('15 m<=z<22 m:')\n", "et.printstats(data.loc[(data.Z>=15)&(data.Z<22),:],'Si','mod_silicon')\n", "print('z>=22 m:')\n", "et.printstats(data.loc[data.Z>=22,:],'Si','mod_silicon')\n", "print('all:')\n", "et.printstats(data,'Si','mod_silicon')\n", "print('obs Si < 50:')\n", "et.printstats(data.loc[data.Si<50,:],'Si','mod_silicon')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(figsize = (8,8))\n", "ps=et.varvarPlot(ax,data,'Si','mod_silicon','Z',(15,22),'z','m',('mediumseagreen','darkturquoise','navy'))\n", "ax.legend(handles=ps)\n", "ax.set_xlabel('Obs')\n", "ax.set_ylabel('Model')\n", "ax.set_title('dSi ($\\mu$M)')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "obsvar='Si'; modvar='mod_silicon'\n", "fig, ax = plt.subplots(1,4,figsize = (24,6))\n", "for axi in ax:\n", " axi.plot(np.arange(0,70),np.arange(0,70),'k-')\n", "ps=et.varvarPlot(ax[0],data.loc[(data.Z<15)&(data.dtUTC<=dt.datetime(2015,4,1)),:],obsvar,modvar,cols=('crimson','darkturquoise','navy'))\n", "ax[0].set_title('Feb-Mar')\n", "ii1=(data.Z < 15)&(data.dtUTC<=dt.datetime(2015,5,1))&(data.dtUTC>dt.datetime(2015,4,1))\n", "ps=et.varvarPlot(ax[1],data.loc[ii1,:],obsvar,modvar,cols=('crimson','darkturquoise','navy'))\n", "ax[1].set_title('April')\n", "ii2=(data.Z < 15)&(data.dtUTC<=dt.datetime(2015,9,1))&(data.dtUTC>dt.datetime(2015,5,1))\n", "ps=et.varvarPlot(ax[2],data.loc[ii2,:],obsvar,modvar,cols=('crimson','darkturquoise','navy'))\n", "ax[2].set_title('May-Jun')\n", "ii3=(data.Z < 15)&(data.dtUTC<=dt.datetime(2015,12,1))&(data.dtUTC>dt.datetime(2015,9,1))\n", "ps=et.varvarPlot(ax[3],data.loc[ii3,:],obsvar,modvar,cols=('crimson','darkturquoise','navy'))\n", "ax[3].set_title('Sep-Oct')\n", "\n", "ii4=(data.Z < 15)&(data.dtUTC<=dt.datetime(2016,4,1))&(data.dtUTC>dt.datetime(2016,2,1))\n", "ps=et.varvarPlot(ax[0],data.loc[ii4,:],obsvar,modvar,cols=('darkturquoise','navy'))\n", "ii5=(data.Z < 15)&(data.dtUTC<=dt.datetime(2016,5,1))&(data.dtUTC>dt.datetime(2016,4,1))\n", "ps=et.varvarPlot(ax[1],data.loc[ii5,:],obsvar,modvar,cols=('darkturquoise','navy'))\n", "\n", "\n", "print('Silicate, z<15')\n", "print('Feb-Mar:')\n", "et.printstats(data.loc[(data.Z<15)&(data.dtUTC<=dt.datetime(2015,4,1)),:],obsvar,modvar)\n", "print('April:')\n", "et.printstats(data.loc[ii1,:],obsvar,modvar)\n", "print('May-Jun:')\n", "et.printstats(data.loc[ii2,:],obsvar,modvar)\n", "print('Sep-Oct:')\n", "et.printstats(data.loc[ii3,:],obsvar,modvar)\n", "fig,ax=plt.subplots(1,1,figsize=(24,1))\n", "plt.plot(data.dtUTC,np.ones(np.shape(data.dtUTC)),'k.')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(figsize = (8,8))\n", "ps1=et.varvarPlot(ax,dJDF,obsvar,modvar,cols=('b','darkturquoise','navy'),lname='SJDF')\n", "ps2=et.varvarPlot(ax,dSJGI,obsvar,modvar,cols=('c','darkturquoise','navy'),lname='SJGI')\n", "ps3=et.varvarPlot(ax,dSOG,obsvar,modvar,cols=('y','darkturquoise','navy'),lname='SOG')\n", "ps4=et.varvarPlot(ax,dNSOG,obsvar,modvar,cols=('m','darkturquoise','navy'),lname='NSOGF')\n", "ax.legend(handles=[ps1[0][0],ps2[0][0],ps3[0][0],ps4[0][0]])\n", "ax.set_xlabel('Obs')\n", "ax.set_ylabel('Model')\n", "ax.set_title('Si ($\\mu$M)')" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Ratios" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig,ax=plt.subplots(1,2,figsize=(16,7))\n", "p1=ax[0].plot(dJDF['N'],dJDF['Si'],'b.',label='SJDF')\n", "p2=ax[0].plot(dSJGI['N'],dSJGI['Si'],'c.',label='SJGI')\n", "p3=ax[0].plot(dSOG['N'],dSOG['Si'],'y.',label='SOG')\n", "p4=ax[0].plot(dNSOG['N'],dNSOG['Si'],'m.',label='NSOG')\n", "ax[0].set_title('Observed')\n", "ax[0].set_xlabel('N')\n", "ax[0].set_ylabel('Si')\n", "ax[0].set_xlim(0,40)\n", "ax[0].set_ylim(0,85)\n", "ax[0].legend()\n", "\n", "p5=ax[1].plot(dJDF['mod_nitrate'],dJDF['mod_silicon'],'b.',label='SJDF')\n", "p6=ax[1].plot(dSJGI['mod_nitrate'],dSJGI['mod_silicon'],'c.',label='SJGI')\n", "p7=ax[1].plot(dSOG['mod_nitrate'],dSOG['mod_silicon'],'y.',label='SOG')\n", "p8=ax[1].plot(dNSOG['mod_nitrate'],dNSOG['mod_silicon'],'m.',label='NSOG')\n", "ax[1].set_title('Model')\n", "ax[1].set_xlabel('N')\n", "ax[1].set_ylabel('Si')\n", "ax[1].set_xlim(0,40)\n", "ax[1].set_ylim(0,85)\n", "ax[1].legend()\n", "ax[0].plot(np.arange(0,35),1.3*np.arange(0,35),'k-')\n", "ax[1].plot(np.arange(0,35),1.3*np.arange(0,35),'k-')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig,ax=plt.subplots(1,2,figsize=(16,7))\n", "p1=ax[0].plot(dJDF['AbsSal'], dJDF['Si']-1.3*dJDF['N'],'b.',label='SJDF')\n", "p2=ax[0].plot(dSJGI['AbsSal'],dSJGI['Si']-1.3*dSJGI['N'],'c.',label='SJGI')\n", "p3=ax[0].plot(dSOG['AbsSal'],dSOG['Si']-1.3*dSOG['N'],'y.',label='SOG')\n", "p4=ax[0].plot(dNSOG['AbsSal'],dNSOG['Si']-1.3*dNSOG['N'],'m.',label='NSOG')\n", "ax[0].set_title('Observed')\n", "ax[0].set_xlabel('S')\n", "ax[0].set_ylabel('Si-1.3N')\n", "ax[0].set_xlim(10,35)\n", "ax[0].set_ylim(0,45)\n", "ax[0].legend()\n", "\n", "p5=ax[1].plot(dJDF['mod_vosaline'],dJDF['mod_silicon']-1.3*dJDF['mod_nitrate'],'b.',label='SJDF')\n", "p6=ax[1].plot(dSJGI['mod_vosaline'],dSJGI['mod_silicon']-1.3*dSJGI['mod_nitrate'],'c.',label='SJGI')\n", "p7=ax[1].plot(dSOG['mod_vosaline'],dSOG['mod_silicon']-1.3*dSOG['mod_nitrate'],'y.',label='SOG')\n", "p8=ax[1].plot(dNSOG['mod_vosaline'],dNSOG['mod_silicon']-1.3*dNSOG['mod_nitrate'],'m.',label='NSOG')\n", "ax[1].set_title('Model')\n", "ax[1].set_xlabel('S')\n", "ax[1].set_ylabel('Si-1.3N')\n", "ax[1].set_xlim(10,35)\n", "ax[1].set_ylim(0,45)\n", "ax[1].legend()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "data.loc[data.Si>65,['Month','Lat','Lon','Z','Si']]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Chlorophyll" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "data['l10_obsChl']=np.log10(data['Chlorophyll_Extracted']+0.01)\n", "data['l10_modChl']=np.log10(2*(data['mod_diatoms']+data['mod_ciliates']+data['mod_flagellates'])+0.01)\n", "data['mod_Chl']=2*(data['mod_diatoms']+data['mod_ciliates']+data['mod_flagellates'])" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print('log10[Chl+0.01]')\n", "print('z<15 m:')\n", "et.printstats(data.loc[data.Z<15,:],'l10_obsChl','l10_modChl')\n", "print('z>=15 m:')\n", "et.printstats(data.loc[data.Z>=15,:],'l10_obsChl','l10_modChl')\n", "print('all:')\n", "et.printstats(data,'l10_obsChl','l10_modChl')\n", "print('\\n')\n", "print('Chl')\n", "print('z<15 m:')\n", "et.printstats(data.loc[data.Z<15,:],'Chlorophyll_Extracted','mod_Chl')\n", "print('z>=15 m:')\n", "et.printstats(data.loc[data.Z>=15,:],'Chlorophyll_Extracted','mod_Chl')\n", "print('all:')\n", "et.printstats(data,'Chlorophyll_Extracted','mod_Chl')\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig, ax = plt.subplots(1,2,figsize = (14,6))\n", "ax[0].plot(np.arange(-.6,1.6,.1),np.arange(-.6,1.6,.1),'k-')\n", "ps=et.varvarPlot(ax[0],data,'l10_obsChl','l10_modChl','Z',(5,10,15,20,25),'z','m',('crimson','darkorange','lime','mediumseagreen','darkturquoise','navy'))\n", "ax[0].legend(handles=ps)\n", "ax[0].set_xlabel('Obs')\n", "ax[0].set_ylabel('Model')\n", "ax[0].set_title('log10[Chl ($\\mu$g/L)+0.01]')\n", "ax[1].plot(np.arange(0,35),np.arange(0,35),'k-')\n", "ps=et.varvarPlot(ax[1],data,'Chlorophyll_Extracted','mod_Chl','Z',(5,10,15,20,25),'z','m',('crimson','darkorange','lime','mediumseagreen','darkturquoise','navy'))\n", "ax[1].legend(handles=ps)\n", "ax[1].set_xlabel('Obs')\n", "ax[1].set_ylabel('Model')\n", "ax[1].set_title('Chl ($\\mu$g/L)')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [conda env:python36]", "language": "python", "name": "conda-env-python36-py" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 2 }