TC hunt vol. 4#871
Conversation
…l but needs further testing with batching.
… are too many right now
…en nested thread pools
Greptile SummaryThis PR delivers the TC tracking visualisation tooling that was previously marked "coming soon": two JupyText notebook scripts (
|
| Filename | Overview |
|---|---|
| recipes/tc_tracking/plotting/data_handling.py | New library module for track ingestion and error computation; contains a crashable IndexError path and a hardcoded variable assumption in the lead-time rebasing logic. |
| recipes/tc_tracking/plotting/analyse_n_plot.py | Batch analysis entry point; well-structured with a latent NameError if an empty case list is supplied. |
| recipes/tc_tracking/plotting/plotting_helpers.py | New plotting helper library; mostly clean. |
| recipes/tc_tracking/plotting/plot_tracks_n_fields_notebook.py | New JupyText notebook for animated field+track plots; uses xr.Dataset.sel for coarsening which is fragile for scale > 1. |
| recipes/tc_tracking/plotting/tracks_slayground_notebook.py | New JupyText notebook for ensemble track analysis; no significant issues. |
| recipes/tc_tracking/src/tc_hunt_utils.py | Exports EARTH_RADIUS_M constant and widens great_circle_distance to accept array inputs; clean, backward-compatible change. |
Comments Outside Diff (4)
-
recipes/tc_tracking/plotting/data_handling.py, line 909-914 (link)IndexError when track has no valid overlapping data
np.where(~either_nans)[0][-1]raisesIndexErrorwhen every row has a NaN in at least one ofvarorvar_tru— e.g. when a predicted track has no temporal overlap with the reference track after the left-join. This can realistically occur for short-lived predicted tracks or when the true track CSV is missingmslvalues for early timesteps. -
recipes/tc_tracking/plotting/data_handling.py, line 946 (link)Hardcoded
"msl"inrebase_by_lead_timebreaks for custom variable listsremove_trailing_nans(merged_track, "msl")assumes"msl"is always a column in both the predicted track andtru_track, regardless of thevariablesargument passed by the caller. If a user callscompute_averages_of_errors_over_lead_timewithvariables=["dist"](no"msl"), the merged frame won't have a"msl"column and aKeyErroris raised. The trimming variable should be derived fromvariablesinstead of hard-wired. -
recipes/tc_tracking/plotting/plot_tracks_n_fields_notebook.py, line 1358-1362 (link)xr.Dataset.selbreaks forscale > 1due to floating-point step mismatchds.sel(lat=list(np.arange(lat_min, lat_max, scale * 0.25)), ...)selects coordinates by exact label. Forscale=1the 0.25-degree step matches the grid, butnp.arangewith a float step accumulates floating-point rounding errors, and for larger scale values the step may not align with dataset coordinate values. Usingds.sel(..., method="nearest")ords.isel(lat=slice(None, None, scale), lon=slice(None, None, scale))after sub-setting the region would be more robust. -
recipes/tc_tracking/plotting/analyse_n_plot.py, line 504-506 (link)NameErrorwhencasesis an empty listIf
cases=[]is passed, the loop body never runs anderr_dictis never assigned. The subsequentstorm_metrics["var"] = list(err_dict.keys())line raisesNameError: name 'err_dict' is not defined. A guard or pre-loop initialisation would prevent the confusing crash.
Reviews (1): Last reviewed commit: "Merge branch 'main' into mkoch/tc_hunt_4" | Re-trigger Greptile
Earth2Studio Pull Request
Description
This PR adds some plotting functionality for the TC pipeline.
Main components are two notebooks (as python cells with instructions how to convert) that produce field plots with tracks and comparison of track data with reference tracks.
Checklist
Dependencies