Chlorophyll#

%load_ext autoreload
%autoreload 2
import xarray as xr

from dask.distributed import Client

import catalog
import util

xr.set_options(keep_attrs=True)
/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
<xarray.core.options.set_options at 0x2b8bb1c8a910>
import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs
import pop_tools
from glob import glob
ds_grid = pop_tools.get_grid('POP_gx1v7')
lons=ds_grid.TLONG
lats=ds_grid.TLAT

Parameters#

casename = 'g.e22a06.G1850ECOIAF_JRA_PHYS_DEV.TL319_g17.scope_v1'
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-98a7bea4-9357-11ed-9dbf-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: 18 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: 370.66 MiB Spilled bytes: 0 B
Read bytes: 606.69 MiB Write bytes: 317.98 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: 451.63 MiB Spilled bytes: 0 B
Read bytes: 26.42 kiB Write bytes: 187.52 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: 2.0% Last seen: Just now
Memory usage: 465.55 MiB Spilled bytes: 0 B
Read bytes: 60.05 kiB Write bytes: 169.62 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: 440.75 MiB Spilled bytes: 0 B
Read bytes: 26.79 kiB Write bytes: 97.99 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: 409.69 MiB Spilled bytes: 0 B
Read bytes: 21.96 kiB Write bytes: 9.23 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: 419.20 MiB Spilled bytes: 0 B
Read bytes: 23.75 kiB Write bytes: 17.81 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: 471.54 MiB Spilled bytes: 0 B
Read bytes: 22.46 kiB Write bytes: 11.67 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: 414.73 MiB Spilled bytes: 0 B
Read bytes: 624.06 MiB Write bytes: 317.82 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: 418.30 MiB Spilled bytes: 0 B
Read bytes: 60.05 kiB Write bytes: 167.99 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: 419.41 MiB Spilled bytes: 0 B
Read bytes: 22.11 kiB Write bytes: 10.05 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: 416.61 MiB Spilled bytes: 0 B
Read bytes: 622.72 MiB Write bytes: 317.74 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: 366.07 MiB Spilled bytes: 0 B
Read bytes: 115.06 kiB Write bytes: 154.43 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: 372.92 MiB Spilled bytes: 0 B
Read bytes: 22.07 kiB Write bytes: 10.04 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: 422.77 MiB Spilled bytes: 0 B
Read bytes: 26.39 kiB Write bytes: 186.09 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: 431.78 MiB Spilled bytes: 0 B
Read bytes: 24.49 kiB Write bytes: 14.78 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: 0.0% Last seen: Just now
Memory usage: 422.23 MiB Spilled bytes: 0 B
Read bytes: 117.44 kiB Write bytes: 147.33 kiB

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: 465.92 MiB Spilled bytes: 0 B
Read bytes: 26.48 kiB Write bytes: 187.14 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: 2.0% Last seen: Just now
Memory usage: 337.23 MiB Spilled bytes: 0 B
Read bytes: 21.58 kiB Write bytes: 12.20 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: 332.09 MiB Spilled bytes: 0 B
Read bytes: 22.43 kiB Write bytes: 11.65 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: 366.78 MiB Spilled bytes: 0 B
Read bytes: 21.54 kiB Write bytes: 12.98 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: 4.0% Last seen: Just now
Memory usage: 401.50 MiB Spilled bytes: 0 B
Read bytes: 20.82 kiB Write bytes: 12.97 kiB

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: 412.32 MiB Spilled bytes: 0 B
Read bytes: 59.98 kiB Write bytes: 167.00 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: 2.0% Last seen: Just now
Memory usage: 411.77 MiB Spilled bytes: 0 B
Read bytes: 21.54 kiB Write bytes: 9.76 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: 348.46 MiB Spilled bytes: 0 B
Read bytes: 60.08 kiB Write bytes: 165.64 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: 420.88 MiB Spilled bytes: 0 B
Read bytes: 21.97 kiB Write bytes: 8.43 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: 373.14 MiB Spilled bytes: 0 B
Read bytes: 60.01 kiB Write bytes: 167.87 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: 356.48 MiB Spilled bytes: 0 B
Read bytes: 624.50 MiB Write bytes: 317.86 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: 0.0% Last seen: Just now
Memory usage: 347.27 MiB Spilled bytes: 0 B
Read bytes: 100.46 kiB Write bytes: 32.40 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: 0.0% Last seen: Just now
Memory usage: 347.30 MiB Spilled bytes: 0 B
Read bytes: 60.02 kiB Write bytes: 169.52 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: 350.98 MiB Spilled bytes: 0 B
Read bytes: 22.88 kiB Write bytes: 13.39 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: 4.0% Last seen: Just now
Memory usage: 417.31 MiB Spilled bytes: 0 B
Read bytes: 21.55 kiB Write bytes: 11.37 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: 536.99 MiB Spilled bytes: 0 B
Read bytes: 59.94 kiB Write bytes: 165.26 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'])

Compute long-term mean and plot#

ds = dsets[f'{casename}.{component}.{stream}']

Variable list#

variables =['diatChl', 'coccoChl','spChl','diazChl']
keep_vars=['z_t','z_t_150m','dz','time_bound','TAREA','TLAT','TLONG'] + variables
ds = ds.drop([v for v in ds.variables if v not in keep_vars])
ds.coccoChl.isel(time=0,z_t_150m=0).plot()
<matplotlib.collections.QuadMesh at 0x2b8bb613f710>
_images/ocn-chl_18_1.png
ds.coccoChl.isel(time=6,z_t_150m=0).plot()
<matplotlib.collections.QuadMesh at 0x2b8bb7846a50>
_images/ocn-chl_19_1.png
ds = ds.isel(z_t_150m=0)
ds['Chl_surf'] = ds.spChl + ds.diatChl + ds.coccoChl + ds.diazChl
dt_wgt = ds.time_bound.diff('d2').squeeze()
dt_wgt /= dt_wgt.sum()
dt_wgt
<xarray.DataArray 'time_bound' (time: 120)>
dask.array<truediv, shape=(120,), dtype=float64, chunksize=(1,), chunktype=numpy.ndarray>
Coordinates:
    z_t_150m  float32 500.0
Dimensions without coordinates: time
Attributes:
    long_name:  boundaries for time-averaging interval
    units:      days since 0000-01-01 00:00:00
ds = ds.weighted(dt_wgt).mean('time')
ds['Chl_surf'].plot(vmin=0,vmax=2)
<matplotlib.collections.QuadMesh at 0x2b8bb7ab4fd0>
_images/ocn-chl_24_1.png

Grab Globcolour observations of Chlorophyll#

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')

Plot maps comparisons (first on linear scale, then on log scale)#

cpt = 'Greens'
###### 
fig = plt.figure(figsize=(8,8))

ax = fig.add_subplot(2,1,1, projection=ccrs.Robinson(central_longitude=305.0))
ax.set_title('CESM Chl', fontsize=12)
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds.Chl_surf)
ax.coastlines('110m',linewidth=0.75)
pc=ax.pcolormesh(lon, lat, field, cmap=cpt,vmin=0,vmax=1.5,transform=ccrs.PlateCarree())

ax = fig.add_subplot(2,1,2, projection=ccrs.Robinson(central_longitude=305.0))
ax.set_title('Satellite Chl', fontsize=12)
pc=ax.pcolormesh(ds_sat.lon, ds_sat.lat, ds_sat.CHL1_mean, cmap=cpt,vmin=0,vmax=1.5,transform=ccrs.PlateCarree())
ax.coastlines('110m',linewidth=0.75)

fig.subplots_adjust(right=0.8)
cbar_ax = fig.add_axes([0.85, 0.15, 0.04, 0.7])
#cbar = fig.colorbar(pc, cax=cbar_ax,**colorbar_specs)
cbar1 = fig.colorbar(pc, cax=cbar_ax,extend='max',label='Chlorophyll at surface (mg m$^{-3}$)');
_images/ocn-chl_30_0.png
import matplotlib.colors as colors
###### 
fig = plt.figure(figsize=(8,8))

ax = fig.add_subplot(2,1,1, projection=ccrs.Robinson(central_longitude=305.0))
ax.set_title('CESM Chl', fontsize=12)
lon, lat, field = util.adjust_pop_grid(lons, lats,  ds.Chl_surf)
ax.coastlines('110m',linewidth=0.75)
pc=ax.pcolormesh(lon, lat, field, cmap=cpt,norm=colors.LogNorm(vmin=0.1, vmax=3),transform=ccrs.PlateCarree())

ax = fig.add_subplot(2,1,2, projection=ccrs.Robinson(central_longitude=305.0))
ax.set_title('Satellite Chl', fontsize=12)
pc=ax.pcolormesh(ds_sat.lon, ds_sat.lat, ds_sat.CHL1_mean, cmap=cpt,norm=colors.LogNorm(vmin=0.1, vmax=3),transform=ccrs.PlateCarree())
ax.coastlines('110m',linewidth=0.75)

fig.subplots_adjust(right=0.8)
cbar_ax = fig.add_axes([0.85, 0.15, 0.04, 0.7])
#cbar = fig.colorbar(pc, cax=cbar_ax,**colorbar_specs)
cbar1 = fig.colorbar(pc, cax=cbar_ax,extend='max',label='Chlorophyll at surface (mg m$^{-3}$)');
_images/ocn-chl_32_0.png