Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Minor fix in plot_maxcappi #1638

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions pyart/graph/max_cappi.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,33 @@ def get_coord_or_attr(ds, coord_name, attr_name):
)

# Retrieve instrument name
instrument_name = ds.attrs.get("instrument_name", "N/A")[:4]
# instrument_name = ds.attrs.get("instrument_name", "N/A")[:4]
syedhamidali marked this conversation as resolved.
Show resolved Hide resolved
# Initialize an empty list to store the processed radar names
full_title = []

# Check if radar_name is a list (or list-like) or a simple string
if isinstance(ds.attrs["radar_name"], list):
# Iterate over each radar name in the list
for name in ds.attrs["radar_name"]:
# Decode if it's a byte string and take the first 4 characters
if isinstance(name, bytes):
site_title = name.decode("utf-8")[:4]
else:
site_title = name[:4]
full_title.append(site_title)
else:
# Handle the case where radar_name is a single string
site_title = ds.attrs["radar_name"][:4]
full_title.append(site_title)

# Join the processed radar names into a single string with commas separating them
formatted_title = ", ".join(full_title)

# Center-align text in the corner box
plt.text(
0.5,
0.90,
f"Site: {instrument_name}",
f"{formatted_title}",
size=13,
weight="bold",
ha="center",
Expand Down