tobac 1.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tobac/__init__.py +112 -0
- tobac/analysis/__init__.py +31 -0
- tobac/analysis/cell_analysis.py +628 -0
- tobac/analysis/feature_analysis.py +212 -0
- tobac/analysis/spatial.py +619 -0
- tobac/centerofgravity.py +226 -0
- tobac/feature_detection.py +1758 -0
- tobac/merge_split.py +324 -0
- tobac/plotting.py +2321 -0
- tobac/segmentation/__init__.py +10 -0
- tobac/segmentation/watershed_segmentation.py +1316 -0
- tobac/testing.py +1179 -0
- tobac/tests/segmentation_tests/test_iris_xarray_segmentation.py +0 -0
- tobac/tests/segmentation_tests/test_segmentation.py +1183 -0
- tobac/tests/segmentation_tests/test_segmentation_time_pad.py +104 -0
- tobac/tests/test_analysis_spatial.py +1109 -0
- tobac/tests/test_convert.py +265 -0
- tobac/tests/test_datetime.py +216 -0
- tobac/tests/test_decorators.py +148 -0
- tobac/tests/test_feature_detection.py +1321 -0
- tobac/tests/test_generators.py +273 -0
- tobac/tests/test_import.py +24 -0
- tobac/tests/test_iris_xarray_match_utils.py +244 -0
- tobac/tests/test_merge_split.py +351 -0
- tobac/tests/test_pbc_utils.py +497 -0
- tobac/tests/test_sample_data.py +197 -0
- tobac/tests/test_testing.py +747 -0
- tobac/tests/test_tracking.py +714 -0
- tobac/tests/test_utils.py +650 -0
- tobac/tests/test_utils_bulk_statistics.py +789 -0
- tobac/tests/test_utils_coordinates.py +328 -0
- tobac/tests/test_utils_internal.py +97 -0
- tobac/tests/test_xarray_utils.py +232 -0
- tobac/tracking.py +613 -0
- tobac/utils/__init__.py +27 -0
- tobac/utils/bulk_statistics.py +360 -0
- tobac/utils/datetime.py +184 -0
- tobac/utils/decorators.py +540 -0
- tobac/utils/general.py +753 -0
- tobac/utils/generators.py +87 -0
- tobac/utils/internal/__init__.py +2 -0
- tobac/utils/internal/coordinates.py +430 -0
- tobac/utils/internal/iris_utils.py +462 -0
- tobac/utils/internal/label_props.py +82 -0
- tobac/utils/internal/xarray_utils.py +439 -0
- tobac/utils/mask.py +364 -0
- tobac/utils/periodic_boundaries.py +419 -0
- tobac/wrapper.py +244 -0
- tobac-1.6.2.dist-info/METADATA +154 -0
- tobac-1.6.2.dist-info/RECORD +53 -0
- tobac-1.6.2.dist-info/WHEEL +5 -0
- tobac-1.6.2.dist-info/licenses/LICENSE +29 -0
- tobac-1.6.2.dist-info/top_level.txt +1 -0
tobac/__init__.py
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# from .tracking import maketrack
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
if sys.version_info < (3, 7):
|
|
5
|
+
warning = """ \n\n
|
|
6
|
+
Support for Python versions less than 3.7 is deprecated.
|
|
7
|
+
Version 1.5 of tobac will require Python 3.7 or later.
|
|
8
|
+
Python {py} detected. \n\n
|
|
9
|
+
""".format(
|
|
10
|
+
py=".".join(str(v) for v in sys.version_info[:3])
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
print(warning)
|
|
14
|
+
|
|
15
|
+
from tobac.segmentation.watershed_segmentation import (
|
|
16
|
+
segmentation_3D,
|
|
17
|
+
segmentation_2D,
|
|
18
|
+
watershedding_3D,
|
|
19
|
+
watershedding_2D,
|
|
20
|
+
)
|
|
21
|
+
from .centerofgravity import (
|
|
22
|
+
calculate_cog,
|
|
23
|
+
calculate_cog_untracked,
|
|
24
|
+
calculate_cog_domain,
|
|
25
|
+
)
|
|
26
|
+
from .plotting import (
|
|
27
|
+
plot_tracks_mask_field,
|
|
28
|
+
plot_tracks_mask_field_loop,
|
|
29
|
+
plot_mask_cell_track_follow,
|
|
30
|
+
plot_mask_cell_track_static,
|
|
31
|
+
plot_mask_cell_track_static_timeseries,
|
|
32
|
+
plot_lifetime_histogram,
|
|
33
|
+
plot_lifetime_histogram_bar,
|
|
34
|
+
plot_histogram_cellwise,
|
|
35
|
+
plot_histogram_featurewise,
|
|
36
|
+
plot_mask_cell_track_3Dstatic,
|
|
37
|
+
plot_mask_cell_track_2D3Dstatic,
|
|
38
|
+
plot_mask_cell_individual_static,
|
|
39
|
+
plot_mask_cell_individual_3Dstatic,
|
|
40
|
+
animation_mask_field,
|
|
41
|
+
make_map,
|
|
42
|
+
map_tracks,
|
|
43
|
+
)
|
|
44
|
+
from tobac.analysis.cell_analysis import (
|
|
45
|
+
cell_statistics,
|
|
46
|
+
cog_cell,
|
|
47
|
+
lifetime_histogram,
|
|
48
|
+
histogram_cellwise,
|
|
49
|
+
velocity_histogram,
|
|
50
|
+
calculate_overlap,
|
|
51
|
+
)
|
|
52
|
+
from tobac.analysis.feature_analysis import (
|
|
53
|
+
histogram_featurewise,
|
|
54
|
+
calculate_nearestneighbordistance,
|
|
55
|
+
nearestneighbordistance_histogram,
|
|
56
|
+
area_histogram,
|
|
57
|
+
)
|
|
58
|
+
from tobac.analysis.spatial import (
|
|
59
|
+
calculate_velocity,
|
|
60
|
+
calculate_distance,
|
|
61
|
+
calculate_area,
|
|
62
|
+
)
|
|
63
|
+
from .utils.mask import (
|
|
64
|
+
mask_cell,
|
|
65
|
+
mask_cell_surface,
|
|
66
|
+
mask_cube_cell,
|
|
67
|
+
mask_cube_untracked,
|
|
68
|
+
mask_cube,
|
|
69
|
+
column_mask_from2D,
|
|
70
|
+
mask_features,
|
|
71
|
+
mask_features_surface,
|
|
72
|
+
mask_cube_features,
|
|
73
|
+
)
|
|
74
|
+
from .utils.general import (
|
|
75
|
+
get_bounding_box,
|
|
76
|
+
add_coordinates,
|
|
77
|
+
get_spacings,
|
|
78
|
+
)
|
|
79
|
+
from .feature_detection import feature_detection_multithreshold
|
|
80
|
+
from .tracking import linking_trackpy
|
|
81
|
+
from .wrapper import maketrack
|
|
82
|
+
from .wrapper import tracking_wrapper
|
|
83
|
+
from . import merge_split
|
|
84
|
+
import importlib.metadata
|
|
85
|
+
import pathlib
|
|
86
|
+
|
|
87
|
+
# default version number
|
|
88
|
+
__version__ = "unknown_dev_version"
|
|
89
|
+
|
|
90
|
+
# Set version number
|
|
91
|
+
# This version should work without needing the package installed
|
|
92
|
+
try:
|
|
93
|
+
__version__ = importlib.metadata.version(__package__ or __name__)
|
|
94
|
+
except importlib.metadata.PackageNotFoundError:
|
|
95
|
+
# need to get version directly from text file
|
|
96
|
+
try:
|
|
97
|
+
import tomllib
|
|
98
|
+
|
|
99
|
+
pyproject_toml_file_name = (
|
|
100
|
+
pathlib.Path(__file__).parent.parent / "pyproject.toml"
|
|
101
|
+
)
|
|
102
|
+
if pyproject_toml_file_name.exists() and pyproject_toml_file_name.is_file():
|
|
103
|
+
with open(pyproject_toml_file_name, "rb") as f:
|
|
104
|
+
toml_data = tomllib.load(f)
|
|
105
|
+
if "project" in toml_data and "version" in toml_data["project"]:
|
|
106
|
+
__version__ = toml_data["project"]["version"]
|
|
107
|
+
|
|
108
|
+
except ImportError:
|
|
109
|
+
# on python <3.11 but not installing tobac.
|
|
110
|
+
# don't bother giving precise version number.
|
|
111
|
+
__version__ = "unknown_dev_version"
|
|
112
|
+
pass
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Provide tools to analyse and visualize the tracked objects.
|
|
2
|
+
This module provides a set of routines that enables performing analyses
|
|
3
|
+
and deriving statistics for individual tracks, such as the time series
|
|
4
|
+
of integrated properties and vertical profiles. It also provides
|
|
5
|
+
routines to calculate summary statistics of the entire population of
|
|
6
|
+
tracked features in the field like histograms of areas/volumes
|
|
7
|
+
or mass and a detailed cell lifetime analysis. These analysis
|
|
8
|
+
routines are all built in a modular manner. Thus, users can reuse the
|
|
9
|
+
most basic methods for interacting with the data structure of the
|
|
10
|
+
package in their own analysis procedures in Python. This includes
|
|
11
|
+
functions performing simple tasks like looping over all identified
|
|
12
|
+
objects or trajectories and masking arrays for the analysis of
|
|
13
|
+
individual features. Plotting routines include both visualizations
|
|
14
|
+
for individual convective cells and their properties. [1]_
|
|
15
|
+
|
|
16
|
+
References
|
|
17
|
+
----------
|
|
18
|
+
.. Heikenfeld, M., Marinescu, P. J., Christensen, M.,
|
|
19
|
+
Watson-Parris, D., Senf, F., van den Heever, S. C.
|
|
20
|
+
& Stier, P. (2019). tobac 1.2: towards a flexible
|
|
21
|
+
framework for tracking and analysis of clouds in
|
|
22
|
+
diverse datasets. Geoscientific Model Development,
|
|
23
|
+
12(11), 4551-4570.
|
|
24
|
+
|
|
25
|
+
Notes
|
|
26
|
+
-----
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
from tobac.analysis.cell_analysis import *
|
|
30
|
+
from tobac.analysis.feature_analysis import *
|
|
31
|
+
from tobac.analysis.spatial import *
|