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 0x2ad7570533d0>
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.e22a06.G1850ECOIAF_JRA_PHYS_DEV.TL319_g17.scope_v1"
component = "pop"
stream = "h"
cluster_scheduler_address = "tcp://10.12.206.26:40301"
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-d6321e40-0c3c-11ed-ba7c-3cecef1b11d4

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

Scheduler Info

Scheduler

Scheduler-59153102-2d90-4250-b1d9-5b9f28512082

Comm: tcp://10.12.206.26:40301 Workers: 32
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/36768/status Total threads: 32
Started: 16 minutes ago Total memory: 744.96 GiB

Workers

Worker: PBSCluster-0

Comm: tcp://10.12.206.25:41180 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/42193/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.25:34568
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-smli87lm
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 390.98 MiB Spilled bytes: 0 B
Read bytes: 290.06 MiB Write bytes: 80.70 MiB

Worker: PBSCluster-1

Comm: tcp://10.12.206.23:35055 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/39970/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.23:39298
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-pajhhimy
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 397.20 MiB Spilled bytes: 0 B
Read bytes: 260.91 MiB Write bytes: 81.68 kiB

Worker: PBSCluster-10

Comm: tcp://10.12.206.18:39960 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/40058/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.18:33787
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-frtdc9f5
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 352.55 MiB Spilled bytes: 0 B
Read bytes: 64.64 MiB Write bytes: 32.69 MiB

Worker: PBSCluster-11

Comm: tcp://10.12.206.18:35287 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/39615/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.18:36732
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-mmo_bs6s
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 352.64 MiB Spilled bytes: 0 B
Read bytes: 64.60 MiB Write bytes: 32.65 MiB

Worker: PBSCluster-12

Comm: tcp://10.12.206.8:33729 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/35711/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.8:43143
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-svc02rvq
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 331.82 MiB Spilled bytes: 0 B
Read bytes: 145.00 MiB Write bytes: 96.67 MiB

Worker: PBSCluster-13

Comm: tcp://10.12.206.8:37550 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/38907/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.8:40235
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-lys_uzzv
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 467.03 MiB Spilled bytes: 0 B
Read bytes: 145.23 MiB Write bytes: 96.82 MiB

Worker: PBSCluster-14

Comm: tcp://10.12.206.25:44992 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/44154/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.25:43428
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-76two5nt
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 382.27 MiB Spilled bytes: 0 B
Read bytes: 289.95 MiB Write bytes: 80.67 MiB

Worker: PBSCluster-15

Comm: tcp://10.12.206.15:43062 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/32926/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.15:39144
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-jy38onqp
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 399.85 MiB Spilled bytes: 0 B
Read bytes: 145.30 MiB Write bytes: 112.87 MiB

Worker: PBSCluster-16

Comm: tcp://10.12.206.8:43565 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/41710/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.8:45391
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-_7ilj7sa
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 398.36 MiB Spilled bytes: 0 B
Read bytes: 144.82 MiB Write bytes: 96.56 MiB

Worker: PBSCluster-17

Comm: tcp://10.12.206.11:40919 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/45664/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.11:40649
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-o65npiy5
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 478.59 MiB Spilled bytes: 0 B
Read bytes: 578.25 MiB Write bytes: 2.91 GiB

Worker: PBSCluster-18

Comm: tcp://10.12.206.11:33891 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/38384/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.11:33328
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-nou8aprr
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.59 MiB Spilled bytes: 0 B
Read bytes: 579.91 MiB Write bytes: 2.91 GiB

Worker: PBSCluster-19

Comm: tcp://10.12.206.15:36904 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/35533/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.15:34961
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-r5hakwxw
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 322.80 MiB Spilled bytes: 0 B
Read bytes: 160.92 MiB Write bytes: 96.70 MiB

Worker: PBSCluster-2

Comm: tcp://10.12.206.15:43006 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/39124/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.15:43393
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-mmk9h6y4
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 395.75 MiB Spilled bytes: 0 B
Read bytes: 161.35 MiB Write bytes: 96.85 MiB

Worker: PBSCluster-20

Comm: tcp://10.12.206.18:45916 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/35027/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.18:43737
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-xa8tkihj
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.34 MiB Spilled bytes: 0 B
Read bytes: 64.56 MiB Write bytes: 32.65 MiB

Worker: PBSCluster-21

Comm: tcp://10.12.206.11:45334 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/46680/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.11:46761
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-t02yg0d0
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.97 MiB Spilled bytes: 0 B
Read bytes: 579.54 MiB Write bytes: 2.90 GiB

Worker: PBSCluster-22

Comm: tcp://10.12.206.18:34993 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/44524/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.18:46562
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-3e1h8ye1
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.68 MiB Spilled bytes: 0 B
Read bytes: 64.40 MiB Write bytes: 32.55 MiB

Worker: PBSCluster-23

Comm: tcp://10.12.206.15:39733 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/46168/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.15:41249
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-xyvrzxs3
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 363.87 MiB Spilled bytes: 0 B
Read bytes: 150.81 MiB Write bytes: 112.76 MiB

Worker: PBSCluster-24

Comm: tcp://10.12.206.25:44221 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/45234/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.25:40387
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-yfm951kg
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 450.05 MiB Spilled bytes: 0 B
Read bytes: 273.89 MiB Write bytes: 48.43 MiB

Worker: PBSCluster-25

Comm: tcp://10.12.206.18:33408 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/43488/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.18:41022
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-6df9eo6t
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 347.35 MiB Spilled bytes: 0 B
Read bytes: 64.50 MiB Write bytes: 32.60 MiB

Worker: PBSCluster-26

Comm: tcp://10.12.206.8:38884 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/39795/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.8:40143
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-sb74tso9
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 390.69 MiB Spilled bytes: 0 B
Read bytes: 145.17 MiB Write bytes: 96.79 MiB

Worker: PBSCluster-27

Comm: tcp://10.12.206.15:40873 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/45934/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.15:41861
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-2tgmhfdl
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 339.43 MiB Spilled bytes: 0 B
Read bytes: 149.18 MiB Write bytes: 96.88 MiB

Worker: PBSCluster-28

Comm: tcp://10.12.206.18:36750 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/42860/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.18:43661
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-6lr4z8hl
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 349.54 MiB Spilled bytes: 0 B
Read bytes: 64.66 MiB Write bytes: 32.68 MiB

Worker: PBSCluster-29

Comm: tcp://10.12.206.8:32978 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/46650/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.8:38238
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-ihw76ltj
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 332.23 MiB Spilled bytes: 0 B
Read bytes: 145.01 MiB Write bytes: 96.68 MiB

Worker: PBSCluster-3

Comm: tcp://10.12.206.18:34352 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/35771/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.18:32780
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-l8qf3wzg
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 450.22 MiB Spilled bytes: 0 B
Read bytes: 64.44 MiB Write bytes: 32.58 MiB

Worker: PBSCluster-30

Comm: tcp://10.12.206.8:39013 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/33562/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.8:40233
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-peochg10
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 449.32 MiB Spilled bytes: 0 B
Read bytes: 145.15 MiB Write bytes: 96.78 MiB

Worker: PBSCluster-31

Comm: tcp://10.12.206.25:43689 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/43012/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.25:43417
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-yfzy1i0u
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 481.39 MiB Spilled bytes: 0 B
Read bytes: 289.79 MiB Write bytes: 80.63 MiB

Worker: PBSCluster-4

Comm: tcp://10.12.206.13:33058 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/43170/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.13:39266
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-yy1kkjd5
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 423.99 MiB Spilled bytes: 0 B
Read bytes: 385.71 MiB Write bytes: 111.13 MiB

Worker: PBSCluster-5

Comm: tcp://10.12.206.23:36916 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/42702/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.23:45113
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-8th_y8dw
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 393.43 MiB Spilled bytes: 0 B
Read bytes: 260.85 MiB Write bytes: 82.13 kiB

Worker: PBSCluster-6

Comm: tcp://10.12.206.8:38424 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/46679/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.8:44217
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-ml7gmjn8
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 0.0% Last seen: Just now
Memory usage: 445.42 MiB Spilled bytes: 0 B
Read bytes: 144.92 MiB Write bytes: 96.62 MiB

Worker: PBSCluster-7

Comm: tcp://10.12.206.25:44991 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/42629/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.25:45710
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-ab599zkf
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 329.04 MiB Spilled bytes: 0 B
Read bytes: 274.22 MiB Write bytes: 48.48 MiB

Worker: PBSCluster-8

Comm: tcp://10.12.206.25:42326 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/44451/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.25:35373
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-3gi9oohh
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 395.69 MiB Spilled bytes: 0 B
Read bytes: 274.23 MiB Write bytes: 48.48 MiB

Worker: PBSCluster-9

Comm: tcp://10.12.206.15:35080 Total threads: 1
Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/kristenk/proxy/46851/status Memory: 23.28 GiB
Nanny: tcp://10.12.206.15:39139
Local directory: /glade/scratch/kristenk/dask-workers/dask-worker-space/worker-9ijbos11
Tasks executing: 0 Tasks in memory: 0
Tasks ready: 0 Tasks in flight: 0
CPU usage: 2.0% Last seen: Just now
Memory usage: 347.79 MiB Spilled bytes: 0 B
Read bytes: 161.50 MiB Write bytes: 96.94 MiB

Load the data#

dsets = catalog.to_dataset_dict(
    case=casename,
    component=component,
    stream=stream,
)
dsets.keys()
dict_keys(['g.e22a06.G1850ECOIAF_JRA_PHYS_DEV.TL319_g17.scope_v1.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 0x2ad75b8eb2d0>
_images/ocn-chl_18_1.png
ds.coccoChl.isel(time=6,z_t_150m=0).plot()
<matplotlib.collections.QuadMesh at 0x2ad75bf35d50>
_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 0x2ad75d1fb590>
_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