eccopy 1.0.0__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.
Files changed (79) hide show
  1. eccopy/__init__.py +46 -0
  2. eccopy/core/__init__.py +55 -0
  3. eccopy/core/classification.py +1023 -0
  4. eccopy/core/colormaps.py +267 -0
  5. eccopy/core/convectivity.py +43 -0
  6. eccopy/core/coords.py +245 -0
  7. eccopy/core/data/disk_decomp/disk_decomp_r15_info.mat +0 -0
  8. eccopy/core/data/disk_decomp/disk_decomp_r15_step1.mat +0 -0
  9. eccopy/core/data/disk_decomp/disk_decomp_r15_step2.mat +0 -0
  10. eccopy/core/data/disk_decomp/disk_decomp_r15_step3.mat +0 -0
  11. eccopy/core/data/disk_decomp/disk_decomp_r15_step4.mat +0 -0
  12. eccopy/core/data/disk_decomp/disk_decomp_r15_step5.mat +0 -0
  13. eccopy/core/data/disk_decomp/disk_decomp_r15_step6.mat +0 -0
  14. eccopy/core/data/disk_decomp/disk_decomp_r25_info.mat +0 -0
  15. eccopy/core/data/disk_decomp/disk_decomp_r25_step1.mat +0 -0
  16. eccopy/core/data/disk_decomp/disk_decomp_r25_step2.mat +0 -0
  17. eccopy/core/data/disk_decomp/disk_decomp_r25_step3.mat +0 -0
  18. eccopy/core/data/disk_decomp/disk_decomp_r25_step4.mat +0 -0
  19. eccopy/core/data/disk_decomp/disk_decomp_r25_step5.mat +0 -0
  20. eccopy/core/data/disk_decomp/disk_decomp_r25_step6.mat +0 -0
  21. eccopy/core/data/disk_strels/disk_strel_r15.mat +0 -0
  22. eccopy/core/data/disk_strels/disk_strel_r25.mat +0 -0
  23. eccopy/core/data/disk_strels/disk_strel_r3.mat +0 -0
  24. eccopy/core/data/disk_strels/disk_strel_r5.mat +0 -0
  25. eccopy/core/debug.py +493 -0
  26. eccopy/core/disk.py +178 -0
  27. eccopy/core/temperature.py +250 -0
  28. eccopy/core/texture.py +1398 -0
  29. eccopy/eccopy1d/__init__.py +2 -0
  30. eccopy/eccopy1d/classify.py +273 -0
  31. eccopy/eccopy2d_h/__init__.py +2 -0
  32. eccopy/eccopy2d_h/classify.py +281 -0
  33. eccopy/eccopy2d_h/clumping.py +265 -0
  34. eccopy/eccopy2d_v/__init__.py +2 -0
  35. eccopy/eccopy2d_v/classify.py +288 -0
  36. eccopy/eccopy3d/__init__.py +2 -0
  37. eccopy/eccopy3d/classify.py +421 -0
  38. eccopy/eccopy3d/clumping.py +477 -0
  39. eccopy/params/__init__.py +6 -0
  40. eccopy/params/classification_params.py +151 -0
  41. eccopy/params/texture_params.py +66 -0
  42. eccopy/params/vertical_params.py +54 -0
  43. eccopy/params/window.py +141 -0
  44. eccopy/stats/__init__.py +56 -0
  45. eccopy/stats/basic_stats.py +370 -0
  46. eccopy/tests/__init__.py +0 -0
  47. eccopy/tests/_reference_impls/__init__.py +0 -0
  48. eccopy/tests/_reference_impls/isotherm_height_reference.py +54 -0
  49. eccopy/tests/_reference_impls/sliding_texture_reference.py +77 -0
  50. eccopy/tests/_reference_impls/texture_2d_reference.py +309 -0
  51. eccopy/tests/test_classification_1d_filter.py +151 -0
  52. eccopy/tests/test_classification_rain_below_melt.py +130 -0
  53. eccopy/tests/test_colormaps.py +213 -0
  54. eccopy/tests/test_coords.py +127 -0
  55. eccopy/tests/test_debug.py +226 -0
  56. eccopy/tests/test_disk_generator.py +82 -0
  57. eccopy/tests/test_eccopy1d.py +209 -0
  58. eccopy/tests/test_eccopy2d_h.py +185 -0
  59. eccopy/tests/test_eccopy2d_h_clumping.py +105 -0
  60. eccopy/tests/test_eccopy2d_v.py +359 -0
  61. eccopy/tests/test_eccopy3d.py +282 -0
  62. eccopy/tests/test_examples.py +84 -0
  63. eccopy/tests/test_min_valid_dbz.py +144 -0
  64. eccopy/tests/test_notebooks.py +111 -0
  65. eccopy/tests/test_numba_cross_validation.py +331 -0
  66. eccopy/tests/test_packaging.py +144 -0
  67. eccopy/tests/test_refl_texture_1d.py +167 -0
  68. eccopy/tests/test_stats.py +117 -0
  69. eccopy/tests/test_stats_sentinel.py +74 -0
  70. eccopy/tests/test_temperature.py +207 -0
  71. eccopy/tests/test_texture_kernel_modes.py +82 -0
  72. eccopy/tests/test_texture_params_implemented.py +148 -0
  73. eccopy/tests/test_vert_levels_type.py +180 -0
  74. eccopy/tests/test_window.py +80 -0
  75. eccopy-1.0.0.dist-info/METADATA +420 -0
  76. eccopy-1.0.0.dist-info/RECORD +79 -0
  77. eccopy-1.0.0.dist-info/WHEEL +5 -0
  78. eccopy-1.0.0.dist-info/licenses/LICENSE +39 -0
  79. eccopy-1.0.0.dist-info/top_level.txt +1 -0
eccopy/__init__.py ADDED
@@ -0,0 +1,46 @@
1
+ """
2
+ EccoPy - Radar Echo Classification (Python port of ECCO / ConvStratFinder).
3
+
4
+ Modules
5
+ -------
6
+ eccopy1d : 1-D (time or distance), basic strat/mixed/conv.
7
+ eccopy2d_v : 2-D vertical cross-section (Z, X), with optional sub-classification.
8
+ eccopy2d_h : 2-D horizontal composite (Y, X), basic strat/mixed/conv.
9
+ eccopy3d : 3-D volume (Z, Y, X), with optional sub-classification.
10
+
11
+ Helper
12
+ ------
13
+ eccopy.core.coords.haversine_distance() - great-circle distance between two points.
14
+ eccopy.core.coords.latlon_to_xy_spacing() - convert lat/lon grid to dx/dy spacing arrays.
15
+ eccopy.core.coords.resolve_spacing() - convert position arrays to spacing arrays.
16
+ eccopy.core.coords.time_to_distance_km() - wind-advected distance from a time series.
17
+
18
+ Quick start
19
+ -----------
20
+ from eccopy import eccopy3d
21
+ from eccopy.params import WindowSpec
22
+
23
+ result = eccopy3d.run(
24
+ dbz, # (Z, Y, X) numpy array
25
+ coords_z=z_km, # (Z,) heights in km
26
+ coords_y=y_km, # (Y,) N-S positions in km
27
+ coords_x=x_km, # (X,) E-W positions in km
28
+ height=height_km, # (Z, Y, X) height field, optional
29
+ window=WindowSpec((7, 'km')), # 7 km texture radius
30
+ )
31
+ echo = result.echo_type # (Z, Y, X), echo type codes
32
+ """
33
+
34
+ __version__ = "1.0.0"
35
+
36
+ from . import eccopy1d, eccopy2d_v, eccopy2d_h, eccopy3d
37
+ from . import stats
38
+ from .core.coords import (haversine_distance, latlon_to_xy_spacing,
39
+ resolve_spacing, time_to_distance_km)
40
+
41
+ __all__ = [
42
+ "__version__",
43
+ "eccopy1d", "eccopy2d_v", "eccopy2d_h", "eccopy3d", "stats",
44
+ "haversine_distance", "latlon_to_xy_spacing", "resolve_spacing",
45
+ "time_to_distance_km",
46
+ ]
@@ -0,0 +1,55 @@
1
+ from .texture import refl_texture_1d, refl_texture_2d
2
+ from .convectivity import texture_to_convectivity_linear
3
+ from .classification import (class_basic, class_basic_isotropic, class_sub_2d,
4
+ set_echo_type_3d,
5
+ CATEGORY_MISSING, CATEGORY_STRATIFORM_LOW,
6
+ CATEGORY_STRATIFORM_MID, CATEGORY_STRATIFORM_HIGH,
7
+ CATEGORY_MIXED, CATEGORY_CONVECTIVE_ELEVATED,
8
+ CATEGORY_CONVECTIVE_SHALLOW, CATEGORY_CONVECTIVE_MID,
9
+ CATEGORY_CONVECTIVE_DEEP)
10
+ from .coords import (haversine_distance, latlon_to_xy_spacing, resolve_spacing,
11
+ time_to_distance_km)
12
+ from .temperature import isotherm_height, melt_layer_from_temp, broadcast_temp_field
13
+ from .debug import (refl_texture_1d_debug, refl_texture_2d_debug,
14
+ TextureDebug1D, TextureDebug2D)
15
+
16
+ # colormaps.py imports matplotlib, which is an OPTIONAL dependency
17
+ # (pyproject.toml's "plot" extra) -- importing it eagerly here would make
18
+ # every `import eccopy` require matplotlib, even for pure classification
19
+ # work with no plotting at all. Resolve those names lazily instead (PEP
20
+ # 562) so `from eccopy.core import echo_type_cmap` still works when
21
+ # matplotlib IS installed, but `import eccopy` alone never requires it.
22
+ _COLORMAP_NAMES = {
23
+ "echo_type_cmap", "echo_type_norm",
24
+ "basic_echo_type_cmap", "basic_echo_type_norm",
25
+ "remap_echo_type",
26
+ "convectivity_cmap", "convectivity_norm", "draw_window_ring",
27
+ "ECHO_TYPE_LABELS", "BASIC_ECHO_TYPE_LABELS",
28
+ "ECHO_TYPE_TO_IDX", "BASIC_ECHO_TYPE_TO_IDX",
29
+ }
30
+
31
+
32
+ def __getattr__(name):
33
+ if name in _COLORMAP_NAMES:
34
+ from . import colormaps
35
+ return getattr(colormaps, name)
36
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
37
+
38
+
39
+ __all__ = [
40
+ "refl_texture_1d", "refl_texture_2d",
41
+ "texture_to_convectivity_linear", "class_basic", "class_basic_isotropic", "class_sub_2d", "set_echo_type_3d",
42
+ "CATEGORY_MISSING", "CATEGORY_STRATIFORM_LOW", "CATEGORY_STRATIFORM_MID",
43
+ "CATEGORY_STRATIFORM_HIGH", "CATEGORY_MIXED",
44
+ "CATEGORY_CONVECTIVE_ELEVATED", "CATEGORY_CONVECTIVE_SHALLOW",
45
+ "CATEGORY_CONVECTIVE_MID", "CATEGORY_CONVECTIVE_DEEP",
46
+ "haversine_distance", "latlon_to_xy_spacing", "resolve_spacing",
47
+ "time_to_distance_km",
48
+ "isotherm_height", "melt_layer_from_temp", "broadcast_temp_field",
49
+ "echo_type_cmap", "echo_type_norm",
50
+ "basic_echo_type_cmap", "basic_echo_type_norm",
51
+ "remap_echo_type",
52
+ "convectivity_cmap", "convectivity_norm", "draw_window_ring",
53
+ "refl_texture_1d_debug", "refl_texture_2d_debug",
54
+ "TextureDebug1D", "TextureDebug2D",
55
+ ]