Skip to content

Commit e6668a5

Browse files
committed
Final cleanup
1 parent 6a2a654 commit e6668a5

File tree

4 files changed

+35
-22
lines changed

4 files changed

+35
-22
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2022, Robert Pincus
3+
Copyright (c) 2022-2023, Robert Pincus
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

MODIS-COSP-Data-Paper-Figures.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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
156154
sns.set_context("paper")
157155
fig = plt.figure(figsize = (12, 9))
@@ -313,16 +311,24 @@ fig = plt.figure(figsize = (7.75, 8.9))
313311
314312
cmap = cc.m_blues
315313
axes = 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+
319327
for 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))
356360
axes[0,0].annotate("Fully-cloudy", (4,0))
357361
axes[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+
374384
for 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+
408417
axes[0,0].annotate("Ice", (0,5))
418+
axes[1,0].annotate("Liquid", (0,5))
409419
axes[0,0].annotate("Fully-cloudy", (4,5))
410420
axes[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+
426442
for 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))
460474
axes[0,0].annotate("Ice", (0,5))
475+
axes[1,0].annotate("Liquid", (0,5))
461476
axes[0,0].annotate("Fully-cloudy", (4,5))
462477
axes[0,1].annotate("Partly-cloudy", (4,5))
463478
@@ -466,7 +481,3 @@ fig.tight_layout()
466481
fig.colorbar(pl, ax=axes.ravel().tolist(), shrink = 0.75, aspect = 15, label="Cloud fraction")
467482
fig.savefig(figDir.joinpath("LWP-re-histograms.pdf"), dpi=600, transparent=True, bbox_inches = "tight")
468483
```
469-
470-
```{code-cell} ipython3
471-
472-
```

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
This repository contains Python scripts for manipulating the
22
[monthly data](https://ladsweb.modaps.eosdis.nasa.gov/missions-and-measurements/products/MCD06COSP_M3_MODIS) produced
33
by the MODIS cloud group in support of the MODIS simulator for climate models. The data are described in
4-
Pincus et al, 2022: Updated observations of clouds by MODIS for global model assessment, available at
4+
Pincus et al, 2023: Updated observations of clouds by MODIS for global model assessment, available at
55
https://crew.ldeo.columbia.edu/people/robert-pincus/
66

7-
The data record available at the time of this writing extends from July 2002 to May 2022.
7+
The data record available at the time of this writing extends from July 2002 to Feb 2023.
88

99
# Downloading data
1010

process-local-data.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,6 @@ def make_jhisto_series(dates, files, host_var, jhisto):
213213
print (" Writing to netcdf")
214214
temp.to_netcdf(f"modis-cosp-{hname}.nc", encoding={hname:{"zlib": True}})
215215

216-
if write_zarr: all_data.to_zarr("modis-cosp.zarr")
216+
if write_zarr:
217+
print ("Writing all data to zarr")
218+
all_data.to_zarr("modis-cosp.zarr")

0 commit comments

Comments
 (0)