From 922b77553698e19e8bc5eb2ecb2aefd82fd5460b Mon Sep 17 00:00:00 2001 From: syedhamidali Date: Fri, 30 Aug 2024 17:19:59 -0400 Subject: [PATCH 1/3] FIX: Minor fix in plot_maxcappi --- pyart/graph/max_cappi.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pyart/graph/max_cappi.py b/pyart/graph/max_cappi.py index 25d0309f75..c88fad0486 100644 --- a/pyart/graph/max_cappi.py +++ b/pyart/graph/max_cappi.py @@ -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] + # 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", From 2a1bc855cc1ad332fde280c7d7e4088d6adb9293 Mon Sep 17 00:00:00 2001 From: Hamid Ali Syed <35923822+syedhamidali@users.noreply.github.com> Date: Fri, 30 Aug 2024 23:19:05 -0400 Subject: [PATCH 2/3] Update pyart/graph/max_cappi.py Co-authored-by: Zach Sherman <19153455+zssherman@users.noreply.github.com> --- pyart/graph/max_cappi.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyart/graph/max_cappi.py b/pyart/graph/max_cappi.py index c88fad0486..e188bf6558 100644 --- a/pyart/graph/max_cappi.py +++ b/pyart/graph/max_cappi.py @@ -285,7 +285,6 @@ def get_coord_or_attr(ds, coord_name, attr_name): ) # Retrieve instrument name - # instrument_name = ds.attrs.get("instrument_name", "N/A")[:4] # Initialize an empty list to store the processed radar names full_title = [] From c0f78dd0dc6e435ca81bd5ac562266e393ed45e2 Mon Sep 17 00:00:00 2001 From: syedhamidali Date: Sat, 31 Aug 2024 15:20:13 -0400 Subject: [PATCH 3/3] FIX: Remove un-necessary commented lines --- pyart/graph/max_cappi.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyart/graph/max_cappi.py b/pyart/graph/max_cappi.py index e188bf6558..a4dca51f0b 100644 --- a/pyart/graph/max_cappi.py +++ b/pyart/graph/max_cappi.py @@ -284,7 +284,6 @@ def get_coord_or_attr(ds, coord_name, attr_name): labelbottom=False, ) - # Retrieve instrument name # Initialize an empty list to store the processed radar names full_title = []