From 1938276d89a7a66c60bb3bb76c33b9b725b8812c Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Thu, 15 Jul 2021 10:43:20 -0500
Subject: [PATCH] minor...

---
 modules/util/plot.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/modules/util/plot.py b/modules/util/plot.py
index 66b33daa..2f18d5a3 100644
--- a/modules/util/plot.py
+++ b/modules/util/plot.py
@@ -11,6 +11,7 @@ import tensorflow as tf
 import matplotlib
 import matplotlib.pyplot as plt
 import cartopy.crs as ccrs
+import xarray as xr
 import os
 
 from util.setup import home_dir
@@ -196,4 +197,23 @@ def plot_image2(image, cmap='Greys'):
 
     # Wrap up
     fig.clf()  # Otherwise fig stays open every time
-    plt.close()  # Close current figure
\ No newline at end of file
+    plt.close()  # Close current figure
+
+
+# Example GOES file to retrieve GEOS parameters in MetPy form (CONUS)
+exmp_file = '/Users/tomrink/data/OR_ABI-L1b-RadC-M6C14_G16_s20193140811215_e20193140813588_c20193140814070.nc'
+
+
+def plot_image3(image, cmap='Greys'):
+    exmpl_ds = xr.open_dataset(exmp_file)
+    mdat = exmpl_ds.metpy.parse_cf('Rad')
+    geos = mdat.metpy.cartopy_crs
+    x = mdat.x
+    y = mdat.y
+
+    fig = plt.figure(figsize=(15, 12))
+    ax = fig.add_subplot(1, 1, 1, projection=geos)
+    ax.imshow(image, origin='upper', extent=(x.min(), x.max(), y.min(), y.max()), transform=geos)
+    ax.coastlines(resolution='50m', color='black', linewidth=0.25)
+    ax.add_feature(ccrs.cartopy.feature.STATES, linewidth=0.25)
+    plt.title('GOES-16', loc='left', fontweight='bold', fontsize=15)
-- 
GitLab