Skip to content

Commit

Permalink
Merge pull request #530 from kafitzgerald/issue514
Browse files Browse the repository at this point in the history
Update NCL_minmax_3 example and move it over to the gallery
  • Loading branch information
jukent committed Jul 20, 2023
2 parents c81cac7 + 99f8ca9 commit a63f192
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt

from geocat.viz import util as gv
from geocat.viz import cmaps as gvcmaps
import geocat.viz as gv
import cmaps

###############################################################################
# Definition of generate_2d_array and helper functions adapted from
Expand Down Expand Up @@ -181,17 +180,15 @@ def plotLabels(coord_locations, label):
levels = np.arange(-20, 18.5, 2.5)

# Plot data and create colorbar
cmap = gvcmaps.BlueYellowRed
cmap = cmaps.BlueYellowRed

# Plot filled contour and contour lines
contours = ax.contourf(data, cmap=cmap, levels=levels)
lines = ax.contour(contours, linewidths=0.5, linestyles='solid', colors='black')

# Find local min/max extrema with GeoCAT-Viz find_local_extrema
# Use below command instead after PR#46 in Viz is merged
# lmin = gv.find_local_extrema(data, eType='Low', highVal=12, lowVal=-10, eps=7)
lmin = gv.find_local_extrema(data, eType='Low', highVal=12, lowVal=-10)
lmax = gv.find_local_extrema(data, eType='High', highVal=12, lowVal=-10)
lmin = gv.find_local_extrema(data, eType='Low', highVal=12, lowVal=-10, eps=7)
lmax = gv.find_local_extrema(data, eType='High', highVal=12, lowVal=-10, eps=7)

# Plot labels for local extrema
plotLabels(lmin, 'L')
Expand Down

0 comments on commit a63f192

Please sign in to comment.