Skip to content

Commit

Permalink
Merge pull request #506 from jukent/snake_case
Browse files Browse the repository at this point in the history
Updates to Gallery to use new function names and kwargs
  • Loading branch information
jukent committed Jun 30, 2023
2 parents e02e89d + 6595f89 commit c81cac7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
19 changes: 13 additions & 6 deletions Gallery/MapProjections/NCL_sat_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,21 @@

# low pressure contour levels- these will be plotted
# as a subscript to an 'L' symbol.
lowCLabels = gv.findLocalExtrema(pressure,
eType='Low',
highVal=1040,
lowVal=975)
lowCLabels = gv.find_local_extrema(pressure,
eType='Low',
highVal=1040,
lowVal=975)

# Plot Clabels
gv.plotCLabels(ax, p, ccrs.Geodetic(), proj, clabel_locations=regularCLabels)
gv.plotELabels(pressure, ccrs.Geodetic(), proj, clabel_locations=lowCLabels)
gv.plot_contour_labels(ax,
p,
ccrs.Geodetic(),
proj,
clabel_locations=regularCLabels)
gv.plot_extrema_labels(pressure,
ccrs.Geodetic(),
proj,
label_locations=lowCLabels)

# Use gv function to set title and subtitles
gv.set_titles_and_labels(ax,
Expand Down
24 changes: 12 additions & 12 deletions Gallery/MapProjections/NCL_sat_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@

# low pressure contour levels- these will be plotted
# as a subscript to an 'L' symbol.
lowClevels = gv.findLocalExtrema(pressure, lowVal=995, eType='Low')
highClevels = gv.findLocalExtrema(pressure, highVal=1042, eType='High')
lowClevels = gv.find_local_extrema(pressure, lowVal=995, eType='Low')
highClevels = gv.find_local_extrema(pressure, highVal=1042, eType='High')

# Label regular contours with automatic matplotlib labeling
# Specify the levels to label every other contour level
Expand All @@ -102,16 +102,16 @@
fmt="%.0f")

# Label low and high contours
gv.plotELabels(wrap_pressure,
ccrs.Geodetic(),
proj,
clabel_locations=lowClevels,
label='L')
gv.plotELabels(wrap_pressure,
ccrs.Geodetic(),
proj,
clabel_locations=highClevels,
label='H')
gv.plot_extrema_labels(wrap_pressure,
ccrs.Geodetic(),
proj,
label_locations=lowClevels,
label='L')
gv.plot_extrema_labels(wrap_pressure,
ccrs.Geodetic(),
proj,
label_locations=highClevels,
label='H')

# Use gv function to set title and subtitles
gv.set_titles_and_labels(ax,
Expand Down
8 changes: 4 additions & 4 deletions Plots/Contours/NCL_minmax_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ def plotLabels(coord_locations, label):
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 findLocalExtrema
# Find local min/max extrema with GeoCAT-Viz find_local_extrema
# Use below command instead after PR#46 in Viz is merged
# lmin = gv.findLocalExtrema(data, eType='Low', highVal=12, lowVal=-10, eps=7)
lmin = gv.findLocalExtrema(data, eType='Low', highVal=12, lowVal=-10)
lmax = gv.findLocalExtrema(data, eType='High', highVal=12, lowVal=-10)
# 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)

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

0 comments on commit c81cac7

Please sign in to comment.