polytope-python 1.0.12__tar.gz → 1.0.14__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.12/polytope_python.egg-info → polytope-python-1.0.14}/PKG-INFO +1 -1
  2. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/backends/fdb.py +18 -6
  3. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/options.py +2 -5
  4. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/utility/exceptions.py +5 -0
  5. polytope-python-1.0.14/polytope_feature/version.py +1 -0
  6. {polytope-python-1.0.12 → polytope-python-1.0.14/polytope_python.egg-info}/PKG-INFO +1 -1
  7. polytope-python-1.0.12/polytope_feature/version.py +0 -1
  8. {polytope-python-1.0.12 → polytope-python-1.0.14}/LICENSE +0 -0
  9. {polytope-python-1.0.12 → polytope-python-1.0.14}/MANIFEST.in +0 -0
  10. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/__init__.py +0 -0
  11. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/__init__.py +0 -0
  12. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/backends/__init__.py +0 -0
  13. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/backends/datacube.py +0 -0
  14. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/backends/mock.py +0 -0
  15. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/backends/xarray.py +0 -0
  16. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/datacube_axis.py +0 -0
  17. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/index_tree_pb2.py +0 -0
  18. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/tensor_index_tree.py +0 -0
  19. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/__init__.py +0 -0
  20. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_cyclic/__init__.py +0 -0
  21. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_cyclic/datacube_cyclic.py +0 -0
  22. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/__init__.py +0 -0
  23. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/datacube_mappers.py +0 -0
  24. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/__init__.py +0 -0
  25. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix.py +0 -0
  26. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix_nested.py +0 -0
  27. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/local_regular.py +0 -0
  28. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/octahedral.py +0 -0
  29. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/reduced_ll.py +0 -0
  30. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/regular.py +0 -0
  31. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_merger/__init__.py +0 -0
  32. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_merger/datacube_merger.py +0 -0
  33. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_reverse/__init__.py +0 -0
  34. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_reverse/datacube_reverse.py +0 -0
  35. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_transformations.py +0 -0
  36. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_type_change/__init__.py +0 -0
  37. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/transformations/datacube_type_change/datacube_type_change.py +0 -0
  38. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/datacube/tree_encoding.py +0 -0
  39. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/engine/__init__.py +0 -0
  40. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/engine/engine.py +0 -0
  41. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/engine/hullslicer.py +0 -0
  42. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/polytope.py +0 -0
  43. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/shapes.py +0 -0
  44. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/utility/__init__.py +0 -0
  45. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/utility/combinatorics.py +0 -0
  46. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/utility/geometry.py +0 -0
  47. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/utility/list_tools.py +0 -0
  48. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_feature/utility/profiling.py +0 -0
  49. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_python.egg-info/SOURCES.txt +0 -0
  50. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_python.egg-info/dependency_links.txt +0 -0
  51. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_python.egg-info/not-zip-safe +0 -0
  52. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_python.egg-info/requires.txt +0 -0
  53. {polytope-python-1.0.12 → polytope-python-1.0.14}/polytope_python.egg-info/top_level.txt +0 -0
  54. {polytope-python-1.0.12 → polytope-python-1.0.14}/pyproject.toml +0 -0
  55. {polytope-python-1.0.12 → polytope-python-1.0.14}/requirements.txt +0 -0
  56. {polytope-python-1.0.12 → polytope-python-1.0.14}/setup.cfg +0 -0
  57. {polytope-python-1.0.12 → polytope-python-1.0.14}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: polytope-python
3
- Version: 1.0.12
3
+ Version: 1.0.14
4
4
  Summary: Polytope datacube feature extraction library
5
5
  Home-page: https://github.com/ecmwf/polytope
6
6
  Author: ECMWF
@@ -3,7 +3,7 @@ import operator
3
3
  from copy import deepcopy
4
4
  from itertools import product
5
5
 
6
- from ...utility.exceptions import BadRequestError
6
+ from ...utility.exceptions import BadGridError, BadRequestError
7
7
  from ...utility.geometry import nearest_pt
8
8
  from .datacube import Datacube, TensorIndexTree
9
9
 
@@ -95,7 +95,6 @@ class FDBDatacube(Datacube):
95
95
  def get(self, requests: TensorIndexTree, context=None):
96
96
  if context is None:
97
97
  context = {}
98
- requests.pprint()
99
98
  if len(requests.children) == 0:
100
99
  return requests
101
100
  fdb_requests = []
@@ -124,11 +123,24 @@ class FDBDatacube(Datacube):
124
123
  complete_uncompressed_request = (uncompressed_request, compressed_request[1], self.grid_md5_hash)
125
124
  complete_list_complete_uncompressed_requests.append(complete_uncompressed_request)
126
125
  complete_fdb_decoding_info.append(fdb_requests_decoding_info[j])
127
- logging.debug("The requests we give GribJump are: %s", complete_list_complete_uncompressed_requests)
126
+
127
+ if logging.root.level <= logging.DEBUG:
128
+ printed_list_to_gj = complete_list_complete_uncompressed_requests[::1000]
129
+ logging.debug("The requests we give GribJump are: %s", printed_list_to_gj)
128
130
  logging.info("Requests given to GribJump extract for %s", context)
129
- output_values = self.gj.extract(complete_list_complete_uncompressed_requests, context)
131
+ try:
132
+ output_values = self.gj.extract(complete_list_complete_uncompressed_requests, context)
133
+ except Exception as e:
134
+ if "BadValue: Grid hash mismatch" in str(e):
135
+ logging.info("Error is: %s", e)
136
+ raise BadGridError()
137
+ else:
138
+ raise e
139
+
130
140
  logging.info("Requests extracted from GribJump for %s", context)
131
- logging.debug("GribJump outputs: %s", output_values)
141
+ if logging.root.level <= logging.DEBUG:
142
+ printed_output_values = output_values[::1000]
143
+ logging.debug("GribJump outputs: %s", printed_output_values)
132
144
  self.assign_fdb_output_to_nodes(output_values, complete_fdb_decoding_info)
133
145
 
134
146
  def get_fdb_requests(
@@ -143,7 +155,7 @@ class FDBDatacube(Datacube):
143
155
 
144
156
  # First when request node is root, go to its children
145
157
  if requests.axis.name == "root":
146
- logging.debug("Looking for data for the tree: %s", [leaf.flatten() for leaf in requests.leaves])
158
+ logging.debug("Looking for data for the tree")
147
159
 
148
160
  for c in requests.children:
149
161
  self.get_fdb_requests(c, fdb_requests, fdb_requests_decoding_info)
@@ -1,8 +1,7 @@
1
- import argparse
2
1
  from abc import ABC
3
2
  from typing import Dict, List, Literal, Optional, Union
4
3
 
5
- from conflator import ConfigModel, Conflator
4
+ from conflator import ConfigModel
6
5
  from pydantic import ConfigDict
7
6
 
8
7
 
@@ -68,9 +67,7 @@ class Config(ConfigModel):
68
67
  class PolytopeOptions(ABC):
69
68
  @staticmethod
70
69
  def get_polytope_options(options):
71
- parser = argparse.ArgumentParser(allow_abbrev=False)
72
- conflator = Conflator(app_name="polytope", model=Config, cli=False, argparser=parser, **options)
73
- config_options = conflator.load()
70
+ config_options = Config.model_validate(options)
74
71
 
75
72
  axis_config = config_options.axis_config
76
73
  compressed_axes_config = config_options.compressed_axes_config
@@ -33,3 +33,8 @@ class UnsliceableShapeError(PolytopeError, KeyError):
33
33
  def __init__(self, axis):
34
34
  self.axis = axis
35
35
  self.message = f"Higher-dimensional shape does not support unsliceable axis {axis.name}."
36
+
37
+
38
+ class BadGridError(PolytopeError, ValueError):
39
+ def __init__(self):
40
+ self.message = "Data on this grid is not supported by Polytope."
@@ -0,0 +1 @@
1
+ __version__ = "1.0.14"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: polytope-python
3
- Version: 1.0.12
3
+ Version: 1.0.14
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.12"