diff --git a/modules/util/plot.py b/modules/util/plot.py index 224efcfa8165ba6ec58dd1b67e6d1fec81ae3727..a2da7a1267477d7df4d924bd0167f2da2495f1bc 100644 --- a/modules/util/plot.py +++ b/modules/util/plot.py @@ -1,7 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - - from sklearn.metrics import roc_auc_score, roc_curve import tensorflow as tf import matplotlib @@ -317,10 +313,38 @@ def make_icing_image(h5f, probs, ice_lons, ice_lats, clvrx_str_time, satellite, fig.savefig(ImageDirAndName) +def plot_grid2d(grid_2d, x_map_2d, y_map_2d, proj, vmin=None, vmax=None, cmap='jet'): + import matplotlib.pyplot as plt + import cartopy.crs as ccrs + + fig = plt.figure(figsize=(10, 10)) + ax = fig.add_subplot(1, 1, 1, projection=proj) + + # Save mappable object returned by pcolormesh + p = ax.pcolormesh(x_map_2d, y_map_2d, grid_2d, vmin=270.0, vmax=310.0, cmap='jet', shading='auto') + + ax.coastlines(resolution='50m', color='green', linewidth=1.50) + + # Add gridlines for longitudes and latitudes + gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True, + linewidth=2, color='gray', alpha=0.5, linestyle='--') + + gl.xlabels_top = gl.ylabels_right = False + gl.ylabel_style = {'rotation': 90} + gl.ylabel_padding = 15 + + # Add color bar + cbar = plt.colorbar(p, orientation="horizontal", pad=0.05) + cbar.set_label('Value', size=15) # Set color bar label + + plt.show() + # plt.close() + + # values, edges in Epoch time def make_time_domain_hist(values, edges): # convert the epoch format to matplotlib date format - #mpl_data = mdates.epoch2num(values) + # mpl_data = mdates.epoch2num(values) fig, ax = plt.subplots(1, 1) ax.hist(values, bins=edges, ec='black')