Skip to content

Commit

Permalink
Update develop-ref after #810 (#813)
Browse files Browse the repository at this point in the history
Co-authored-by: bikegeek <[email protected]>
Co-authored-by: bikegeek <[email protected]>
Co-authored-by: Julie.Prestopnik <[email protected]>
  • Loading branch information
4 people authored Feb 18, 2021
1 parent 68291f4 commit 9e2bf71
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0-rc1-dev
4.0.0-beta4-dev
34 changes: 27 additions & 7 deletions metplus/wrappers/cyclone_plotter_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,20 @@ def __init__(self, config, instance=None, config_overrides={}):
self.config.getint('config',
'CYCLONE_PLOTTER_CIRCLE_MARKER_SIZE')
)
self.annotation_font_size = (
self.config.getint('config',
'CYCLONE_PLOTTER_ANNOTATION_FONT_SIZE')
)
self.cross_marker = (
self.config.getint('config',
'CYCLONE_PLOTTER_CROSS_MARKER_SIZE')
)
self.resolution_dpi = (
self.config.getint('config',
'CYCLONE_PLOTTER_RESOLUTION_DPI')
)



def run_all_times(self):
"""! Calls the defs needed to create the cyclone plots
Expand Down Expand Up @@ -121,8 +131,8 @@ def retrieve_data(self):
# retrieve information from each row:
# lon, lat, init time, lead hour, valid time,
# model name, mslp, and basin.
# NOTE: Some of these aren't used until we fully
# emulate Guang Ping's plots.
# NOTE: Some of these columns aren't used until we fully
# emulate Guang Ping's plots (ie collect all columns).
for line in infile:
track_dict = {}
col = line.split()
Expand Down Expand Up @@ -315,6 +325,7 @@ def create_plot(self):
"""


# Use PlateCarree projection for now
#use central meridian for central longitude
cm_lon = 180
Expand Down Expand Up @@ -448,7 +459,7 @@ def create_plot(self):
# overlaying the annotation text over all points (all but
# one will have text).
plt.annotate(anno, xy=(adj_lon, adj_lat), xytext=(2, 2),
textcoords='offset points', fontsize=11,
textcoords='offset points', fontsize=self.annotation_font_size,
color='red')

# Generate the scatterplot, where the 6/18 Z forecast times
Expand All @@ -470,7 +481,7 @@ def create_plot(self):
marker='o', zorder=2,
label="Indicates a position " +
"at 00 or 12 UTC")
plt.plot(adj_lon, adj_lat, linestyle='-')
plt.plot(lon,lat, linestyle='-', color=colours, linewidth=1)
circle_counter += 1
elif symbol == '+':
plt.scatter(adj_lon, adj_lat, s=sz, c=colours,
Expand All @@ -493,6 +504,10 @@ def create_plot(self):
edgecolors=colours,
facecolors=colours, marker=symbol, zorder=2)

# Finally, overlay the line plot to define the storm tracks
plt.plot(lon, lat, linestyle='-', color=colours, linewidth=.3)


# If requested, create an ASCII file with the tracks that are going to
# be plotted. This is useful to debug or verify that what you
# see on the plot is what is expected.
Expand All @@ -515,23 +530,28 @@ def create_plot(self):
# ax.legend(loc='lower left', bbox_to_anchor=(-0.03, -0.5),
# fancybox=True, shadow=True, scatterpoints=1,
# prop={'size': 6})
ax.legend(loc='lower left', bbox_to_anchor=(-0.01, -0.4),
ax.legend(loc='lower left', bbox_to_anchor=(-0.01, -0.5),
fancybox=True, shadow=True, scatterpoints=1,
prop={'size': 6})

# Write the plot to the output directory
out_filename_parts = [self.init_date, '.png']
output_plot_name = ''.join(out_filename_parts)
plot_filename = os.path.join(self.output_dir, output_plot_name)
plt.savefig(plot_filename)
if self.resolution_dpi > 0:
plt.savefig(plot_filename, dpi=self.resolution_dpi)
else:
# use Matplotlib's default if no resolution is set in config file
plt.savefig(plot_filename)


# Plot data onto axes
# Uncomment the two lines below if you wish to have a pop up
# window of the plot automatically appear, in addition to the creation
# of the .png version of the plot.
#self.logger.info("Plot is displayed in separate window.
# Close window to continue METplus execution")
#plt.show()
# plt.show()


@staticmethod
Expand Down
14 changes: 12 additions & 2 deletions parm/use_cases/met_tool_wrapper/CyclonePlotter/CyclonePlotter.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,18 @@ CYCLONE_PLOTTER_PLOT_TITLE = Model Forecast Storm Tracks

##
# Indicate the size of symbol (point size)
CYCLONE_PLOTTER_CIRCLE_MARKER_SIZE = 41
CYCLONE_PLOTTER_CROSS_MARKER_SIZE = 51
CYCLONE_PLOTTER_CIRCLE_MARKER_SIZE = 2
CYCLONE_PLOTTER_CROSS_MARKER_SIZE = 11

##
# Indicate text size of annotation label
CYCLONE_PLOTTER_ANNOTATION_FONT_SIZE = 3

##
# Resolution of saved plot in dpi (dots per inch)
# Set to 0 to allow Matplotlib to determine, based on your computer
CYCLONE_PLOTTER_RESOLUTION_DPI = 400


##
# Turn on/off the generation of an ASCII output file listing all the
Expand Down

0 comments on commit 9e2bf71

Please sign in to comment.