Skip to content

Commit 52aea3c

Browse files
committed
Update: TDR plots
1 parent eb48a53 commit 52aea3c

File tree

1 file changed

+29
-61
lines changed

1 file changed

+29
-61
lines changed

wqf/val/tdr.py

Lines changed: 29 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import xarray as xr
1414
from matplotlib import colors as plc
1515

16-
from wqf.interface.constants import DID_LAT
17-
from wqf.interface.constants import DID_LON
1816
from wqf.interface.constants import DID_TIM
1917
from wqf.readerfactory import ReaderFactory
2018
from wqf.val.period import Period
@@ -147,25 +145,17 @@ def chlorophyll_variability():
147145
"""
148146
The variability of the (spatial) mean chlorophyll concentration within
149147
the annual cycle illustrates blooms in spring and fall.
150-
151-
The figure considers coastal waters only, which are our main interest.
152148
"""
153149
DensityPlot().plot(
154-
(
155-
cube.doy,
156-
xr.where(cube.deptho < 30.0, cube.chl, np.nan).mean(
157-
[DID_LAT, DID_LON]
158-
),
159-
),
150+
(cube.doy, cube.chl),
160151
xlabel="day of year",
161-
ylabel=r"mean chlorophyll concentration (mg m$^{-3}$)",
152+
ylabel=r"chlorophyll concentration (mg m$^{-3}$)",
162153
fn="fig08",
163154
bins=(50, 50),
164155
cbar_label="number count",
165156
density=False,
166-
hist_range=((40, 310), (0.0, 10)),
167-
vmin=0.0,
168-
vmax=6.0,
157+
hist_range=((60, 290), (0.0, 50)),
158+
norm=plc.SymLogNorm(100.0, vmin=0.0, vmax=1000000.0),
169159
).clear()
170160

171161

@@ -222,7 +212,7 @@ def number_of_chlorophyll_observations_from_space():
222212
fn="fig10",
223213
bins=25,
224214
log=True,
225-
hist_range=(0.0, 100.0),
215+
hist_range=(0.03, 30.0),
226216
).clear()
227217

228218

@@ -242,32 +232,21 @@ def depth_of_sea_floor():
242232
mainly.
243233
"""
244234
ScenePlot().plot(
245-
cube.deptho,
235+
cube.deptho.mean(DID_TIM),
246236
fn="fig11",
247237
cbar_label="sea floor depth below geoid (m)",
248238
xlocs=(1.0, 2.5, 4.0, 5.5, 7.0, 8.5, 10.0),
249239
).clear()
250240
DensityPlot().plot(
251-
(cube.deptho, cube.chl.mean(DID_TIM)),
241+
(cube.deptho, cube.chl),
252242
xlabel="sea floor depth below geoid (m)",
253-
ylabel=r"mean chlorophyll concentration (mg m$^{-3}$)",
243+
ylabel=r"chlorophyll concentration (mg m$^{-3}$)",
254244
fn="fig12",
255245
bins=(50, 50),
256246
cbar_label="number count",
257247
density=False,
258248
hist_range=((0.0, 50.0), (0.0, 50.0)),
259-
norm=plc.SymLogNorm(1.0, vmin=0.0, vmax=2000.0),
260-
).clear()
261-
DensityPlot().plot(
262-
(cube.deptho, cube.chl.std(DID_TIM)),
263-
xlabel="sea floor depth below geoid (m)",
264-
ylabel=r"std. dev. of chlorophyll concentration (mg m$^{-3}$)",
265-
fn="fig13",
266-
bins=(50, 50),
267-
cbar_label="number count",
268-
density=False,
269-
hist_range=((0.0, 50.0), (0.0, 50.0)),
270-
norm=plc.SymLogNorm(1.0, vmin=0.0, vmax=2000.0),
249+
norm=plc.SymLogNorm(100.0, vmin=0.0, vmax=1000000.0),
271250
).clear()
272251

273252

@@ -282,70 +261,59 @@ def examples_of_statistical_correlations():
282261
correlation separately.
283262
"""
284263
DensityPlot().plot(
285-
(cube.mdt, cube.chl.mean(DID_TIM)),
264+
(cube.mdt, cube.chl),
286265
xlabel="mean dynamic topography (m)",
287-
ylabel=r"mean chlorophyll concentration (mg m$^{-3}$)",
266+
ylabel=r"chlorophyll concentration (mg m$^{-3}$)",
288267
fn="fig14",
289268
bins=(50, 50),
290269
cbar_label="number count",
291270
density=False,
292271
hist_range=((-0.53, -0.27), (0.0, 50.0)),
293-
norm=plc.SymLogNorm(1.0, vmin=0.0, vmax=2000.0),
272+
norm=plc.SymLogNorm(100.0, vmin=0.0, vmax=1000000.0),
294273
).clear()
295274
DensityPlot().plot(
296-
(cube.sst.mean(DID_TIM), cube.chl.mean(DID_TIM)),
275+
(cube.sst, cube.chl),
297276
xlabel="sea surface temperature (K)",
298-
ylabel=r"mean chlorophyll concentration (mg m$^{-3}$)",
277+
ylabel=r"chlorophyll concentration (mg m$^{-3}$)",
299278
fn="fig15",
300279
bins=(50, 50),
301280
cbar_label="number count",
302281
density=False,
303-
hist_range=((284.0, 289.0), (0.0, 50.0)),
304-
norm=plc.SymLogNorm(1.0, vmin=0.0, vmax=2000.0),
305-
).clear()
306-
DensityPlot().plot(
307-
(cube.sst.std(DID_TIM), cube.chl.mean(DID_TIM)),
308-
xlabel="sea surface temperature (K)",
309-
ylabel=r"std. dev. of chlorophyll concentration (mg m$^{-3}$)",
310-
fn="fig16",
311-
bins=(50, 50),
312-
cbar_label="number count",
313-
density=False,
314-
hist_range=((2.0, 7.0), (0.0, 50.0)),
315-
norm=plc.SymLogNorm(1.0, vmin=0.0, vmax=2000.0),
282+
hist_range=((270.0, 300.0), (0.0, 50.0)),
283+
norm=plc.SymLogNorm(100.0, vmin=0.0, vmax=1000000.0),
316284
).clear()
317285
DensityPlot().plot(
318-
(cube.so.mean(DID_TIM), cube.chl.mean(DID_TIM)),
319-
xlabel="surface salinity (10-3)",
320-
ylabel=r"mean chlorophyll concentration (mg m$^{-3}$)",
286+
(cube.so, cube.chl),
287+
xlabel=r"sea water salinity (10$^{-3}$)",
288+
ylabel=r"chlorophyll concentration (mg m$^{-3}$)",
321289
fn="fig17",
322290
bins=(50, 50),
323291
cbar_label="number count",
324292
density=False,
325293
hist_range=((0.0, 50.0), (0.0, 50.0)),
326-
norm=plc.SymLogNorm(1.0, vmin=0.0, vmax=2000.0),
294+
norm=plc.SymLogNorm(100.0, vmin=0.0, vmax=1000000.0),
327295
).clear()
328296
DensityPlot().plot(
329-
(cube.mlotst.mean(DID_TIM), cube.chl.mean(DID_TIM)),
297+
(cube.mlotst, cube.chl),
330298
xlabel="mixed layer thickness (m)",
331-
ylabel=r"mean chlorophyll concentration (mg m$^{-3}$)",
299+
ylabel=r"chlorophyll concentration (mg m$^{-3}$)",
332300
fn="fig18",
333301
bins=(50, 50),
334302
cbar_label="number count",
335303
density=False,
336304
hist_range=((0.0, 50.0), (0.0, 50.0)),
337-
norm=plc.SymLogNorm(1.0, vmin=0.0, vmax=2000.0),
305+
norm=plc.SymLogNorm(100.0, vmin=0.0, vmax=1000000.0),
338306
).clear()
339307
DensityPlot().plot(
340-
(cube.mlotst.mean(DID_TIM), cube.deptho),
341-
xlabel="sea floor depth below geoid (m)",
342-
ylabel="mixed layer thickness (m)",
343-
fn="fig19",
308+
(cube.no3, cube.chl),
309+
xlabel=r"nitrate concentration (mmol m$^{-3}$)",
310+
ylabel=r"chlorophyll concentration (mg m$^{-3}$)",
311+
fn="fig20",
344312
bins=(50, 50),
345313
cbar_label="number count",
346314
density=False,
347315
hist_range=((0.0, 200.0), (0.0, 50.0)),
348-
norm=plc.SymLogNorm(1.0, vmin=0.0, vmax=2000.0),
316+
norm=plc.SymLogNorm(100.0, vmin=0.0, vmax=1000000.0),
349317
).clear()
350318

351319

@@ -370,7 +338,7 @@ def examples_of_statistical_correlations():
370338

371339
args = parser.parse_args()
372340
reader = ReaderFactory.create_reader(args.aws)
373-
cube = reader.read(args.cube_id, depth_level=3.0, unify=False)
341+
cube = reader.read(args.cube_id, depth_level=3.0, unify=True)
374342
chl_q_lo = cube.chl.quantile(0.005, dim=DID_TIM).compute()
375343
chl_q_hi = cube.chl.quantile(0.995, dim=DID_TIM).compute()
376344

0 commit comments

Comments
 (0)