Closed deeplycloudy closed 1 year ago
I found the error in the merge_split algorithm. The error is in how the track numbers are reassigned an ID counting up from 0.
`import xarray as xr trackpath = '/Users/kelcy/PYTHON/TRACER-PAWS-NEXRAD-LMA/scripts/Tracking/tobac_Save_20220617/' track = xr.open_dataset(trackpath+"Track_features_merges.nc") track = both_ds from matplotlib.ticker import FuncFormatter track_fig, track_ax = plt.subplots(1,1) t_ids = [] for i in [7138, 7139, 7145, 7148, 7151, 7152]: ids = np.where(track['feature_parent_cell_id'] == i) t_ids.append(track['feature_parent_track_id'][ids].values) t_ids = list(flatten(t_ids)) print(np.unique(t_ids)) for track_id in t_ids:#candidate_ds.track: ids = np.where(track['feature_parent_track_id'] == track_id) cells = np.unique(track['feature_parent_cell_id'][ids]) label = "T"+str(int(track_id)) + "-C" + str(list(np.unique(cells))) scart = track_ax.scatter(track['feature_projection_x_coordinate'][ids], track['feature_projection_y_coordinate'][ids], c=track['feature_time_index'][ids], linewidth=1)#, vmin=feature_min_time_idx, vmax=feature_max_time_idx) track_ax.text(track['feature_projection_x_coordinate'][ids][-1],track['feature_projection_y_coordinate'][ids][-1], f'{int(track_id)}', fontsize = 'small',rotation = 'vertical') track_ax.set_aspect(1.0) cax = track_fig.colorbar(scart) track_fig.tight_layout()'
The above gives me the following graph for each cell in @deeplycloudy 's track 726. The cells are labeled in the figure with their track number (now, all individual tracks and are not merged together).
Hi, good job! But do I have to download radar data with a scan mode of RHI to use this code? Thanks!
@Liyrrr The merge_split.py file is a post processing step to the tobac tracking code. The NEXRAD tracking file knb_tobac_tracking.py ingests gridded NEXRAD data. Whatever version of radar data you use, it must be gridded to use tobac and the merge_split function.
I was looking at the Track dataset for 17 June and noticed that there are very distant features that are indicated as part of the same track. I think this a bug in the cell to track merger process, because the individual cells make sense.
I have definitely been tripped up by indexing in xarray before, which will sometimes use the labeled index variables when you think you're indexing by integer position in an array. It might be that, or something else…
Here's some code that looks at Track 726, which has the cell I looked at for our ARM ASR poster, @kelcyno.
This is a plot of every feature in track 726:
The last loop shows every feature in track 726, some of which are hundreds of km away from the "real" track near (-25, 30).