Quick usage reference¶
Below you can find a quick guide outlining the usage of the tintX library.
The tintX user interface¶
The RunDirectory class serves as the main user interface to interact
with the tracking algorithm. To be able to track cells tintX needs information
on the datasets. This datasets are usually saved to netCDF or grib files
or xarray Datasets. To make use of this interface an instance of the
RunDirectory class has to be created. This can be done in multiple
ways:
Using already opened Datasets¶
from tintx import RunDirectory
run_dir = RunDirectory(existing_xarray_dataset,
"variable_name",
x_coord="long_name",
y_coord="lat_name",
time_coord="time_name"
)
Using data saved to files¶
from tintx import RunDirectory
input_files = "/path/to/input_files/*.nc"
run_dir = RunDirectory.from_files(input_files,
"variable_name"
start="2020-01-01T00:00",
end="2020-12-31T12:50"
)
Using previously tracked data¶
from tintx import RunDirectory
run_dir = RunDirectory.from_dataframe("output.hdf5)
Methods and properties¶
The following collection gives an overview of the usage of the created
RunDirectory object which is referred as run_dir:
Applying the tracking algorithm¶
num_cells = run_dir.get_tracks(min_size=2, field_thresh=1)
See also
Accessing the cell tracks¶
Cell tracks are stored in a pandas.DataFrame
run_dir.tracks
Saving tracked cells to file¶
num_cells = run_dir.get_tracks(min_size=2, field_thresh=1)
run_dir.save_tracks("output.hdf5")
See also
Retrieving tuning parameters¶
from tintx import RunDirectory
run_dir = RunDirectory.from_dataframe("output.hdf5)
parameters = run_dir.get_parameters()
See also
tintx.RunDirectory.from_dataframe
tintx.config.get()
save_tracks()
Accessing the data and metadata¶
xarray.Datasetholding the data that is tracked.
run_dir.data
xarray.DataArrayholding the information of the longitude/latitude/time coordinates.
run_dir.lon
run_dir.lat
run_dir.time
Getting the first and last time step that is considered:
run_dir.start
run_dir.end
Getting the variable name of the field that is tracked:
run_dir.var_name
Visualising the tracked data¶
Plotting cell tracks:
ax = run.plot_trajectories(thresh=2, plot_style={"ms":25, "lw":1})
Creating an animation of the tracked cells:
anim = run.animate(vmax=3, fps=2, plot_style={"res": "10m", "lw":1})
See also
- Module
xarray How to work with xarray datasets.
- Module
pandas How to work with pandas DataFrames
- Module
cartopy How to visualise geo spatial data with cartopy
- Class
matplotlib.animation.FuncAnimation How to make use of the object created by FuncAnimation