polytope-python 1.0.20__tar.gz → 1.0.22__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 (57) hide show
  1. {polytope-python-1.0.20/polytope_python.egg-info → polytope-python-1.0.22}/PKG-INFO +1 -1
  2. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/backends/datacube.py +2 -5
  3. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_cyclic/datacube_cyclic.py +1 -1
  4. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/datacube_mappers.py +1 -1
  5. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix_nested.py +5 -1
  6. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_merger/datacube_merger.py +11 -13
  7. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_reverse/datacube_reverse.py +1 -1
  8. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_transformations.py +5 -5
  9. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_type_change/datacube_type_change.py +1 -1
  10. polytope-python-1.0.22/polytope_feature/version.py +1 -0
  11. {polytope-python-1.0.20 → polytope-python-1.0.22/polytope_python.egg-info}/PKG-INFO +1 -1
  12. polytope-python-1.0.20/polytope_feature/version.py +0 -1
  13. {polytope-python-1.0.20 → polytope-python-1.0.22}/LICENSE +0 -0
  14. {polytope-python-1.0.20 → polytope-python-1.0.22}/MANIFEST.in +0 -0
  15. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/__init__.py +0 -0
  16. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/__init__.py +0 -0
  17. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/backends/__init__.py +0 -0
  18. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/backends/fdb.py +0 -0
  19. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/backends/mock.py +0 -0
  20. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/backends/xarray.py +0 -0
  21. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/datacube_axis.py +0 -0
  22. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/index_tree_pb2.py +0 -0
  23. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/tensor_index_tree.py +0 -0
  24. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/__init__.py +0 -0
  25. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_cyclic/__init__.py +0 -0
  26. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/__init__.py +0 -0
  27. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/__init__.py +0 -0
  28. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix.py +0 -0
  29. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/local_regular.py +0 -0
  30. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/octahedral.py +0 -0
  31. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/reduced_ll.py +0 -0
  32. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/regular.py +0 -0
  33. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_merger/__init__.py +0 -0
  34. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_reverse/__init__.py +0 -0
  35. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/transformations/datacube_type_change/__init__.py +0 -0
  36. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/datacube/tree_encoding.py +0 -0
  37. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/engine/__init__.py +0 -0
  38. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/engine/engine.py +0 -0
  39. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/engine/hullslicer.py +0 -0
  40. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/options.py +0 -0
  41. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/polytope.py +0 -0
  42. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/shapes.py +0 -0
  43. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/utility/__init__.py +0 -0
  44. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/utility/combinatorics.py +0 -0
  45. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/utility/exceptions.py +0 -0
  46. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/utility/geometry.py +0 -0
  47. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/utility/list_tools.py +0 -0
  48. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_feature/utility/profiling.py +0 -0
  49. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_python.egg-info/SOURCES.txt +0 -0
  50. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_python.egg-info/dependency_links.txt +0 -0
  51. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_python.egg-info/not-zip-safe +0 -0
  52. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_python.egg-info/requires.txt +0 -0
  53. {polytope-python-1.0.20 → polytope-python-1.0.22}/polytope_python.egg-info/top_level.txt +0 -0
  54. {polytope-python-1.0.20 → polytope-python-1.0.22}/pyproject.toml +0 -0
  55. {polytope-python-1.0.20 → polytope-python-1.0.22}/requirements.txt +0 -0
  56. {polytope-python-1.0.20 → polytope-python-1.0.22}/setup.cfg +0 -0
  57. {polytope-python-1.0.20 → polytope-python-1.0.22}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: polytope-python
3
- Version: 1.0.20
3
+ Version: 1.0.22
4
4
  Summary: Polytope datacube feature extraction library
5
5
  Home-page: https://github.com/ecmwf/polytope
6
6
  Author: ECMWF
@@ -48,11 +48,8 @@ class Datacube(ABC):
48
48
  def _create_axes(self, name, values, transformation_type_key, transformation_options):
49
49
  # first check what the final axes are for this axis name given transformations
50
50
  transformation_options = transformation_type_key
51
- final_axis_names = DatacubeAxisTransformation.get_final_axes(
52
- name, transformation_type_key.name, transformation_options
53
- )
54
- transformation = DatacubeAxisTransformation.create_transform(
55
- name, transformation_type_key.name, transformation_options
51
+ (final_axis_names, transformation) = DatacubeAxisTransformation.get_final_axes(
52
+ name, transformation_type_key.name, transformation_options, self
56
53
  )
57
54
 
58
55
  # do not compress merged axes
@@ -8,7 +8,7 @@ from ..datacube_transformations import DatacubeAxisTransformation
8
8
  class DatacubeAxisCyclic(DatacubeAxisTransformation):
9
9
  # The transformation here will be to point the old axes to the new cyclic axes
10
10
 
11
- def __init__(self, name, cyclic_options):
11
+ def __init__(self, name, cyclic_options, datacube=None):
12
12
  self.name = name
13
13
  self.transformation_options = cyclic_options
14
14
  self.range = cyclic_options.range
@@ -7,7 +7,7 @@ from ..datacube_transformations import DatacubeAxisTransformation
7
7
  class DatacubeMapper(DatacubeAxisTransformation):
8
8
  # Needs to implements DatacubeAxisTransformation methods
9
9
 
10
- def __init__(self, name, mapper_options):
10
+ def __init__(self, name, mapper_options, datacube=None):
11
11
  self.transformation_options = mapper_options
12
12
  self.grid_type = mapper_options.type
13
13
  self.grid_resolution = mapper_options.resolution
@@ -222,4 +222,8 @@ class NestedHealpixGridMapper(DatacubeMapper):
222
222
 
223
223
 
224
224
  # md5 grid hash in form {resolution : hash}
225
- _md5_hash = {}
225
+ _md5_hash = {
226
+ 1024: "cbda19e48d4d7e5e22641154878b9b22",
227
+ 512: "9533855ee8e38314e19aaa0434c310da",
228
+ 128: "f3dfeb7a5bbbdd13a20d10fdb3797c71",
229
+ }
@@ -7,12 +7,13 @@ from ..datacube_transformations import DatacubeAxisTransformation
7
7
 
8
8
 
9
9
  class DatacubeAxisMerger(DatacubeAxisTransformation):
10
- def __init__(self, name, merge_options):
10
+ def __init__(self, name, merge_options, datacube=None):
11
11
  self.transformation_options = merge_options
12
12
  self.name = name
13
13
  self._first_axis = name
14
14
  self._second_axis = merge_options.other_axis
15
15
  self._linkers = merge_options.linkers
16
+ self._merged_values = self.merged_values(datacube)
16
17
 
17
18
  def blocked_axes(self):
18
19
  return [self._second_axis]
@@ -24,20 +25,17 @@ class DatacubeAxisMerger(DatacubeAxisTransformation):
24
25
  return self._first_axis
25
26
 
26
27
  def merged_values(self, datacube):
27
- first_ax_vals = datacube.ax_vals(self.name)
28
+ first_ax_vals = np.array(datacube.ax_vals(self.name))
28
29
  second_ax_name = self._second_axis
29
- second_ax_vals = datacube.ax_vals(second_ax_name)
30
+ second_ax_vals = np.array(datacube.ax_vals(second_ax_name))
30
31
  linkers = self._linkers
31
- merged_values = []
32
- for i in range(len(first_ax_vals)):
33
- first_val = first_ax_vals[i]
34
- for j in range(len(second_ax_vals)):
35
- second_val = second_ax_vals[j]
36
- val_to_add = pd.to_datetime("".join([first_val, linkers[0], second_val, linkers[1]]))
37
- val_to_add = val_to_add.to_numpy()
38
- val_to_add = val_to_add.astype("datetime64[s]")
39
- merged_values.append(val_to_add)
32
+ first_grid, second_grid = np.meshgrid(first_ax_vals, second_ax_vals, indexing="ij")
33
+ combined_strings = np.char.add(
34
+ np.char.add(first_grid.ravel(), linkers[0]), np.char.add(second_grid.ravel(), linkers[1])
35
+ )
36
+ merged_values = pd.to_datetime(combined_strings).to_numpy().astype("datetime64[s]")
40
37
  merged_values = np.array(merged_values)
38
+ merged_values.sort()
41
39
  logging.info(
42
40
  f"Merged values {first_ax_vals} on axis {self.name} and \
43
41
  values {second_ax_vals} on axis {second_ax_name} to values {merged_values}"
@@ -78,7 +76,7 @@ class DatacubeAxisMerger(DatacubeAxisTransformation):
78
76
 
79
77
  def find_modified_indexes(self, indexes, path, datacube, axis):
80
78
  if axis.name == self._first_axis:
81
- return self.merged_values(datacube)
79
+ return self._merged_values
82
80
 
83
81
  def unmap_path_key(self, key_value_path, leaf_path, unwanted_path, axis):
84
82
  new_key_value_path = {}
@@ -3,7 +3,7 @@ from ..datacube_transformations import DatacubeAxisTransformation
3
3
 
4
4
 
5
5
  class DatacubeAxisReverse(DatacubeAxisTransformation):
6
- def __init__(self, name, mapper_options):
6
+ def __init__(self, name, mapper_options, datacube=None):
7
7
  self.name = name
8
8
  self.transformation_options = mapper_options
9
9
 
@@ -8,25 +8,25 @@ class DatacubeAxisTransformation(ABC):
8
8
  self.parent = None
9
9
 
10
10
  @staticmethod
11
- def create_transform(name, transformation_type_key, transformation_options):
11
+ def create_transform(name, transformation_type_key, transformation_options, datacube):
12
12
  transformation_type = _type_to_datacube_transformation_lookup[transformation_type_key]
13
13
  transformation_file_name = _type_to_transformation_file_lookup[transformation_type_key]
14
14
  file_name = ".datacube_" + transformation_file_name
15
15
  module = import_module("polytope_feature.datacube.transformations" + file_name + file_name)
16
16
  constructor = getattr(module, transformation_type)
17
17
  transformation_type_option = transformation_options
18
- new_transformation = deepcopy(constructor(name, transformation_type_option))
18
+ new_transformation = deepcopy(constructor(name, transformation_type_option, datacube))
19
19
 
20
20
  new_transformation.name = name
21
21
  return new_transformation
22
22
 
23
23
  @staticmethod
24
- def get_final_axes(name, transformation_type_key, transformation_options):
24
+ def get_final_axes(name, transformation_type_key, transformation_options, datacube):
25
25
  new_transformation = DatacubeAxisTransformation.create_transform(
26
- name, transformation_type_key, transformation_options
26
+ name, transformation_type_key, transformation_options, datacube
27
27
  )
28
28
  transformation_axis_names = new_transformation.transformation_axes_final()
29
- return transformation_axis_names
29
+ return (transformation_axis_names, new_transformation)
30
30
 
31
31
  def name(self):
32
32
  pass
@@ -7,7 +7,7 @@ from ..datacube_transformations import DatacubeAxisTransformation
7
7
  class DatacubeAxisTypeChange(DatacubeAxisTransformation):
8
8
  # The transformation here will be to point the old axes to the new cyclic axes
9
9
 
10
- def __init__(self, name, type_options):
10
+ def __init__(self, name, type_options, datacube=None):
11
11
  self.name = name
12
12
  self.transformation_options = type_options
13
13
  self.new_type = type_options.type
@@ -0,0 +1 @@
1
+ __version__ = "1.0.22"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: polytope-python
3
- Version: 1.0.20
3
+ Version: 1.0.22
4
4
  Summary: Polytope datacube feature extraction library
5
5
  Home-page: https://github.com/ecmwf/polytope
6
6
  Author: ECMWF
@@ -1 +0,0 @@
1
- __version__ = "1.0.20"