oceanmodeling / StormEvents

Python interfaces for observational data surrounding named storm events, born from @jreniel's ADCIRCpy

Home Page:https://stormevents.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`separate_tracks` sorts rows by `forecast_hours` as character instead of integer

SorooshMani-NOAA opened this issue · comments

In the following snippet, the track entries are sorted by forecast_hours. However these values are not interpreted as integers and are ordered based on string character order.

track_data = advisory_data[
advisory_data["track_start_time"]
== pandas.to_datetime(track_start_time)
].sort_values("forecast_hours")

An example of the wrong sort:

  basin storm_number    track_start_time advisory forecast_hours  isotach_radius                    geometry
2    AL           06 2018-08-30 06:00:00     CARQ            -12            34.0  POINT (-13.80000 12.90000)
1    AL           06 2018-08-30 06:00:00     CARQ            -18            34.0  POINT (-12.30000 12.90000)
0    AL           06 2018-08-30 06:00:00     CARQ            -24            34.0  POINT (-10.90000 12.90000)
3    AL           06 2018-08-30 06:00:00     CARQ             -6            34.0  POINT (-15.40000 12.90000)
4    AL           06 2018-08-30 06:00:00     CARQ              0            34.0  POINT (-17.00000 12.90000)
5    AL           06 2018-08-30 06:00:00     CARQ              0            50.0  POINT (-17.00000 12.90000)
6    AL           06 2018-08-30 06:00:00     CARQ              0            64.0  POINT (-17.00000 12.90000)