Loading TRACK data#

TRACK is Kevin Hodges’ vortex tracker. It provides track files in an ASCII format than HuracanPy has functions to support.

[1]:
import huracanpy

Basic functionnality#

TRACK file can be loaded providing the file path and the tracker=TRACK option.

[2]:
# Embedded TRACK example file
filename = huracanpy.example_TRACK_file
# Load the tracks
huracanpy.load(filename, source="TRACK")
[2]:
<xarray.Dataset> Size: 13kB
Dimensions:        (record: 46)
Dimensions without coordinates: record
Data variables: (12/35)
    lon            (record) float64 368B 284.1 287.8 292.5 ... 114.4 115.8 116.4
    lat            (record) float64 368B 29.5 29.99 30.88 ... 16.3 17.69 17.81
    vorticity      (record) float64 368B 2.273 4.124 5.978 ... 3.062 2.445 1.589
    feature_0_lon  (record) float64 368B 285.4 287.7 292.7 ... 114.9 116.0 116.2
    feature_0_lat  (record) float64 368B 29.38 30.58 30.14 ... 17.49 18.32 17.78
    feature_0      (record) float64 368B 3.938 6.482 8.459 ... 7.45 6.762 6.356
    ...             ...
    feature_8      (record) float64 368B 16.1 24.5 25.88 ... 16.93 18.84 17.18
    feature_9_lon  (record) float64 368B 289.7 289.7 290.5 ... 114.8 115.9 121.2
    feature_9_lat  (record) float64 368B 29.65 31.05 33.02 ... 17.56 18.13 21.78
    feature_9      (record) float64 368B 11.22 15.69 16.05 ... 13.9 14.0 13.73
    track_id       (record) int64 368B 840 840 840 840 ... 1601 1601 1601 1601
    time           (record) datetime64[ns] 368B 2022-01-13T18:00:00 ... 2022-...

Dealing with metadata#

TRACK files using include more data than just time, longitude and latitude. However, because ASCII format cannot embed metadata, you need to obtain the name of the variables that were appended to the file from the person that produced it. Then, you can give them to the load function to be used as variable names, as illustrated below.

[3]:
# Load the tracks with metadata
huracanpy.load(
    filename,
    source="TRACK",
    variable_names=[
        "vor850",
        "vor700",
        "vor600",
        "vor500",
        "vor400",
        "vor300",
        "vor200",
        "mslp",
        "925_wind",
        "10m_wind",
    ],
)
[3]:
<xarray.Dataset> Size: 13kB
Dimensions:       (record: 46)
Dimensions without coordinates: record
Data variables: (12/35)
    lon           (record) float64 368B 284.1 287.8 292.5 ... 114.4 115.8 116.4
    lat           (record) float64 368B 29.5 29.99 30.88 ... 16.3 17.69 17.81
    vorticity     (record) float64 368B 2.273 4.124 5.978 ... 3.062 2.445 1.589
    vor850_lon    (record) float64 368B 285.4 287.7 292.7 ... 114.9 116.0 116.2
    vor850_lat    (record) float64 368B 29.38 30.58 30.14 ... 17.49 18.32 17.78
    vor850        (record) float64 368B 3.938 6.482 8.459 ... 7.45 6.762 6.356
    ...            ...
    925_wind      (record) float64 368B 16.1 24.5 25.88 ... 16.93 18.84 17.18
    10m_wind_lon  (record) float64 368B 289.7 289.7 290.5 ... 114.8 115.9 121.2
    10m_wind_lat  (record) float64 368B 29.65 31.05 33.02 ... 17.56 18.13 21.78
    10m_wind      (record) float64 368B 11.22 15.69 16.05 ... 13.9 14.0 13.73
    track_id      (record) int64 368B 840 840 840 840 ... 1601 1601 1601 1601
    time          (record) datetime64[ns] 368B 2022-01-13T18:00:00 ... 2022-0...

Netcdf TRACK files#

Sometimes, TRACK data is provided in NetCDF. In that case, you can load them this way.

[4]:
# Embedded TRACK example file
filename = huracanpy.example_TRACK_netcdf_file
# Load the tracks
huracanpy.load(filename)
[4]:
<xarray.Dataset> Size: 843kB
Dimensions:                 (tracks: 86, record: 4580)
Coordinates: (12/17)
    time                    (record) datetime64[ns] 37kB ...
    lon                     (record) float32 18kB ...
    lat                     (record) float32 18kB ...
    longitude_1             (record) float32 18kB ...
    latitude_1              (record) float32 18kB ...
    longitude_2             (record) float32 18kB ...
    ...                      ...
    longitude_5             (record) float32 18kB ...
    latitude_5              (record) float32 18kB ...
    longitude_6             (record) float32 18kB ...
    latitude_6              (record) float32 18kB ...
    longitude_7             (record) float32 18kB ...
    latitude_7              (record) float32 18kB ...
Dimensions without coordinates: tracks, record
Data variables: (12/20)
    FIRST_PT                (tracks) int32 344B ...
    index                   (record) int32 18kB ...
    relative_vorticity      (record) float64 37kB ...
    relative_vorticity_850  (record) float64 37kB ...
    relative_vorticity_700  (record) float64 37kB ...
    relative_vorticity_600  (record) float64 37kB ...
    ...                      ...
    latitude_9              (record) float32 18kB ...
    wind_speed_925          (record) float32 18kB ...
    longitude_10            (record) float32 18kB ...
    latitude_10             (record) float32 18kB ...
    wind_speed_10m          (record) float32 18kB ...
    track_id                (record) int32 18kB 840 840 840 ... 24685 24685
Attributes:
    realm:        atmos
    history:      testing
    Conventions:  CF-1.7
    featureType:  trajectory