polytope-python 1.0.36__tar.gz → 1.0.37__tar.gz

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 (120) hide show
  1. {polytope_python-1.0.36/polytope_python.egg-info → polytope_python-1.0.37}/PKG-INFO +1 -1
  2. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/backends/fdb.py +5 -2
  3. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/polytope.py +3 -3
  4. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/shapes.py +4 -2
  5. polytope_python-1.0.37/polytope_feature/version.py +1 -0
  6. {polytope_python-1.0.36 → polytope_python-1.0.37/polytope_python.egg-info}/PKG-INFO +1 -1
  7. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_point_union.py +51 -0
  8. polytope_python-1.0.36/polytope_feature/version.py +0 -1
  9. {polytope_python-1.0.36 → polytope_python-1.0.37}/LICENSE +0 -0
  10. {polytope_python-1.0.36 → polytope_python-1.0.37}/MANIFEST.in +0 -0
  11. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/__init__.py +0 -0
  12. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/__init__.py +0 -0
  13. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/backends/__init__.py +0 -0
  14. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/backends/datacube.py +0 -0
  15. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/backends/mock.py +0 -0
  16. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/backends/xarray.py +0 -0
  17. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/datacube_axis.py +0 -0
  18. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/index_tree_pb2.py +0 -0
  19. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/tensor_index_tree.py +0 -0
  20. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/__init__.py +0 -0
  21. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_cyclic/__init__.py +0 -0
  22. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_cyclic/datacube_cyclic.py +0 -0
  23. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/__init__.py +0 -0
  24. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/datacube_mappers.py +0 -0
  25. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/__init__.py +0 -0
  26. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix.py +0 -0
  27. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix_nested.py +0 -0
  28. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/local_regular.py +0 -0
  29. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/octahedral.py +0 -0
  30. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/reduced_gaussian.py +0 -0
  31. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/reduced_ll.py +0 -0
  32. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/regular.py +0 -0
  33. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_merger/__init__.py +0 -0
  34. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_merger/datacube_merger.py +0 -0
  35. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_reverse/__init__.py +0 -0
  36. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_reverse/datacube_reverse.py +0 -0
  37. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_transformations.py +0 -0
  38. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_type_change/__init__.py +0 -0
  39. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/transformations/datacube_type_change/datacube_type_change.py +0 -0
  40. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/datacube/tree_encoding.py +0 -0
  41. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/engine/__init__.py +0 -0
  42. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/engine/engine.py +0 -0
  43. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/engine/hullslicer.py +0 -0
  44. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/options.py +0 -0
  45. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/utility/__init__.py +0 -0
  46. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/utility/combinatorics.py +0 -0
  47. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/utility/exceptions.py +0 -0
  48. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/utility/geometry.py +0 -0
  49. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/utility/list_tools.py +0 -0
  50. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_feature/utility/profiling.py +0 -0
  51. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_python.egg-info/SOURCES.txt +0 -0
  52. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_python.egg-info/dependency_links.txt +0 -0
  53. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_python.egg-info/not-zip-safe +0 -0
  54. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_python.egg-info/requires.txt +0 -0
  55. {polytope_python-1.0.36 → polytope_python-1.0.37}/polytope_python.egg-info/top_level.txt +0 -0
  56. {polytope_python-1.0.36 → polytope_python-1.0.37}/pyproject.toml +0 -0
  57. {polytope_python-1.0.36 → polytope_python-1.0.37}/requirements.txt +0 -0
  58. {polytope_python-1.0.36 → polytope_python-1.0.37}/setup.cfg +0 -0
  59. {polytope_python-1.0.36 → polytope_python-1.0.37}/setup.py +0 -0
  60. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_axis_mappers.py +0 -0
  61. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_bad_request_error.py +0 -0
  62. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_combinatorics.py +0 -0
  63. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_cyclic_axis_over_negative_vals.py +0 -0
  64. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_cyclic_axis_slicer_not_0.py +0 -0
  65. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_cyclic_axis_slicing.py +0 -0
  66. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_cyclic_nearest.py +0 -0
  67. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_cyclic_simple.py +0 -0
  68. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_cyclic_snapping.py +0 -0
  69. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_datacube_axes_init.py +0 -0
  70. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_datacube_mock.py +0 -0
  71. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_datacube_xarray.py +0 -0
  72. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_date_time_unmerged.py +0 -0
  73. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_ecmwf_oper_data_fdb.py +0 -0
  74. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_engine_slicer.py +0 -0
  75. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_fdb_datacube.py +0 -0
  76. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_fdb_unmap_tree.py +0 -0
  77. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_float_type.py +0 -0
  78. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_healpix_mapper.py +0 -0
  79. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_healpix_nested_grid.py +0 -0
  80. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_hull_slicer.py +0 -0
  81. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_hullslicer_engine.py +0 -0
  82. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_incomplete_tree_fdb.py +0 -0
  83. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_local_grid_cyclic.py +0 -0
  84. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_local_regular_grid.py +0 -0
  85. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_local_swiss_grid.py +0 -0
  86. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_mappers.py +0 -0
  87. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_merge_cyclic_octahedral.py +0 -0
  88. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_merge_octahedral_one_axis.py +0 -0
  89. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_merge_transformation.py +0 -0
  90. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_multiple_param_fdb.py +0 -0
  91. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_octahedral_grid.py +0 -0
  92. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_override_md5_hash_options.py +0 -0
  93. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_point_nearest.py +0 -0
  94. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_point_shape.py +0 -0
  95. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_profiling_requesttree.py +0 -0
  96. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_reduced_ll_grid.py +0 -0
  97. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_regular_grid.py +0 -0
  98. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_regular_reduced_grid.py +0 -0
  99. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_request_tree.py +0 -0
  100. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_request_trees_after_slicing.py +0 -0
  101. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_reverse_transformation.py +0 -0
  102. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_shapes.py +0 -0
  103. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slice_date_range_fdb.py +0 -0
  104. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slice_date_range_fdb_v2.py +0 -0
  105. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slice_fdb_box.py +0 -0
  106. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slicer_engine.py +0 -0
  107. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slicer_era5.py +0 -0
  108. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slicer_xarray.py +0 -0
  109. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slicing_unsliceable_axis.py +0 -0
  110. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slicing_xarray_3D.py +0 -0
  111. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_slicing_xarray_4D.py +0 -0
  112. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_snapping.py +0 -0
  113. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_snapping_real_data.py +0 -0
  114. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_tree_protobuf.py +0 -0
  115. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_tree_protobuf_encoding.py +0 -0
  116. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_tree_protobuf_encoding_fdb.py +0 -0
  117. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_type_change_transformation.py +0 -0
  118. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_union_gj.py +0 -0
  119. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_union_point_box.py +0 -0
  120. {polytope_python-1.0.36 → polytope_python-1.0.37}/tests/test_wave_spectra_data.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polytope-python
3
- Version: 1.0.36
3
+ Version: 1.0.37
4
4
  Summary: Polytope datacube feature extraction library
5
5
  Home-page: https://github.com/ecmwf/polytope
6
6
  Author: ECMWF
@@ -236,9 +236,12 @@ class FDBDatacube(Datacube):
236
236
  raise Exception("nearest point search axes are wrong")
237
237
 
238
238
  second_ax = requests.children[0].children[0].axis
239
- nearest_pts = self.nearest_search.get(first_ax_name, None)
239
+
240
+ nearest_pts = self.nearest_search.get((first_ax_name, second_ax_name), None)
240
241
  if nearest_pts is None:
241
- nearest_pts = self.nearest_search[second_ax_name]
242
+ nearest_pts = self.nearest_search.get((second_ax_name, first_ax_name), None)
243
+ for i, pt in enumerate(nearest_pts):
244
+ nearest_pts[i] = [pt[1], pt[0]]
242
245
 
243
246
  transformed_nearest_pts = []
244
247
  for point in nearest_pts:
@@ -67,10 +67,10 @@ class Polytope:
67
67
  for polytope in request.polytopes():
68
68
  method = polytope.method
69
69
  if method == "nearest":
70
- if self.datacube.nearest_search.get(polytope.axes()[0], None) is None:
71
- self.datacube.nearest_search[polytope.axes()[0]] = polytope.values
70
+ if self.datacube.nearest_search.get(tuple(polytope.axes()), None) is None:
71
+ self.datacube.nearest_search[tuple(polytope.axes())] = polytope.values
72
72
  else:
73
- self.datacube.nearest_search[polytope.axes()[0]].append(polytope.values[0])
73
+ self.datacube.nearest_search[tuple(polytope.axes())].append(polytope.values[0])
74
74
  request_tree = self.engine.extract(self.datacube, request.polytopes())
75
75
  logging.info("Created request tree for %s ", self.context)
76
76
  self.datacube.get(request_tree, self.context)
@@ -68,8 +68,10 @@ class Product(Shape):
68
68
  # TODO
69
69
  all_axes = []
70
70
  for poly in polytopes:
71
- all_axes.extend(poly.axes())
72
- self._axes = list(set(all_axes))
71
+ for ax in poly.axes():
72
+ if ax not in all_axes:
73
+ all_axes.append(ax)
74
+ self._axes = all_axes
73
75
  # Check there weren't any duplicates in the polytopes' axes
74
76
  assert len(self._axes) == len(all_axes)
75
77
 
@@ -0,0 +1 @@
1
+ __version__ = "1.0.37"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polytope-python
3
- Version: 1.0.36
3
+ Version: 1.0.37
4
4
  Summary: Polytope datacube feature extraction library
5
5
  Home-page: https://github.com/ecmwf/polytope
6
6
  Author: ECMWF
@@ -117,6 +117,57 @@ class TestSlicingFDBDatacube:
117
117
  tot_leaves += len(leaf.result)
118
118
  assert tot_leaves == 9
119
119
 
120
+ @pytest.mark.fdb
121
+ def test_fdb_datacube_axis_order(self):
122
+ import pygribjump as gj
123
+
124
+ request = Request(
125
+ Select("step", [0]),
126
+ Select("levtype", ["sfc"]),
127
+ Span("date", pd.Timestamp("20230625T120000"), pd.Timestamp("20230626T120000")),
128
+ Select("domain", ["g"]),
129
+ Select("expver", ["0001"]),
130
+ Select("param", ["167"]),
131
+ Select("class", ["od"]),
132
+ Select("stream", ["oper"]),
133
+ Select("type", ["an"]),
134
+ Union(
135
+ ["latitude", "longitude"],
136
+ Point(["latitude", "longitude"], [[25, 30]], method="nearest"),
137
+ ),
138
+ )
139
+
140
+ inverted_request = Request(
141
+ Select("step", [0]),
142
+ Select("levtype", ["sfc"]),
143
+ Span("date", pd.Timestamp("20230625T120000"), pd.Timestamp("20230626T120000")),
144
+ Select("domain", ["g"]),
145
+ Select("expver", ["0001"]),
146
+ Select("param", ["167"]),
147
+ Select("class", ["od"]),
148
+ Select("stream", ["oper"]),
149
+ Select("type", ["an"]),
150
+ Union(
151
+ ["longitude", "latitude"],
152
+ Point(["longitude", "latitude"], [[30, 25]], method="nearest"),
153
+ ),
154
+ )
155
+
156
+ self.fdbdatacube = gj.GribJump()
157
+ self.slicer = HullSlicer()
158
+ self.API = Polytope(
159
+ datacube=self.fdbdatacube,
160
+ engine=self.slicer,
161
+ options=self.options,
162
+ )
163
+ result = self.API.retrieve(request)
164
+ inverted_result = self.API.retrieve(inverted_request)
165
+ result.pprint()
166
+ inverted_result.pprint()
167
+ assert len(result.leaves) == 1
168
+ assert len(inverted_result.leaves) == 1
169
+ assert inverted_result.leaves[0].result == result.leaves[0].result
170
+
120
171
  # @pytest.mark.fdb
121
172
  # def test_fdb_datacube_mix_methods(self):
122
173
  # import pygribjump as gj
@@ -1 +0,0 @@
1
- __version__ = "1.0.36"