polytope-python 1.0.25__tar.gz → 1.0.27__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.
- {polytope-python-1.0.25/polytope_python.egg-info → polytope-python-1.0.27}/PKG-INFO +1 -1
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/backends/fdb.py +14 -3
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/datacube_axis.py +29 -8
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/datacube_mappers.py +1 -0
- polytope-python-1.0.27/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/reduced_gaussian.py +1459 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_type_change/datacube_type_change.py +47 -1
- polytope-python-1.0.27/polytope_feature/version.py +1 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27/polytope_python.egg-info}/PKG-INFO +1 -1
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_python.egg-info/SOURCES.txt +1 -0
- polytope-python-1.0.25/polytope_feature/version.py +0 -1
- {polytope-python-1.0.25 → polytope-python-1.0.27}/LICENSE +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/MANIFEST.in +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/backends/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/backends/datacube.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/backends/mock.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/backends/xarray.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/index_tree_pb2.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/tensor_index_tree.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_cyclic/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_cyclic/datacube_cyclic.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/healpix_nested.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/local_regular.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/octahedral.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/reduced_ll.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_mappers/mapper_types/regular.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_merger/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_merger/datacube_merger.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_reverse/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_reverse/datacube_reverse.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_transformations.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/transformations/datacube_type_change/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/tree_encoding.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/engine/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/engine/engine.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/engine/hullslicer.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/options.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/polytope.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/shapes.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/utility/__init__.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/utility/combinatorics.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/utility/exceptions.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/utility/geometry.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/utility/list_tools.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/utility/profiling.py +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_python.egg-info/dependency_links.txt +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_python.egg-info/not-zip-safe +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_python.egg-info/requires.txt +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_python.egg-info/top_level.txt +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/pyproject.toml +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/requirements.txt +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/setup.cfg +0 -0
- {polytope-python-1.0.25 → polytope-python-1.0.27}/setup.py +0 -0
|
@@ -80,10 +80,21 @@ class FDBDatacube(Datacube):
|
|
|
80
80
|
(upper, lower, idx) = polytope.extents(ax)
|
|
81
81
|
if "sfc" in polytope.points[idx]:
|
|
82
82
|
self.fdb_coordinates.pop("levelist", None)
|
|
83
|
+
|
|
84
|
+
if ax == "param":
|
|
85
|
+
(upper, lower, idx) = polytope.extents(ax)
|
|
86
|
+
if "140251" not in polytope.points[idx]:
|
|
87
|
+
self.fdb_coordinates.pop("direction", None)
|
|
88
|
+
self.fdb_coordinates.pop("frequency", None)
|
|
89
|
+
else:
|
|
90
|
+
# special param with direction and frequency
|
|
91
|
+
if len(polytope.points[idx]) > 1:
|
|
92
|
+
raise ValueError(
|
|
93
|
+
"Param 251 is part of a special branching of the datacube. Please request it separately." # noqa: E501
|
|
94
|
+
)
|
|
83
95
|
self.fdb_coordinates.pop("quantile", None)
|
|
84
|
-
|
|
85
|
-
self.fdb_coordinates.pop("
|
|
86
|
-
self.fdb_coordinates.pop("frequency", None)
|
|
96
|
+
self.fdb_coordinates.pop("year", None)
|
|
97
|
+
self.fdb_coordinates.pop("month", None)
|
|
87
98
|
|
|
88
99
|
# NOTE: verify that we also remove the axis object for axes we've removed here
|
|
89
100
|
axes_to_remove = set(self.complete_axes) - set(self.fdb_coordinates.keys())
|
{polytope-python-1.0.25 → polytope-python-1.0.27}/polytope_feature/datacube/datacube_axis.py
RENAMED
|
@@ -5,6 +5,7 @@ from typing import Any, List
|
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import pandas as pd
|
|
8
|
+
import xarray as xr
|
|
8
9
|
|
|
9
10
|
from .transformations.datacube_cyclic.datacube_cyclic import DatacubeAxisCyclic
|
|
10
11
|
from .transformations.datacube_mappers.datacube_mappers import DatacubeMapper
|
|
@@ -142,22 +143,39 @@ class DatacubeAxis(ABC):
|
|
|
142
143
|
)
|
|
143
144
|
return indexes_between_ranges
|
|
144
145
|
|
|
146
|
+
@staticmethod
|
|
147
|
+
def values_type(values):
|
|
148
|
+
type_ = None
|
|
149
|
+
if isinstance(values, xr.core.variable.IndexVariable) or isinstance(values, xr.core.variable.Variable):
|
|
150
|
+
# If we have some xarray variable, transform them to actual variable type
|
|
151
|
+
values = np.array(values)
|
|
152
|
+
type_ = values.dtype.type
|
|
153
|
+
else:
|
|
154
|
+
if len(values) == 0:
|
|
155
|
+
# If we have no values (newly created axis), default to a float
|
|
156
|
+
values = np.array(values)
|
|
157
|
+
type_ = values.dtype.type
|
|
158
|
+
else:
|
|
159
|
+
type_ = type(values[0])
|
|
160
|
+
return type_
|
|
161
|
+
|
|
145
162
|
@staticmethod
|
|
146
163
|
def create_standard(name, values, datacube):
|
|
147
|
-
|
|
148
|
-
|
|
164
|
+
val_type = DatacubeAxis.values_type(values)
|
|
165
|
+
|
|
166
|
+
DatacubeAxis.check_axis_type(name, val_type)
|
|
149
167
|
if datacube._axes is None:
|
|
150
|
-
datacube._axes = {name: deepcopy(_type_to_axis_lookup[
|
|
168
|
+
datacube._axes = {name: deepcopy(_type_to_axis_lookup[val_type])}
|
|
151
169
|
else:
|
|
152
|
-
datacube._axes[name] = deepcopy(_type_to_axis_lookup[
|
|
170
|
+
datacube._axes[name] = deepcopy(_type_to_axis_lookup[val_type])
|
|
171
|
+
|
|
153
172
|
datacube._axes[name].name = name
|
|
154
173
|
datacube.axis_counter += 1
|
|
155
174
|
|
|
156
175
|
@staticmethod
|
|
157
|
-
def check_axis_type(name,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
raise ValueError(f"Could not create a mapper for index type {values.dtype.type} for axis {name}")
|
|
176
|
+
def check_axis_type(name, val_type):
|
|
177
|
+
if val_type not in _type_to_axis_lookup:
|
|
178
|
+
raise ValueError(f"Could not create a mapper for index type {val_type} for axis {name}")
|
|
161
179
|
|
|
162
180
|
|
|
163
181
|
transformations_order = [
|
|
@@ -302,10 +320,13 @@ _type_to_axis_lookup = {
|
|
|
302
320
|
np.int64: IntDatacubeAxis(),
|
|
303
321
|
np.datetime64: PandasTimestampDatacubeAxis(),
|
|
304
322
|
np.timedelta64: PandasTimedeltaDatacubeAxis(),
|
|
323
|
+
pd.Timedelta: PandasTimedeltaDatacubeAxis(),
|
|
305
324
|
np.float64: FloatDatacubeAxis(),
|
|
306
325
|
np.float32: FloatDatacubeAxis(),
|
|
307
326
|
np.int32: IntDatacubeAxis(),
|
|
308
327
|
np.str_: UnsliceableDatacubeAxis(),
|
|
309
328
|
str: UnsliceableDatacubeAxis(),
|
|
310
329
|
np.object_: UnsliceableDatacubeAxis(),
|
|
330
|
+
int: IntDatacubeAxis(),
|
|
331
|
+
float: FloatDatacubeAxis(),
|
|
311
332
|
}
|