Paper figures#

%load_ext autoreload
%autoreload 2
import xarray as xr

from dask.distributed import Client
import numpy as np
import catalog
import util
import pandas as pd
xr.set_options(keep_attrs=True)
import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs
import pop_tools
from glob import glob
import matplotlib.gridspec as gridspec
from IPython.display import Image
import matplotlib.colors as colors
/glade/work/kristenk/miniconda/envs/cesm-exp/lib/python3.7/site-packages/dask_jobqueue/core.py:20: FutureWarning: tmpfile is deprecated and will be removed in a future release. Please use dask.utils.tmpfile instead.
  from distributed.utils import tmpfile
ds_grid = pop_tools.get_grid('POP_gx1v7')
lons=ds_grid.TLONG
lats=ds_grid.TLAT

Parameters#

casename = 'g.e22.GOMIPECOIAF_JRA-1p4-2018.TL319_g17.4p2z.001branch'
component = 'pop'
stream = 'h'

cluster_scheduler_address = None
# Parameters
casename = "g.e22.GOMIPECOIAF_JRA-1p4-2018.TL319_g17.4p2z.001branch"
component = "pop"
stream = "h"
cluster_scheduler_address = "tcp://10.12.206.3:35506"
assert component in ['pop']
assert stream in ['h', 'h.ecosys.nday1']

Connect to cluster#

if cluster_scheduler_address is None:
    cluster, client = util.get_ClusterClient()
    cluster.scale(12)
else:
    client = Client(cluster_scheduler_address)
client

Client

Client-5ae962e4-935b-11ed-baf4-3cecef1acc46

Connection method: Direct
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/8787/status

Scheduler Info

Scheduler

Scheduler-7b28f886-17c1-40f8-ae24-3360603786e8

Comm: tcp://10.12.206.3:35506 Workers: 32
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/8787/status Total threads: 32
Started: 45 minutes ago Total memory: 744.96 GiB

Workers

Worker: PBSCluster-0

Comm: tcp://10.12.206.60:40381 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/37473/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.60:43642
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-she593m8
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 528.18 MiB Spilled bytes: 0 B
Read bytes: 626.81 MiB Write bytes: 360.86 kiB

Worker: PBSCluster-1

Comm: tcp://10.12.206.57:34913 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/43168/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.57:40520
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-ais4w5nl
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 604.45 MiB Spilled bytes: 0 B
Read bytes: 21.91 kiB Write bytes: 26.47 kiB

Worker: PBSCluster-10

Comm: tcp://10.12.206.55:40610 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/41580/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.55:41770
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-24q12p4a
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 670.97 MiB Spilled bytes: 0 B
Read bytes: 29.45 kiB Write bytes: 17.44 kiB

Worker: PBSCluster-11

Comm: tcp://10.12.206.35:36760 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/34231/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.35:39163
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-tm589a2g
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 695.59 MiB Spilled bytes: 0 B
Read bytes: 66.53 kiB Write bytes: 40.26 kiB

Worker: PBSCluster-12

Comm: tcp://10.12.206.42:46667 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/44609/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.42:43503
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-63bl396p
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 517.00 MiB Spilled bytes: 0 B
Read bytes: 27.99 kiB Write bytes: 19.08 kiB

Worker: PBSCluster-13

Comm: tcp://10.12.206.55:34741 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/41987/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.55:39933
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-3taktpky
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 550.85 MiB Spilled bytes: 0 B
Read bytes: 29.50 kiB Write bytes: 14.17 kiB

Worker: PBSCluster-14

Comm: tcp://10.12.206.42:44723 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/38884/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.42:37139
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-btgwv71o
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 573.27 MiB Spilled bytes: 0 B
Read bytes: 28.00 kiB Write bytes: 22.31 kiB

Worker: PBSCluster-15

Comm: tcp://10.12.206.60:34840 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/36356/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.60:36517
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-s50upym9
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 540.75 MiB Spilled bytes: 0 B
Read bytes: 626.49 MiB Write bytes: 360.68 kiB

Worker: PBSCluster-16

Comm: tcp://10.12.206.55:33480 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/44604/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.55:34515
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-20gqvxq8
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 543.72 MiB Spilled bytes: 0 B
Read bytes: 29.44 kiB Write bytes: 15.82 kiB

Worker: PBSCluster-17

Comm: tcp://10.12.206.42:46005 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/44117/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.42:32947
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-18iilri4
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 653.80 MiB Spilled bytes: 0 B
Read bytes: 28.00 kiB Write bytes: 21.51 kiB

Worker: PBSCluster-18

Comm: tcp://10.12.206.60:33226 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/42773/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.60:46337
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-8qq6z3y3
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 543.21 MiB Spilled bytes: 0 B
Read bytes: 626.32 MiB Write bytes: 360.58 kiB

Worker: PBSCluster-19

Comm: tcp://10.12.206.36:36934 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/38605/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.36:40345
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-0wibvgh_
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 677.80 MiB Spilled bytes: 0 B
Read bytes: 109.67 kiB Write bytes: 44.74 kiB

Worker: PBSCluster-2

Comm: tcp://10.12.206.42:35532 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/37233/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.42:38029
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-tvn8qi89
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 522.91 MiB Spilled bytes: 0 B
Read bytes: 28.00 kiB Write bytes: 20.70 kiB

Worker: PBSCluster-20

Comm: tcp://10.12.206.57:44618 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/35828/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.57:39590
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-j87b3i6z
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 522.25 MiB Spilled bytes: 0 B
Read bytes: 21.90 kiB Write bytes: 24.85 kiB

Worker: PBSCluster-21

Comm: tcp://10.12.206.42:36146 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/42013/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.42:42567
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-te65hpsa
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 743.91 MiB Spilled bytes: 0 B
Read bytes: 28.01 kiB Write bytes: 24.74 kiB

Worker: PBSCluster-22

Comm: tcp://10.12.206.37:45266 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/41617/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.37:46778
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-6zjl_rf2
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 526.37 MiB Spilled bytes: 0 B
Read bytes: 13.52 MiB Write bytes: 12.27 MiB

Worker: PBSCluster-23

Comm: tcp://10.12.206.57:36646 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/33282/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.57:39220
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-tedt0oqb
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 727.07 MiB Spilled bytes: 0 B
Read bytes: 21.91 kiB Write bytes: 24.86 kiB

Worker: PBSCluster-24

Comm: tcp://10.12.206.35:43781 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/41280/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.35:41682
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-oenmf7ye
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 668.64 MiB Spilled bytes: 0 B
Read bytes: 64.59 kiB Write bytes: 41.90 kiB

Worker: PBSCluster-25

Comm: tcp://10.12.206.42:38958 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/45762/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.42:41096
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-r999w54s
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 552.80 MiB Spilled bytes: 0 B
Read bytes: 28.03 kiB Write bytes: 22.33 kiB

Worker: PBSCluster-26

Comm: tcp://10.12.206.35:41019 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/46197/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.35:41093
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-n8z_ugpj
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 659.64 MiB Spilled bytes: 0 B
Read bytes: 64.54 kiB Write bytes: 41.86 kiB

Worker: PBSCluster-27

Comm: tcp://10.12.206.40:37756 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/34868/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.40:46061
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-ah4h4uwy
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 620.86 MiB Spilled bytes: 0 B
Read bytes: 557.55 kiB Write bytes: 4.24 MiB

Worker: PBSCluster-28

Comm: tcp://10.12.206.55:40536 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/40763/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.55:43688
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-mqh1_swd
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 509.59 MiB Spilled bytes: 0 B
Read bytes: 29.54 kiB Write bytes: 14.19 kiB

Worker: PBSCluster-29

Comm: tcp://10.12.206.35:43010 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/45869/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.35:38155
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-0zp2yifw
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 526.10 MiB Spilled bytes: 0 B
Read bytes: 66.46 kiB Write bytes: 40.21 kiB

Worker: PBSCluster-3

Comm: tcp://10.12.206.55:43243 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/45154/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.55:40506
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-d77lpe1m
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 503.22 MiB Spilled bytes: 0 B
Read bytes: 29.76 kiB Write bytes: 12.93 kiB

Worker: PBSCluster-30

Comm: tcp://10.12.206.42:40059 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/38562/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.42:35150
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-s1j98ibm
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 550.04 MiB Spilled bytes: 0 B
Read bytes: 27.99 kiB Write bytes: 19.08 kiB

Worker: PBSCluster-31

Comm: tcp://10.12.206.55:40509 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/46123/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.55:42505
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-0193oowl
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 508.62 MiB Spilled bytes: 0 B
Read bytes: 29.43 kiB Write bytes: 15.82 kiB

Worker: PBSCluster-4

Comm: tcp://10.12.206.60:33761 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/38547/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.60:43086
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-go_20xsh
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 614.64 MiB Spilled bytes: 0 B
Read bytes: 626.49 MiB Write bytes: 360.68 kiB

Worker: PBSCluster-5

Comm: tcp://10.12.206.56:36183 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/39960/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.56:36523
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-ak_et0qx
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 521.30 MiB Spilled bytes: 0 B
Read bytes: 590.71 MiB Write bytes: 64.80 MiB

Worker: PBSCluster-6

Comm: tcp://10.12.206.55:42418 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/43316/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.55:35755
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-w069mt42
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 500.22 MiB Spilled bytes: 0 B
Read bytes: 29.40 kiB Write bytes: 17.42 kiB

Worker: PBSCluster-7

Comm: tcp://10.12.206.42:38064 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/33959/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.42:37237
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-8g92ok8a
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 510.38 MiB Spilled bytes: 0 B
Read bytes: 28.05 kiB Write bytes: 23.16 kiB

Worker: PBSCluster-8

Comm: tcp://10.12.206.35:46716 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/38950/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.35:46823
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-t0bj5mka
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 511.39 MiB Spilled bytes: 0 B
Read bytes: 65.84 kiB Write bytes: 41.54 kiB

Worker: PBSCluster-9

Comm: tcp://10.12.206.55:36074 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/41381/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.55:35112
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-vzrt3wyj
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 518.33 MiB Spilled bytes: 0 B
Read bytes: 29.77 kiB Write bytes: 12.93 kiB

Load the data#

dsets = catalog.to_dataset_dict(
    case=casename,
    component=component,
    stream=stream,
)
dsets.keys()
g.e22.GOMIPECOIAF_JRA-1p4-2018.TL319_g17.4p2z.001branch pop h /glade/scratch/kristenk/archive
dict_keys(['g.e22.GOMIPECOIAF_JRA-1p4-2018.TL319_g17.4p2z.001branch.pop.h'])
ds = dsets[f'{casename}.{component}.{stream}']

Variable list#

variables =['mesozooC', 'microzooC','diatChl', 'coccoChl',
            'spChl','diazChl','PO4','NO3','SiO3',
           'x_graze_mesozoo_zint','photoC_TOT_zint']
keep_vars=['z_t','z_t_150m','dz','time_bound','time','TAREA','TLAT','TLONG'] + variables
ds = ds.drop([v for v in ds.variables if v not in keep_vars])

Make a monthly climatology dataset#

time = pd.date_range(start="2012-01-01", end="2022-01-01",freq="M")
time
DatetimeIndex(['2012-01-31', '2012-02-29', '2012-03-31', '2012-04-30',
               '2012-05-31', '2012-06-30', '2012-07-31', '2012-08-31',
               '2012-09-30', '2012-10-31',
               ...
               '2021-03-31', '2021-04-30', '2021-05-31', '2021-06-30',
               '2021-07-31', '2021-08-31', '2021-09-30', '2021-10-31',
               '2021-11-30', '2021-12-31'],
              dtype='datetime64[ns]', length=120, freq='M')
mon_ds = ds.copy()
mon_ds['time'] = time
mon_ds = ds.groupby('time.month').mean('time')

Compute long-term mean#

ds = ds.mean(dim='time')

Figure 2: macronutrient maps#

file = '/glade/work/kristenk/WOA_data/regrid_POP/WOA2018_POPgrid.nc' 
ds_woa = xr.load_dataset(file, decode_times=False, decode_coords=False)
ds_woa['z_t'] = ds.z_t

NO3_diff = ds.NO3 - ds_woa.NO3
PO4_diff = ds.PO4 - ds_woa.PO4
SiO3_diff = ds.SiO3 - ds_woa.SiO3
fig = plt.figure(figsize=(14, 6))
gs = gridspec.GridSpec(nrows=3, ncols=6, width_ratios=(1, 1, 0.05, 0.05, 1, 0.05))

prj = ccrs.Robinson(central_longitude=305.0)

ax_no3_woa = plt.subplot(gs[0, 0], projection=prj)
ax_no3_cesm = plt.subplot(gs[0, 1], projection=prj)
cax_no3 = plt.subplot(gs[0, 2])
ax_no3_diff = plt.subplot(gs[0, 4], projection=prj)
cax_no3_diff = plt.subplot(gs[0, 5])

ax_po4_woa = plt.subplot(gs[1, 0], projection=prj)
ax_po4_cesm = plt.subplot(gs[1, 1], projection=prj)
cax_po4 = plt.subplot(gs[1, 2])
ax_po4_diff = plt.subplot(gs[1, 4], projection=prj)
cax_po4_diff = plt.subplot(gs[1, 5])

ax_si_woa = plt.subplot(gs[2, 0], projection=prj)
ax_si_cesm = plt.subplot(gs[2, 1], projection=prj)
cax_si = plt.subplot(gs[2, 2])
ax_si_diff = plt.subplot(gs[2, 4], projection=prj)
cax_si_diff = plt.subplot(gs[2, 5])


### NO3 row
ax_no3_woa.set_title('a) WOA surface NO$_3$', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds_woa.NO3.isel(z_t=0))
pc1=ax_no3_woa.pcolormesh(lon, lat,field, vmin=0, vmax=20, cmap='Oranges',
                 transform=ccrs.PlateCarree())
ax_no3_woa.coastlines('110m',linewidth=0.75)

ax_no3_cesm.set_title('b) CESM surface NO$_3$', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats, ds.NO3.isel(z_t=0))
pc1=ax_no3_cesm.pcolormesh(lon, lat,field, vmin=0, vmax=20, cmap='Oranges',
                 transform=ccrs.PlateCarree())
ax_no3_cesm.coastlines('110m',linewidth=0.75)

cb_no3 = plt.colorbar(pc1, cax=cax_no3,extend='max', 
                      label='NO$_3$ (mmol m$^{-3}$)')

ax_no3_diff.set_title('c) Surface NO$_3$ Bias', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats, NO3_diff.isel(z_t=0))
pc1=ax_no3_diff.pcolormesh(lon, lat,field, vmin=-15, vmax=15, cmap='bwr',
                 transform=ccrs.PlateCarree())
ax_no3_diff.coastlines('110m',linewidth=0.75)

cb_no3_diff = plt.colorbar(pc1, cax=cax_no3_diff,extend='both', 
                      label='NO$_3$ bias (mmol m$^{-3}$)')


### PO4 row
ax_po4_woa.set_title('d) WOA surface PO$_4$', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds_woa.PO4.isel(z_t=0))
pc1=ax_po4_woa.pcolormesh(lon, lat,field, vmin=0, vmax=2, cmap='Oranges',
                 transform=ccrs.PlateCarree())
ax_po4_woa.coastlines('110m',linewidth=0.75)

ax_po4_cesm.set_title('e) CESM surface PO$_4$', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats, ds.PO4.isel(z_t=0))
pc1=ax_po4_cesm.pcolormesh(lon, lat, field, vmin=0, vmax=2, cmap='Oranges',
                 transform=ccrs.PlateCarree())
ax_po4_cesm.coastlines('110m',linewidth=0.75)

cb_po4 = plt.colorbar(pc1, cax=cax_po4,extend='max', 
                      label='PO$_4$ (mmol m$^{-3}$)')

ax_po4_diff.set_title('f) Surface PO$_4$ Bias', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats, PO4_diff.isel(z_t=0))
pc1=ax_po4_diff.pcolormesh(lon, lat,field, vmin=-1, vmax=1, cmap='bwr',
                 transform=ccrs.PlateCarree())
ax_po4_diff.coastlines('110m',linewidth=0.75)

cb_po4_diff = plt.colorbar(pc1, cax=cax_po4_diff,extend='both', 
                      label='PO$_4$ bias (mmol m$^{-3}$)')


### SiO3 row
ax_si_woa.set_title('g) WOA surface SiO$_3$', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds_woa.SiO3.isel(z_t=0))
pc1=ax_si_woa.pcolormesh(lon, lat,field, vmin=0, vmax=30, cmap='Oranges',
                 transform=ccrs.PlateCarree())
ax_si_woa.coastlines('110m',linewidth=0.75)

ax_si_cesm.set_title('h) CESM surface SiO$_3$', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats, ds.SiO3.isel(z_t=0))
pc1=ax_si_cesm.pcolormesh(lon, lat, field, vmin=0, vmax=30, cmap='Oranges',
                 transform=ccrs.PlateCarree())
ax_si_cesm.coastlines('110m',linewidth=0.75)

cb_si = plt.colorbar(pc1, cax=cax_si,extend='max', 
                      label='SiO$_3$ (mmol m$^{-3}$)')

ax_po4_diff.set_title('i) Surface SiO$_3$ Bias', fontsize=10)
lon, lat, field = util.adjust_pop_grid(lons, lats, SiO3_diff.isel(z_t=0))
pc1=ax_si_diff.pcolormesh(lon, lat, field, vmin=-20, vmax=20, cmap='bwr',
                 transform=ccrs.PlateCarree())
ax_si_diff.coastlines('110m',linewidth=0.75)

cb_si_diff = plt.colorbar(pc1, cax=cax_si_diff,extend='both', 
                      label='SiO$_3$ bias (mmol m$^{-3}$)')
_images/ocn-paperfigs_26_0.png

Figure 3. Chlorophyll/COPEPOD comparison#

Garnesson et al., 2019

Moriarty & O’Brien, 2013

file = '/glade/u/home/kristenk/work/copepod-biomass/data/POP_gx1v7/copepod-2012__cmass-m00-qtr.zarr'
ds_copepod = xr.open_zarr(file, consolidated=False)
ds_copepod['copepod_C']=ds_copepod.copepod_C/12.011
ds['Chl_surf'] = ds.spChl.isel(z_t_150m=0) + ds.diatChl.isel(z_t_150m=0) + ds.coccoChl.isel(z_t_150m=0) + ds.diazChl.isel(z_t_150m=0)
path = '/glade/work/kristenk/satellite_data/globcolour_chl/L3m_'
files = []
files.extend(sorted(glob(f'{path}*.nc')))
ds_sat=xr.open_mfdataset(files,concat_dim='time',combine='nested')
ds_sat = ds_sat.mean(dim='time')
fig = plt.figure(figsize=(12, 6))
gs = gridspec.GridSpec(nrows=2, ncols=3, width_ratios=(1, 1, 0.04))

prj = ccrs.Robinson(central_longitude=305.0)

ax_chl_sat = plt.subplot(gs[0, 0], projection=prj)
ax_chl_cesm = plt.subplot(gs[0, 1], projection=prj)
ax_meso_cope = plt.subplot(gs[1, 0], projection=prj)
ax_meso_cesm = plt.subplot(gs[1, 1], projection=prj)

ax_chl_sat.set_title('a) GlobColour chlorophyll', fontsize=12)
pc_chl_sat=ax_chl_sat.pcolormesh(ds_sat.lon, ds_sat.lat, ds_sat.CHL1_mean, 
                     cmap='Greens',norm=colors.LogNorm(vmin=0.1, vmax=3),
                     transform=ccrs.PlateCarree())
ax_chl_sat.coastlines('110m',linewidth=0.75)

ax_chl_cesm.set_title('b) CESM chlorophyll', fontsize=12)
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds.Chl_surf)
ax_chl_cesm.coastlines('110m',linewidth=0.75)
pc_chl_cesm=ax_chl_cesm.pcolormesh(lon, lat, field, cmap='Greens',
                 norm=colors.LogNorm(vmin=0.1, vmax=3),transform=ccrs.PlateCarree())


ax_meso_cope.set_title('c) COPEPOD dataset', fontsize=12)
lon, lat, field = util.adjust_pop_grid(lons, lats, ds_copepod.copepod_C)
pc_meso_cope=ax_meso_cope.pcolormesh(lon, lat, field, cmap='Reds',vmin=0,vmax=2,transform=ccrs.PlateCarree())
ax_meso_cope.coastlines('110m',linewidth=0.5)

ax_meso_cesm.set_title('d) CESM mesozooplankton', fontsize=12)
lon, lat, field = util.adjust_pop_grid(lons, lats, ds.mesozooC.mean(dim='z_t_150m'))
pc_meso_cesm=ax_meso_cesm.pcolormesh(lon, lat, field, cmap='Reds',vmin=0,vmax=2,transform=ccrs.PlateCarree())
ax_meso_cesm.coastlines('110m',linewidth=0.5)

cax_chl = plt.subplot(gs[0, 2])
cax_meso = plt.subplot(gs[1, 2])

cb_chl = plt.colorbar(pc_chl_cesm, cax=cax_chl,extend='max', 
                      label='Chlorophyll at surface (mg m$^{-3}$)')
cb_meso = plt.colorbar(pc_meso_cesm, cax=cax_meso,extend='max', label='top 150m/200m mean (mmol m$^{-3}$)')
_images/ocn-paperfigs_31_0.png
(ds.photoC_TOT_zint * 0.01 * 86400).plot(vmin=0,vmax=50)
<matplotlib.collections.QuadMesh at 0x2ba07e258810>
_images/ocn-paperfigs_32_1.png

Figure X. NPP, mesozoo prod, z-ratio…. or ETE, fish biomass maps#

###### 
fig = plt.figure(figsize=(18,3))

ax = fig.add_subplot(1,3,1, projection=ccrs.Robinson(central_longitude=305.0))
ax.set_title('a) NPP', fontsize=10,loc='left')
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds.photoC_TOT_zint * 0.01 * 86400)
pc=ax.pcolormesh(lon, lat, field, cmap='jet',vmin=0,vmax=60,transform=ccrs.PlateCarree())
ax_meso_cope.coastlines('110m',linewidth=0.5)
cbar1 = fig.colorbar(pc, ax=ax,extend='max',label='NPP (mmol m$^{-2}$ d$^{-1}$)')


ax = fig.add_subplot(1,3,2, projection=ccrs.Robinson(central_longitude=305.0))
ax.set_title('b) Mesozooplankton production', fontsize=10,loc='left')
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds.x_graze_mesozoo_zint * 0.01 * 86400)
pc=ax.pcolormesh(lon, lat, field, cmap='jet',vmin=0,vmax=10,transform=ccrs.PlateCarree())
ax_meso_cope.coastlines('110m',linewidth=0.5)
cbar1 = fig.colorbar(pc, ax=ax,extend='max',label='Mesozoo production (mmol m$^{-2}$ d$^{-1}$)')



ax = fig.add_subplot(1,3,3, projection=ccrs.Robinson(central_longitude=305.0))
ax.set_title('c) z-ratio', fontsize=10,loc='left')
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds.x_graze_mesozoo_zint/ds.photoC_TOT_zint)
pc=ax.pcolormesh(lon, lat, field, cmap='jet',vmin=0,vmax=0.15,transform=ccrs.PlateCarree())
ax_meso_cope.coastlines('110m',linewidth=0.5)
cbar1 = fig.colorbar(pc, ax=ax,extend='max',label='z-ratio')
_images/ocn-paperfigs_34_0.png

Figure 5… seasonal cycles, interannual variability#

Figure X. Regional maps that show mesoscale features..#