@@ -150,8 +150,6 @@ if saveFigs:
150150
151151# Differences between mask and retrieval fractions
152152
153- Still need to print out mean value of difference
154-
155153``` {code-cell} ipython3
156154sns.set_context("paper")
157155fig = plt.figure(figsize = (12, 9))
@@ -313,16 +311,24 @@ fig = plt.figure(figsize = (7.75, 8.9))
313311
314312cmap = cc.m_blues
315313axes = fig.subplots(nrows=3, ncols=2, sharex=True, sharey=True)
314+
315+ def get_joint_histo(v, s=""):
316+ hname = f"Cloud_Optical_Thickness_{v}_vs_Cloud_Top_Pressure"
317+ fname = dataDir.joinpath(f"modis-cosp-{hname}.nc")
318+ gmh = global_mean(xr.open_dataset(fname).sel(date=sample_month))
319+ return(gmh[hname])
320+
316321#
317322# Joint histograms vs cloud top pressure: (cloudy, partly-cloudy) x (total, liquid, ice)
318323#
324+ # Normalize the color bar to the figure with the biggest cloud fractions
325+ vmax = np.max(get_joint_histo("Total"))
326+
319327for i, s in enumerate(["", "_PCL"]): # Top row/subset is cloudy, bottom row/subset is partly-cloudy (PCL)
320- for r, v in enumerate(["Ice ", "Liquid ", "Total "]):
328+ for r, v in enumerate(["Total ", "Ice ", "Liquid "]):
321329 hname = f"Cloud_Optical_Thickness{s}_{v}_vs_Cloud_Top_Pressure"
322330 fname = dataDir.joinpath(f"modis-cosp-{hname}.nc")
323331 gmh = global_mean(xr.open_dataset(fname).sel(date=sample_month))
324- # Normalize the color bar to the figure with the biggest cloud fractions
325- if v == "Total" and s == "": vmax = np.max(gmh[hname])
326332 #
327333 # imshow() seems to show the first array dimension from top to bottom and the second dimension
328334 # from left to right, so we transpose the DataArray before plotting
@@ -348,11 +354,9 @@ for i, s in enumerate(["", "_PCL"]): # Top row/subset is cloudy, bottom row/subs
348354 axes[r, i].set_yticks(np.arange(len(jnt_bnds))-.5)
349355 axes[r, i].set_yticklabels(jnt_bnds.values)
350356
351-
352-
353- axes[2,0].annotate("Total", (0,0))
354- axes[1,0].annotate("Liquid", (0,0))
355- axes[0,0].annotate("Ice", (0,0))
357+ axes[0,0].annotate("Total", (0,0))
358+ axes[1,0].annotate("Ice", (0,0))
359+ axes[2,0].annotate("Liquid", (0,0))
356360axes[0,0].annotate("Fully-cloudy", (4,0))
357361axes[0,1].annotate("Partly-cloudy", (4,0))
358362
@@ -371,12 +375,17 @@ axes = fig.subplots(ncols=2, nrows=2, sharex=True)
371375#
372376# Joint histograms of optical thickness vs particle size
373377#
378+ v = "Liquid"; s = ""
379+ hname = f"Cloud_Optical_Thickness_vs_Cloud_Particle_Size{s}_{v}"
380+ fname = dataDir.joinpath(f"modis-cosp-{hname}.nc")
381+ gmh = global_mean(xr.open_dataset(fname).sel(date=sample_month))
382+ vmax = np.max(gmh[hname])
383+
374384for i, s in enumerate(["", "_PCL"]): # Top row/subset is cloudy, bottom row/subset is partly-cloudy (PCL)
375385 for r, v in enumerate(["Ice", "Liquid"]):
376386 hname = f"Cloud_Optical_Thickness_vs_Cloud_Particle_Size{s}_{v}"
377387 fname = dataDir.joinpath(f"modis-cosp-{hname}.nc")
378388 gmh = global_mean(xr.open_dataset(fname).sel(date=sample_month))
379- if v == "Liquid" and s == "": vmax = np.max(gmh[hname])
380389 #
381390 # imshow() seems to show the first array dimension from top to bottom and the second dimension
382391 # from left to right, so we transpose the DataArray before plotting
@@ -404,8 +413,9 @@ for i, s in enumerate(["", "_PCL"]): # Top row/subset is cloudy, bottom row/subs
404413 axes[r, i].set_yticks(np.arange(len(jnt_bnds))-.5)
405414 axes[r, i].set_yticklabels(jnt_bnds.values)
406415 axes[r, i].invert_yaxis()
407- axes[1,0].annotate("Liquid", (0,5))
416+
408417axes[0,0].annotate("Ice", (0,5))
418+ axes[1,0].annotate("Liquid", (0,5))
409419axes[0,0].annotate("Fully-cloudy", (4,5))
410420axes[0,1].annotate("Partly-cloudy", (4,5))
411421
@@ -423,12 +433,17 @@ axes = fig.subplots(ncols=2, nrows=2)
423433#
424434# Joint histograms vs cloud top pressure: (cloudy, partly-cloudy) x (total, liquid, ice)
425435#
436+ v = "Liquid"; s = ""
437+ hname = f"Cloud_Water_Path_vs_Cloud_Particle_Size{s}_{v}"
438+ fname = dataDir.joinpath(f"modis-cosp-{hname}.nc")
439+ gmh = global_mean(xr.open_dataset(fname).sel(date=sample_month))
440+ vmax = np.max(gmh[hname])
441+
426442for i, s in enumerate(["", "_PCL"]): # Top row/subset is cloudy, bottom row/subset is partly-cloudy (PCL)
427443 for r, v in enumerate(["Ice", "Liquid"]):
428444 hname = f"Cloud_Water_Path_vs_Cloud_Particle_Size{s}_{v}"
429445 fname = dataDir.joinpath(f"modis-cosp-{hname}.nc")
430446 gmh = global_mean(xr.open_dataset(fname).sel(date=sample_month))
431- if v == "Liquid" and s == "": vmax = np.max(gmh[hname])
432447 #
433448 # imshow() seems to show the first array dimension from top to bottom and the second dimension
434449 # from left to right, so we transpose the DataArray before plotting
@@ -456,8 +471,8 @@ for i, s in enumerate(["", "_PCL"]): # Top row/subset is cloudy, bottom row/subs
456471 axes[r, i].set_yticklabels(jnt_bnds.values)
457472 axes[r, i].invert_yaxis()
458473
459- axes[1,0].annotate("Liquid", (0,5))
460474axes[0,0].annotate("Ice", (0,5))
475+ axes[1,0].annotate("Liquid", (0,5))
461476axes[0,0].annotate("Fully-cloudy", (4,5))
462477axes[0,1].annotate("Partly-cloudy", (4,5))
463478
@@ -466,7 +481,3 @@ fig.tight_layout()
466481fig.colorbar(pl, ax=axes.ravel().tolist(), shrink = 0.75, aspect = 15, label="Cloud fraction")
467482fig.savefig(figDir.joinpath("LWP-re-histograms.pdf"), dpi=600, transparent=True, bbox_inches = "tight")
468483```
469-
470- ``` {code-cell} ipython3
471-
472- ```
0 commit comments