polytope-python 2.1.7__py3-none-any.whl → 2.1.8__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.
@@ -1,2 +1,2 @@
1
1
  # Do not change! Do not track in version control!
2
- __version__ = "2.1.7"
2
+ __version__ = "2.1.8"
@@ -113,11 +113,19 @@ class FDBDatacube(Datacube):
113
113
  # special param with direction and frequency
114
114
  if len(polytope.points[idx]) > 1:
115
115
  raise ValueError(
116
- "Param 251 is part of a special branching of the datacube. Please request it separately." # noqa: E501
116
+ "Param 140251 is part of a special branching of the datacube. Please request it separately." # noqa: E501
117
+ )
118
+ if ax == "stream":
119
+ upper, lower, idx = polytope.extents(ax)
120
+ if "clmn" not in polytope.points[idx]:
121
+ self.fdb_coordinates.pop("year", None)
122
+ self.fdb_coordinates.pop("month", None)
123
+ else:
124
+ if len(polytope.points[idx]) > 1:
125
+ raise ValueError(
126
+ "Stream clmn is part of a special branching of the datacube. Please request it separately." # noqa: E501
117
127
  )
118
128
  self.fdb_coordinates.pop("quantile", None)
119
- self.fdb_coordinates.pop("year", None)
120
- self.fdb_coordinates.pop("month", None)
121
129
 
122
130
  # NOTE: verify that we also remove the axis object for axes we've removed here
123
131
  axes_to_remove = set(self.complete_axes) - set(self.fdb_coordinates.keys())
@@ -13,8 +13,8 @@ try:
13
13
  )
14
14
 
15
15
  use_rust = True
16
- except (ModuleNotFoundError, ImportError):
17
- print("Failed to load Rust extension, falling back to Python implementation.")
16
+ except (ModuleNotFoundError, ImportError) as e:
17
+ print(f"Failed to load Rust extension with error: {e}, falling back to Python implementation.")
18
18
 
19
19
 
20
20
  class NestedHealpixGridMapper(DatacubeMapper):
@@ -7,8 +7,8 @@ try:
7
7
  from polytope_feature.polytope_rs import get_latlons_oblate, get_latlons_sphere
8
8
 
9
9
  use_rust = True
10
- except (ModuleNotFoundError, ImportError):
11
- print("Failed to load Rust extension, falling back to Python implementation.")
10
+ except (ModuleNotFoundError, ImportError) as e:
11
+ print(f"Failed to load Rust extension with error: {e}, falling back to Python implementation.")
12
12
 
13
13
 
14
14
  class LambertConformalGridMapper(DatacubeMapper):
@@ -114,8 +114,7 @@ class LocalRegularGridMapper(DatacubeMapper):
114
114
  descending = self._axis_reversed[self._mapped_axes[0]]
115
115
  if descending:
116
116
  # right descending order for searchsorted
117
- first_idx = np.searchsorted(first_array[::-1], first_val[0])
118
- first_idx = len(first_array) - 1 - first_idx
117
+ first_idx = np.searchsorted(-first_array, -first_val[0])
119
118
  else:
120
119
  first_idx = np.searchsorted(first_array, first_val[0])
121
120
  if first_idx > 0 and first_idx < len(first_array):
@@ -124,6 +123,12 @@ class LocalRegularGridMapper(DatacubeMapper):
124
123
  if abs(first_val[0] - left_val) < abs(first_val[0] - right_val):
125
124
  first_idx -= 1
126
125
  second_idxs = np.searchsorted(second_array, second_vals)
126
+ for i, second_idx in enumerate(second_idxs):
127
+ if second_idx > 0 and second_idx < len(second_array):
128
+ left_val = second_array[second_idx - 1]
129
+ right_val = second_array[second_idx]
130
+ if abs(second_vals[i] - left_val) < abs(second_vals[i] - right_val):
131
+ second_idxs[i] -= 1
127
132
 
128
133
  # map to grid idx
129
134
  final_idxs = first_idx * (self.second_resolution + 1) + second_idxs
@@ -12,8 +12,8 @@ try:
12
12
  )
13
13
 
14
14
  use_rust = True
15
- except (ModuleNotFoundError, ImportError):
16
- print("Failed to load Rust extension, falling back to Python implementation.")
15
+ except (ModuleNotFoundError, ImportError) as e:
16
+ print(f"Failed to load Rust extension with error: {e}, falling back to Python implementation.")
17
17
 
18
18
 
19
19
  class OctahedralGridMapper(DatacubeMapper):
@@ -9,8 +9,8 @@ try:
9
9
  from polytope_feature.polytope_rs import extract_point_in_poly_bbox
10
10
 
11
11
  use_rust = True
12
- except (ModuleNotFoundError, ImportError):
13
- print("Failed to load Rust extension, falling back to Python implementation.")
12
+ except (ModuleNotFoundError, ImportError) as e:
13
+ print(f"Failed to load Rust extension with error: {e}, falling back to Python implementation.")
14
14
 
15
15
  from shapely.geometry import Point
16
16
  from shapely.geometry.polygon import Polygon
@@ -10,8 +10,9 @@ try:
10
10
  from polytope_feature.polytope_rs import QuadTree
11
11
 
12
12
  use_rust = True
13
- except (ModuleNotFoundError, ImportError):
14
- print("Failed to load Rust extension, falling back to Python implementation.")
13
+
14
+ except (ModuleNotFoundError, ImportError) as e:
15
+ print(f"Failed to load Rust extension with error: {e}, falling back to Python implementation.")
15
16
  from ..datacube.quadtree.quad_tree import QuadTree
16
17
 
17
18
 
@@ -9,8 +9,8 @@ try:
9
9
  from polytope_feature.polytope_rs import extract_point_in_poly
10
10
 
11
11
  use_rust = True
12
- except (ModuleNotFoundError, ImportError):
13
- print("Failed to load Rust extension, falling back to Python implementation.")
12
+ except (ModuleNotFoundError, ImportError) as e:
13
+ print(f"Failed to load Rust extension with error: {e}, falling back to Python implementation.")
14
14
 
15
15
  from shapely.geometry import Point
16
16
  from shapely.geometry.polygon import Polygon
@@ -7,8 +7,8 @@ try:
7
7
  from polytope_feature.polytope_rs import QuadTree
8
8
 
9
9
  use_rust = True
10
- except (ModuleNotFoundError, ImportError):
11
- print("Failed to load Rust extension, falling back to Python implementation.")
10
+ except (ModuleNotFoundError, ImportError) as e:
11
+ print(f"Failed to load Rust extension with error: {e}, falling back to Python implementation.")
12
12
  from ..datacube.quadtree.quad_tree import QuadTree
13
13
 
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polytope-python
3
- Version: 2.1.7
3
+ Version: 2.1.8
4
4
  Summary: Polytope datacube feature extraction library
5
5
  Author-email: "European Centre for Medium-Range Weather Forecasts (ECMWF)" <software.support@ecmwf.int>
6
6
  Maintainer-email: James Hawkes <James.Hawkes@ecmwf.int>, Mathilde Leuridan <Mathilde.Leuridan@ecmwf.int>
@@ -31,6 +31,7 @@ Requires-Dist: tripy
31
31
  Requires-Dist: xarray
32
32
  Requires-Dist: conflator
33
33
  Requires-Dist: protobuf
34
+ Requires-Dist: shapely
34
35
  Provides-Extra: tests
35
36
  Requires-Dist: pytest; extra == "tests"
36
37
  Requires-Dist: pytest-cov; extra == "tests"
@@ -40,14 +41,14 @@ Requires-Dist: h5netcdf; extra == "tests"
40
41
  Requires-Dist: h5py; extra == "tests"
41
42
  Requires-Dist: earthkit-data; extra == "tests"
42
43
  Requires-Dist: matplotlib; extra == "tests"
43
- Requires-Dist: pyfdb; extra == "tests"
44
+ Requires-Dist: pyfdb<=0.1.3; extra == "tests"
44
45
  Provides-Extra: unstructured
45
46
  Requires-Dist: eckit; extra == "unstructured"
46
47
  Provides-Extra: catalogue
47
48
  Requires-Dist: qubed; extra == "catalogue"
48
49
  Provides-Extra: switching-grids
49
50
  Requires-Dist: eccodes; extra == "switching-grids"
50
- Requires-Dist: pyfdb; extra == "switching-grids"
51
+ Requires-Dist: pyfdb<=0.1.3; extra == "switching-grids"
51
52
  Dynamic: license-file
52
53
 
53
54
 
@@ -1,5 +1,5 @@
1
1
  polytope_feature/__init__.py,sha256=1OP0y5Ubza4LaBUhegJvJe24u-8zZGrEzAgwPJVqZlk,58
2
- polytope_feature/_version.py,sha256=nkG9B6WCwkUF5yOcMZupKa1Izq86wBMY_euyxoChYh4,72
2
+ polytope_feature/_version.py,sha256=ihCTfvA20gwPoIcNhKAsDkildKDuhkPRooZtPJV1kCE,72
3
3
  polytope_feature/options.py,sha256=sL-LURTJKEE649O4Y15SHqClCxZxwrVJLwjVsy5ZGX8,5467
4
4
  polytope_feature/polytope.py,sha256=TM4X4nxAio0fgLC8vjhzXcJjylZRVS5nRTv4LdbPziM,9805
5
5
  polytope_feature/shapes.py,sha256=ZhMrHTNEqEgnpMTDU1Rd5zjJeyRBQMYNDRoKqDd2Ejs,16473
@@ -13,7 +13,7 @@ polytope_feature/datacube/tree_encoding.py,sha256=5Bk6x-NyDXd7BKPIsKuSJk7GETOcJg
13
13
  polytope_feature/datacube/backends/__init__.py,sha256=vQDvMYOAYS7YSmjKohLsBE9zQ7rJwwyT3A-zZJOIdbc,34
14
14
  polytope_feature/datacube/backends/catalogue_helper.py,sha256=SZaJ_UjQfgalsC9SvzdlXRZ9_0yoUEdBSEKrt96qkoY,1059
15
15
  polytope_feature/datacube/backends/datacube.py,sha256=Pmd_4J_4eeWf_7LdGgxTclwQ6bAuMmEE86mXkGoaYd4,8313
16
- polytope_feature/datacube/backends/fdb.py,sha256=jHnNyA_qcZ7Xrr5DQpnrFpd35O__tPPdhLCCG4xBe20,21170
16
+ polytope_feature/datacube/backends/fdb.py,sha256=C54yArP0JWAr559wc-3LB3A1EZAHz8MdUhXReMh0ckg,21658
17
17
  polytope_feature/datacube/backends/mock.py,sha256=OASnzHjxCOLwrei7fTbTwwtLWQv1qDRkTLnhOCpTDNc,2214
18
18
  polytope_feature/datacube/backends/xarray.py,sha256=aewVHXrxN26dlXkJ0wXx4vcCxrsox0JJok9zHnvlvzc,6813
19
19
  polytope_feature/datacube/quadtree/quad_tree.py,sha256=KfGwA3rBVcAkU17Se2WjP9sD6sVi-0dEZx2_dutkg_k,6062
@@ -26,16 +26,16 @@ polytope_feature/datacube/transformations/datacube_mappers/__init__.py,sha256=Gc
26
26
  polytope_feature/datacube/transformations/datacube_mappers/datacube_mappers.py,sha256=IFYNXcbqiIxFYjTKkS1aPUyCi6-8aYP4wAwrOvepqJ4,6811
27
27
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix.py,sha256=T_sDGEOJQcHC_5gyya7w88ktFymRuA0fUrOnpTcbyQU,6026
29
- polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix_nested.py,sha256=qbdG_YV3RSkf62W552NKSrXo9HuUWBsiNxCT7Q-4bE4,10086
29
+ polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix_nested.py,sha256=6BPUDRIWoaNmGB_HJ9nd3vHJBF88uuXxNvXOgdlpKAM,10108
30
30
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/irregular.py,sha256=Z7gNINU6cpGeJxuNLhQUqtzBEIr3MXsxP3NkoJIJrA8,2095
31
- polytope_feature/datacube/transformations/datacube_mappers/mapper_types/local_regular.py,sha256=Q0tH8Tp3q3D2msl1okEsCdLSHcU4SNMMgYzU_FtjDyE,5271
32
- polytope_feature/datacube/transformations/datacube_mappers/mapper_types/octahedral.py,sha256=6deRO2fxp8AP8FZmtvdtz0lKwlIzDRUDwo53K8dGC1I,274147
31
+ polytope_feature/datacube/transformations/datacube_mappers/mapper_types/local_regular.py,sha256=Rv3CLsKoNNV8JxGvusrIh6ILbI-iTJEfPcDMflAlyJM,5563
32
+ polytope_feature/datacube/transformations/datacube_mappers/mapper_types/octahedral.py,sha256=Wz4i_zAQlG1frJR14ClO8eOnoW1OsrlPyMeFRDUDRY0,274169
33
33
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/reduced_gaussian.py,sha256=ajtgG76LbRKzqpoqnzR3eDSI4jwjtmaFPFj_4RyliJ0,40383
34
34
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/reduced_ll.py,sha256=CcmzRQYGOSPdSYWMFjMluWuKuMJ_Hes6dIOlh7HBxI8,113387
35
35
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/regular.py,sha256=DUKoACooucuQ7Kwk2PR6cTzBgE3bWqAGICIlTfoRgVA,3568
36
36
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/irregular_mapper_types/__init__.py,sha256=bh0QAy3gr9hz5O8fu5tm6zI7ukI1UnQ-xszAiBYDNhg,33
37
37
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/irregular_mapper_types/icon.py,sha256=eV2sEF-R--ZK8r0OX7r_qRYyGcyvvytavXZBKRzTx5A,1011
38
- polytope_feature/datacube/transformations/datacube_mappers/mapper_types/irregular_mapper_types/lambert_conformal.py,sha256=rdzdWdrO1TUy35mAT6El6NHwEwik6FDiaHLkB6qrbpQ,9617
38
+ polytope_feature/datacube/transformations/datacube_mappers/mapper_types/irregular_mapper_types/lambert_conformal.py,sha256=i7ZfdXBZJyg7j2iHLCw2M4RDMWax8HcsanLoJ3dFPIo,9639
39
39
  polytope_feature/datacube/transformations/datacube_mappers/mapper_types/irregular_mapper_types/unstructured.py,sha256=MU2Hxhk8wJNdXf_hbGtwDyDeRb_G6mOOYI9m8fXDQK4,823
40
40
  polytope_feature/datacube/transformations/datacube_merger/__init__.py,sha256=551OlMzHoR-AcuIbohQb3JOKuXobyR4ueV1rcfPorvg,31
41
41
  polytope_feature/datacube/transformations/datacube_merger/datacube_merger.py,sha256=JQSqKBQ9xKAJEqUiB8smvVGWQwDSFK_1jkWMVWxOuQk,3782
@@ -46,10 +46,10 @@ polytope_feature/datacube/transformations/datacube_type_change/datacube_type_cha
46
46
  polytope_feature/engine/__init__.py,sha256=ZbkKZTGfSD-IsrwGn1QZlWMVV9SqWrkpfAiH4RSMFTU,22
47
47
  polytope_feature/engine/engine.py,sha256=w3fUJ7r8jKlN_RS3F282PqnRi3_hwarwOPxwNGZl6Fc,1353
48
48
  polytope_feature/engine/hullslicer.py,sha256=1B710iKNfe7pjEQdeUGNmSqE7YjUJ-ZyuuyCqCXw6h0,8868
49
- polytope_feature/engine/optimised_point_in_polygon_slicer.py,sha256=6WJRo0vXYeS1rTPps76qbT0_pjGH1W8NR58JTvIwVfI,5003
50
- polytope_feature/engine/optimised_quadtree_slicer.py,sha256=HyIhE5BWV1RNWircFXhxsBrkvjYNuDNcGDKQ9phkanw,3824
51
- polytope_feature/engine/point_in_polygon_slicer.py,sha256=ZT99GQty2jH70SaT_3unruWPcM5PuQQqZqbRlqOpv0A,4349
52
- polytope_feature/engine/quadtree_slicer.py,sha256=0lNGkrbzy_gBhel17g2Nk0z9BE07pE4h7rUxg7H88XU,3222
49
+ polytope_feature/engine/optimised_point_in_polygon_slicer.py,sha256=SOHm-0tQK6AQ62sd7lMCEbryQF2aiuxgNsl_d3V-DBs,5025
50
+ polytope_feature/engine/optimised_quadtree_slicer.py,sha256=ecf5Uhd0bmgCPyQXYZixeE-eZH42wyN_vnWslwqmAu8,3847
51
+ polytope_feature/engine/point_in_polygon_slicer.py,sha256=tnoA-4cMU6WYljq0XVoNDE9ap5ssmSNLjkqVN_of6Zc,4371
52
+ polytope_feature/engine/quadtree_slicer.py,sha256=DA6-ni1YCqwbbABCJUj3hnAizeKmvP9umep6Rk-YeDY,3244
53
53
  polytope_feature/engine/slicing_tools.py,sha256=a-bzBgnSbSlJLkd22JrIAntIDuOkUanwhlegp2iwvVQ,5349
54
54
  polytope_feature/utility/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  polytope_feature/utility/combinatorics.py,sha256=Vucp-78wpw8wTDiGv889w_kdYbFsHafcCAwgsg2MzYc,1586
@@ -58,8 +58,8 @@ polytope_feature/utility/exceptions.py,sha256=cIgX7YiARpfPsjxax0dGQmkg9vfinEUVj2
58
58
  polytope_feature/utility/geometry.py,sha256=DHCYFKJWC7BBbMwnCQlcQVzYp8T_e-RZVuSbKPo7-60,1063
59
59
  polytope_feature/utility/list_tools.py,sha256=0WeWCRzm8jHdcM_1BPu1s-yr5D0UUmtQIVe4HHGfRJk,760
60
60
  polytope_feature/utility/profiling.py,sha256=PS8z7u6xyiBMlbcddOO5LS6ua8E1CJOzi3CtDaDv7p4,322
61
- polytope_python-2.1.7.dist-info/licenses/LICENSE,sha256=VtcDVlw8N6T2GAxlk6b-8OvqAG_V751y269wWcv_lEU,11379
62
- polytope_python-2.1.7.dist-info/METADATA,sha256=kh9WTfLnfvETAaTPbCiIOaf3eR8Gh5kddo3dotC7XLg,11579
63
- polytope_python-2.1.7.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
64
- polytope_python-2.1.7.dist-info/top_level.txt,sha256=4I919dNk-eQpuqcYHdiBpwAZcNrWeMPYuROzfpqmGRk,17
65
- polytope_python-2.1.7.dist-info/RECORD,,
61
+ polytope_python-2.1.8.dist-info/licenses/LICENSE,sha256=VtcDVlw8N6T2GAxlk6b-8OvqAG_V751y269wWcv_lEU,11379
62
+ polytope_python-2.1.8.dist-info/METADATA,sha256=100JnJyAWDZg95Xs1e9KALrggn3RfT77cY26SDv5wm8,11616
63
+ polytope_python-2.1.8.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
64
+ polytope_python-2.1.8.dist-info/top_level.txt,sha256=4I919dNk-eQpuqcYHdiBpwAZcNrWeMPYuROzfpqmGRk,17
65
+ polytope_python-2.1.8.dist-info/RECORD,,