diff --git a/Dockerfile b/Dockerfile index d09000a4..60eb5573 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,7 @@ -# Use the continuumio/anaconda3 image as a base -# https://hub.docker.com/r/continuumio/anaconda3 -FROM continuumio/anaconda3:latest +FROM python:3.12 # Creare maintained -MAINTAINER Creare podpac@creare.com +LABEL org.opencontainers.image.authors="podpac@creare.com" # Install general tools RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \ @@ -11,12 +9,9 @@ RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-r curl \ unzip \ tar \ - wget - -# Create a podpac anaconda environment and activate -RUN conda init bash && . ~/.bashrc \ - && conda create --yes --name podpac python=3 anaconda \ - && conda activate podpac - + wget && \ + apt-get clean +COPY . /opt/podpac +WORKDIR /opt/podpac # Install PODPAC with all dependencies -RUN pip install podpac[all] +RUN pip install .[all] diff --git a/doc/source/conf.py b/doc/source/conf.py index 179b0778..28832aba 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -20,8 +20,6 @@ import os from shutil import copyfile -# import sys -# sys.path.insert(0, os.path.abspath('.')) import datetime # for parsing markdown files diff --git a/podpac/__init__.py b/podpac/__init__.py index 4a8a5fb7..37d97f7a 100644 --- a/podpac/__init__.py +++ b/podpac/__init__.py @@ -22,9 +22,7 @@ def makedirs(name, mode=511, exist_ok=False): try: _osmakedirs(name, mode) except OSError as e: - if exist_ok: - pass - else: + if not exist_ok: raise e diff --git a/podpac/core/__init__.py b/podpac/core/__init__.py index 4c74052d..0cbe15cd 100644 --- a/podpac/core/__init__.py +++ b/podpac/core/__init__.py @@ -22,4 +22,3 @@ def lazy_module(modname, *args, **kwargs): plt = lazy_import.lazy_module("matplotlib.pyplot") np = lazy_import.lazy_module("numpy") tl = lazy_import.lazy_module("traitlets") -# xr = lazy_import.lazy_module("xarray") diff --git a/podpac/core/algorithm/stats.py b/podpac/core/algorithm/stats.py index 54dba270..da68bc86 100644 --- a/podpac/core/algorithm/stats.py +++ b/podpac/core/algorithm/stats.py @@ -575,15 +575,6 @@ def reduce(self, x): UnitsDataArray Skew of the source data over dims """ - # N = np.isfinite(x).sum(dim=self._dims) - # M1 = x.mean(dim=self._dims) - # E = x - M1 - # E2 = E**2 - # E3 = E2*E - # M2 = (E2).sum(dim=self._dims) - # M3 = (E3).sum(dim=self._dims) - # skew = self.skew(M3, M2, N) - a = self._reshape(x) skew = scipy.stats.skew(a, nan_policy="omit") return skew @@ -660,15 +651,6 @@ def reduce(self, x): UnitsDataArray Kurtosis of the source data over dims """ - # N = np.isfinite(x).sum(dim=self._dims) - # M1 = x.mean(dim=self._dims) - # E = x - M1 - # E2 = E**2 - # E4 = E2**2 - # M2 = (E2).sum(dim=self._dims) - # M4 = (E4).sum(dim=self._dims) - # kurtosis = N * M4 / M2**2 - 3 - a = self._reshape(x) kurtosis = scipy.stats.kurtosis(a, nan_policy="omit") return kurtosis @@ -910,12 +892,6 @@ def _eval(self, coordinates, output=None, _selector=None): else: output.data[:] = out.data[:] - ## map - # eval_time = xr.DataArray(coordinates.coords["time"]) - # E = getattr(eval_time.dt, self.groupby) - # out = out.sel(**{self.groupby: E}).rename({self.groupby: "time"}) - # output[:] = out.transpose(*output.dims).data - return output @tl.default("base_ref") @@ -1002,12 +978,6 @@ def _eval(self, coordinates, output=None, _selector=None): else: output.data[:] = out.data[:] - ## map - # eval_time = xr.DataArray(coordinates.coords["time"]) - # E = getattr(eval_time.dt, self.groupby) - # out = out.sel(**{self.groupby: E}).rename({self.groupby: "time"}) - # output[:] = out.transpose(*output.dims).data - return output @tl.default("base_ref") diff --git a/podpac/core/cache/s3_cache_store.py b/podpac/core/cache/s3_cache_store.py index 58ef71b4..605e859b 100644 --- a/podpac/core/cache/s3_cache_store.py +++ b/podpac/core/cache/s3_cache_store.py @@ -50,7 +50,6 @@ def __init__(self, s3_bucket=None, aws_region_name=None, aws_access_key_id=None, aws_session = boto3.session.Session(region_name=aws_region_name) self._s3_client = aws_session.client( "s3", - # config= boto3.session.Config(signature_version='s3v4'), aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, ) diff --git a/podpac/core/compositor/test/test_base_compositor.py b/podpac/core/compositor/test/test_base_compositor.py index 48e945a0..c31ba79b 100644 --- a/podpac/core/compositor/test/test_base_compositor.py +++ b/podpac/core/compositor/test/test_base_compositor.py @@ -46,33 +46,33 @@ def test_source_coordinates(self): assert node.source_coordinates is None # unstacked - node = BaseCompositor( + BaseCompositor( sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], source_coordinates=podpac.Coordinates([[0, 1]], dims=["time"]), ) # stacked - node = BaseCompositor( + BaseCompositor( sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], source_coordinates=podpac.Coordinates([[[0, 1], [10, 20]]], dims=["time_alt"]), ) # invalid size with pytest.raises(ValueError, match="Invalid source_coordinates, source and source_coordinates size mismatch"): - node = BaseCompositor( + BaseCompositor( sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], source_coordinates=podpac.Coordinates([[0, 1, 2]], dims=["time"]), ) with pytest.raises(ValueError, match="Invalid source_coordinates, source and source_coordinates size mismatch"): - node = BaseCompositor( + BaseCompositor( sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], source_coordinates=podpac.Coordinates([[0, 1, 2]], dims=["time"]), ) # invalid ndims with pytest.raises(ValueError, match="Invalid source_coordinates"): - node = BaseCompositor( + BaseCompositor( sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], source_coordinates=podpac.Coordinates([[0, 1], [10, 20]], dims=["time", "alt"]), ) @@ -252,7 +252,7 @@ def test_auto_outputs(self): # mixed with pytest.raises(ValueError, match="Cannot composite standard sources with multi-output sources."): - node = BaseCompositor(sources=[MULTI_2_X, ARRAY_LAT], auto_outputs=True) + BaseCompositor(sources=[MULTI_2_X, ARRAY_LAT], auto_outputs=True) # no sources node = BaseCompositor(sources=[], auto_outputs=True) diff --git a/podpac/core/coordinates/array_coordinates1d.py b/podpac/core/coordinates/array_coordinates1d.py index f24cada4..9af7e4f5 100644 --- a/podpac/core/coordinates/array_coordinates1d.py +++ b/podpac/core/coordinates/array_coordinates1d.py @@ -62,10 +62,7 @@ def __init__(self, coordinates, name=None, **kwargs): self.not_a_trait = coordinates # precalculate once - if self.coordinates.size == 0: - pass - - elif self.coordinates.size == 1: + if self.coordinates.size == 1: self._is_monotonic = True elif self.coordinates.ndim > 1: @@ -73,7 +70,7 @@ def __init__(self, coordinates, name=None, **kwargs): self._is_descending = None self._is_uniform = None - else: + elif self.coordinates.size != 0: deltas = self.deltas if np.any(deltas <= 0): self._is_monotonic = False diff --git a/podpac/core/coordinates/coordinates.py b/podpac/core/coordinates/coordinates.py index 8dea1730..14eaeb2e 100644 --- a/podpac/core/coordinates/coordinates.py +++ b/podpac/core/coordinates/coordinates.py @@ -653,14 +653,13 @@ def __getitem__(self, index): def __setitem__(self, dim, c): # coerce - if isinstance(c, BaseCoordinates): - pass - elif isinstance(c, Coordinates): - c = c[dim] - elif "_" in dim: - c = StackedCoordinates(c) - else: - c = ArrayCoordinates1d(c) + if not isinstance(c, BaseCoordinates): + if isinstance(c, Coordinates): + c = c[dim] + elif "_" in dim: + c = StackedCoordinates(c) + else: + c = ArrayCoordinates1d(c) c._set_name(dim) @@ -937,7 +936,6 @@ def geotransform(self): "{} do not.".format(self) ) if self.udims.index("lon") < self.udims.index("lat"): - # transform = (transform[3], transform[5], transform[4], transform[0], transform[2], transform[1]) transform = transform[3:] + transform[:3] return transform diff --git a/podpac/core/coordinates/polar_coordinates.py b/podpac/core/coordinates/polar_coordinates.py index 85173392..9d2c8123 100644 --- a/podpac/core/coordinates/polar_coordinates.py +++ b/podpac/core/coordinates/polar_coordinates.py @@ -197,17 +197,3 @@ def full_definition(self): def copy(self): return PolarCoordinates(self.center, self.radius, self.theta, dims=self.dims) - - # TODO return PolarCoordinates when possible - # def select(self, other, outer=False): - # raise NotImplementedError("TODO") - - # ------------------------------------------------------------------------------------------------------------------ - # Debug - # ------------------------------------------------------------------------------------------------------------------ - - # def plot(self, marker='b.', center_marker='bx'): - # from matplotlib import pyplot - # super(PolarCoordinates, self).plot(marker=marker) - # cx, cy = self.center - # pyplot.plot(cx, cy, center_marker) diff --git a/podpac/core/coordinates/test/test_affine_coordinates.py b/podpac/core/coordinates/test/test_affine_coordinates.py index 55da96ae..637a2a63 100644 --- a/podpac/core/coordinates/test/test_affine_coordinates.py +++ b/podpac/core/coordinates/test/test_affine_coordinates.py @@ -59,88 +59,6 @@ def test_size_one_simplify(self): assert c2[1].name == "lon" assert c2[0].name == "lat" - # def test_copy(self): - # c = AffineCoordinates(geotransform=GEOTRANSFORM_NORTHUP, shape=(3, 4)) - # c2 = c.copy() - # assert c2 is not c - # assert c2 == c - - -# class TestAffineCoordinatesStandardMethods(object): -# def test_eq_type(self): -# c = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# assert c != [] - -# def test_eq_shape(self): -# c1 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# c2 = RotatedCoordinates(shape=(4, 3), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# assert c1 != c2 - -# def test_eq_affine(self): -# c1 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# c2 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# c3 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 3, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# c4 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[11, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# c5 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.1, 2.0], dims=["lat", "lon"]) - -# assert c1 == c2 -# assert c1 != c3 -# assert c1 != c4 -# assert c1 != c5 - -# def test_eq_dims(self): -# c1 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# c2 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lon", "lat"]) -# assert c1 != c2 - - -# class TestRotatedCoordinatesSerialization(object): -# def test_definition(self): -# c = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# d = c.definition - -# assert isinstance(d, dict) -# json.dumps(d, cls=podpac.core.utils.JSONEncoder) # test serializable -# c2 = RotatedCoordinates.from_definition(d) -# assert c2 == c - -# def test_from_definition_corner(self): -# c1 = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], corner=[15, 17], dims=["lat", "lon"]) - -# d = {"shape": (3, 4), "theta": np.pi / 4, "origin": [10, 20], "corner": [15, 17], "dims": ["lat", "lon"]} -# c2 = RotatedCoordinates.from_definition(d) - -# assert c1 == c2 - -# def test_invalid_definition(self): -# d = {"theta": np.pi / 4, "origin": [10, 20], "step": [1.0, 2.0], "dims": ["lat", "lon"]} -# with pytest.raises(ValueError, match='RotatedCoordinates definition requires "shape"'): -# RotatedCoordinates.from_definition(d) - -# d = {"shape": (3, 4), "origin": [10, 20], "step": [1.0, 2.0], "dims": ["lat", "lon"]} -# with pytest.raises(ValueError, match='RotatedCoordinates definition requires "theta"'): -# RotatedCoordinates.from_definition(d) - -# d = {"shape": (3, 4), "theta": np.pi / 4, "step": [1.0, 2.0], "dims": ["lat", "lon"]} -# with pytest.raises(ValueError, match='RotatedCoordinates definition requires "origin"'): -# RotatedCoordinates.from_definition(d) - -# d = {"shape": (3, 4), "theta": np.pi / 4, "origin": [10, 20], "dims": ["lat", "lon"]} -# with pytest.raises(ValueError, match='RotatedCoordinates definition requires "step" or "corner"'): -# RotatedCoordinates.from_definition(d) - -# d = {"shape": (3, 4), "theta": np.pi / 4, "origin": [10, 20], "step": [1.0, 2.0]} -# with pytest.raises(ValueError, match='RotatedCoordinates definition requires "dims"'): -# RotatedCoordinates.from_definition(d) - -# def test_full_definition(self): -# c = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# d = c.full_definition - -# assert isinstance(d, dict) -# assert set(d.keys()) == {"dims", "shape", "theta", "origin", "step"} -# json.dumps(d, cls=podpac.core.utils.JSONEncoder) # test serializable - class TestAffineCoordinatesProperties(object): def test_origin(self): @@ -177,244 +95,3 @@ def test_coordinates(self): [11.0, 13.0, 15.0, 17.0], ], ) - - # def test_coordinates_rotated(self): - # c = AffineCoordinates(geotransform=GEOTRANSFORM_ROTATED, shape=(3, 4)) - - # assert c.coordinates.shape == (3, 4, 2) - - # # lat - # np.testing.assert_allclose( - # c.coordinates[:, :, 0], - # [ - # [20.000, 22.819, 25.638, 28.457], - # [20.684, 23.503, 26.322, 29.141], - # [21.368, 24.187, 27.006, 29.825] - # ], - # ) - - # # lon - # np.testing.assert_allclose( - # c.coordinates[:, :, 1], - # [ - # [10.000, 8.974, 7.948, 6.922], - # [11.879, 10.853, 9.827, 8.801], - # [13.758, 12.732, 11.706, 10.680], - # ], - # ) - - -# class TestRotatedCoordinatesIndexing(object): -# def test_get_dim(self): -# c = RotatedCoordinates(shape=(3, 4), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) - -# lat = c["lat"] -# lon = c["lon"] -# assert isinstance(lat, ArrayCoordinates1d) -# assert isinstance(lon, ArrayCoordinates1d) -# assert lat.name == "lat" -# assert lon.name == "lon" -# assert_equal(lat.coordinates, c.coordinates[0]) -# assert_equal(lon.coordinates, c.coordinates[1]) - -# with pytest.raises(KeyError, match="Dimension .* not found"): -# c["other"] - -# def test_get_index_slices(self): -# c = RotatedCoordinates(shape=(5, 7), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) - -# # full -# c2 = c[1:4, 2:4] -# assert isinstance(c2, RotatedCoordinates) -# assert c2.shape == (3, 2) -# assert c2.theta == c.theta -# np.testing.assert_allclose(c2.origin, [c.coordinates[0][1, 2], c.coordinates[1][1, 2]]) -# np.testing.assert_allclose(c2.corner, [c.coordinates[0][3, 3], c.coordinates[1][3, 3]]) -# assert c2.dims == c.dims -# np.testing.assert_allclose(c2.coordinates[0], c.coordinates[0][1:4, 2:4]) -# np.testing.assert_allclose(c2.coordinates[1], c.coordinates[1][1:4, 2:4]) - -# # partial/implicit -# c2 = c[1:4] -# assert isinstance(c2, RotatedCoordinates) -# assert c2.shape == (3, 7) -# assert c2.theta == c.theta -# np.testing.assert_allclose(c2.origin, c.coordinates[0][1, 0], c.coordinates[1][1, 0]) -# np.testing.assert_allclose(c2.corner, c.coordinates[0][3, -1], c.coordinates[1][3, -1]) -# assert c2.dims == c.dims -# np.testing.assert_allclose(c2.coordinates[0], c.coordinates[0][1:4]) -# np.testing.assert_allclose(c2.coordinates[1], c.coordinates[1][1:4]) - -# # stepped -# c2 = c[1:4:2, 2:4] -# assert isinstance(c2, RotatedCoordinates) -# assert c2.shape == (2, 2) -# assert c2.theta == c.theta -# np.testing.assert_allclose(c2.origin, [c.coordinates[0][1, 2], c.coordinates[1][1, 2]]) -# np.testing.assert_allclose(c2.corner, [c.coordinates[0][3, 3], c.coordinates[1][3, 3]]) -# assert c2.dims == c.dims -# np.testing.assert_allclose(c2.coordinates[0], c.coordinates[0][1:4:2, 2:4]) -# np.testing.assert_allclose(c2.coordinates[1], c.coordinates[1][1:4:2, 2:4]) - -# # reversed -# c2 = c[4:1:-1, 2:4] -# assert isinstance(c2, RotatedCoordinates) -# assert c2.shape == (3, 2) -# assert c2.theta == c.theta -# np.testing.assert_allclose(c2.origin, c.coordinates[0][1, 2], c.coordinates[0][1, 2]) -# np.testing.assert_allclose(c2.corner, c.coordinates[0][3, 3], c.coordinates[0][3, 3]) -# assert c2.dims == c.dims -# np.testing.assert_allclose(c2.coordinates[0], c.coordinates[0][4:1:-1, 2:4]) -# np.testing.assert_allclose(c2.coordinates[1], c.coordinates[1][4:1:-1, 2:4]) - -# def test_get_index_fallback(self): -# c = RotatedCoordinates(shape=(5, 7), theta=np.pi / 4, origin=[10, 20], step=[1.0, 2.0], dims=["lat", "lon"]) -# lat, lon = c.coordinates - -# I = [3, 1] -# J = slice(1, 4) -# B = lat > 6 - -# # int/slice/indices -# c2 = c[I, J] -# assert isinstance(c2, StackedCoordinates) -# assert c2.shape == (2, 3) -# assert c2.dims == c.dims -# assert_equal(c2["lat"].coordinates, lat[I, J]) -# assert_equal(c2["lon"].coordinates, lon[I, J]) - -# # boolean -# c2 = c[B] -# assert isinstance(c2, StackedCoordinates) -# assert c2.shape == (21,) -# assert c2.dims == c.dims -# assert_equal(c2["lat"].coordinates, lat[B]) -# assert_equal(c2["lon"].coordinates, lon[B]) - - -# class TestRotatedCoordinatesSelection(object): -# def test_select_single(self): -# c = RotatedCoordinates([LAT, LON], dims=['lat', 'lon']) - -# # single dimension -# bounds = {'lat': [0.25, .55]} -# E0, E1 = [0, 1, 1, 1], [3, 0, 1, 2] # expected - -# s = c.select(bounds) -# assert isinstance(s, StackedCoordinates) -# assert s == c[E0, E1] - -# s, I = c.select(bounds, return_index=True) -# assert isinstance(s, StackedCoordinates) -# assert s == c[I] -# assert_equal(I[0], E0) -# assert_equal(I[1], E1) - -# # a different single dimension -# bounds = {'lon': [12.5, 17.5]} -# E0, E1 = [0, 1, 1, 1, 1, 2], [3, 0, 1, 2, 3, 0] - -# s = c.select(bounds) -# assert isinstance(s, StackedCoordinates) -# assert s == c[E0, E1] - -# s, I = c.select(bounds, return_index=True) -# assert isinstance(s, StackedCoordinates) -# assert s == c[I] -# assert_equal(I[0], E0) -# assert_equal(I[1], E1) - -# # outer -# bounds = {'lat': [0.25, .75]} -# E0, E1 = [0, 0, 1, 1, 1, 1, 2, 2], [2, 3, 0, 1, 2, 3, 0, 1] - -# s = c.select(bounds, outer=True) -# assert isinstance(s, StackedCoordinates) -# assert s == c[E0, E1] - -# s, I = c.select(bounds, outer=True, return_index=True) -# assert isinstance(s, StackedCoordinates) -# assert s == c[E0, E1] -# assert_equal(I[0], E0) -# assert_equal(I[1], E1) - -# # no matching dimension -# bounds = {'alt': [0, 10]} -# s = c.select(bounds) -# assert s == c - -# s, I = c.select(bounds, return_index=True) -# assert s == c[I] -# assert s == c - -# def test_select_multiple(self): -# c = RotatedCoordinates([LAT, LON], dims=['lat', 'lon']) - -# # this should be the AND of both intersections -# bounds = {'lat': [0.25, 0.95], 'lon': [10.5, 17.5]} -# E0, E1 = [0, 1, 1, 1, 1, 2], [3, 0, 1, 2, 3, 0] -# s = c.select(bounds) -# assert s == c[E0, E1] - -# s, I = c.select(bounds, return_index=True) -# assert s == c[E0, E1] -# assert_equal(I[0], E0) -# assert_equal(I[1], E1) - -# def test_intersect(self): -# c = RotatedCoordinates([LAT, LON], dims=['lat', 'lon']) - - -# other_lat = ArrayCoordinates1d([0.25, 0.5, .95], name='lat') -# other_lon = ArrayCoordinates1d([10.5, 15, 17.5], name='lon') - -# # single other -# E0, E1 = [0, 1, 1, 1, 1, 2, 2, 2], [3, 0, 1, 2, 3, 0, 1, 2] -# s = c.intersect(other_lat) -# assert s == c[E0, E1] - -# s, I = c.intersect(other_lat, return_index=True) -# assert s == c[E0, E1] -# assert s == c[I] - -# E0, E1 = [0, 0, 1, 1, 1, 1, 2, 2, 2, 2], [2, 3, 0, 1, 2, 3, 0, 1, 2, 3] -# s = c.intersect(other_lat, outer=True) -# assert s == c[E0, E1] - -# E0, E1 = [0, 0, 0, 1, 1, 1, 1, 2], [1, 2, 3, 0, 1, 2, 3, 0] -# s = c.intersect(other_lon) -# assert s == c[E0, E1] - -# # multiple, in various ways -# E0, E1 = [0, 1, 1, 1, 1, 2], [3, 0, 1, 2, 3, 0] - -# other = StackedCoordinates([other_lat, other_lon]) -# s = c.intersect(other) -# assert s == c[E0, E1] - -# other = StackedCoordinates([other_lon, other_lat]) -# s = c.intersect(other) -# assert s == c[E0, E1] - -# from podpac.coordinates import Coordinates -# other = Coordinates([other_lat, other_lon]) -# s = c.intersect(other) -# assert s == c[E0, E1] - -# # full -# other = Coordinates(['2018-01-01'], dims=['time']) -# s = c.intersect(other) -# assert s == c - -# s, I = c.intersect(other, return_index=True) -# assert s == c -# assert s == c[I] - -# def test_intersect_invalid(self): -# c = RotatedCoordinates([LAT, LON], dims=['lat', 'lon']) - -# with pytest.raises(TypeError, match="Cannot intersect with type"): -# c.intersect({}) - -# with pytest.raises(ValueError, match="Cannot intersect mismatched dtypes"): -# c.intersect(ArrayCoordinates1d(['2018-01-01'], name='lat')) diff --git a/podpac/core/coordinates/test/test_coordinates.py b/podpac/core/coordinates/test/test_coordinates.py index e4e9a007..45b8d1a0 100644 --- a/podpac/core/coordinates/test/test_coordinates.py +++ b/podpac/core/coordinates/test/test_coordinates.py @@ -537,7 +537,7 @@ def test_from_xarray(self): # crs warning with pytest.warns(UserWarning, match="using default crs"): - c2 = Coordinates.from_xarray(x.coords) + Coordinates.from_xarray(x.coords) # invalid with pytest.raises(TypeError, match="Coordinates.from_xarray expects an xarray"): @@ -840,7 +840,6 @@ def test_setitem(self): coords.__setitem__("time", ArrayCoordinates1d([1, 2, 3], name="time")) coords.__setitem__("time", Coordinates([[1, 2, 3]], dims=["time"])) - # coords['lat_lon'] = [np.linspace(0, 10, 5), np.linspace(0, 10, 5)] coords.__setitem__("lat_lon", clinspace((0, 1), (10, 20), 5)) coords.__setitem__("lat_lon", (np.linspace(0, 10, 5), np.linspace(0, 10, 5))) coords.__setitem__("lat_lon", Coordinates([(np.linspace(0, 10, 5), np.linspace(0, 10, 5))], dims=["lat_lon"])) @@ -1169,7 +1168,7 @@ def test_unique(self): assert_equal(c2["time"].coordinates, [np.datetime64("2018-01-01"), np.datetime64("2018-01-02")]) assert_equal(c2["alt"].coordinates, []) - # return indices + # check the returned indices c = Coordinates( [[2, 1, 0, 1], ["2018-01-01", "2018-01-02", "2018-01-01"], []], dims=["lat", "time", "alt"], diff --git a/podpac/core/coordinates/test/test_coordinates_utils.py b/podpac/core/coordinates/test/test_coordinates_utils.py index a0add056..65e3ad18 100644 --- a/podpac/core/coordinates/test/test_coordinates_utils.py +++ b/podpac/core/coordinates/test/test_coordinates_utils.py @@ -603,7 +603,7 @@ def test_add_custom_dimension(): # Assert add_valid_dimension must be called with pytest.raises(tl.TraitError): - c1 = podpac.Coordinates([[1, 2, 3]], ["mydim"]) + podpac.Coordinates([[1, 2, 3]], ["mydim"]) # Add a valid dimension add_valid_dimension("mydim") diff --git a/podpac/core/coordinates/test/test_group_coordinates.py b/podpac/core/coordinates/test/test_group_coordinates.py index 62b77751..2c34523b 100644 --- a/podpac/core/coordinates/test/test_group_coordinates.py +++ b/podpac/core/coordinates/test/test_group_coordinates.py @@ -20,7 +20,7 @@ def test_init(self): _ = GroupCoordinates([c1, c2]) # same dims, stacked - c2 = Coordinates([[[0, 1], [0, 1]]], dims=["lat_lon"]) + c1 = Coordinates([[[0, 1], [0, 1]]], dims=["lat_lon"]) c2 = Coordinates([[[10, 11], [10, 11]]], dims=["lat_lon"]) _ = GroupCoordinates([c1, c2]) diff --git a/podpac/core/coordinates/test/test_uniform_coordinates1d.py b/podpac/core/coordinates/test/test_uniform_coordinates1d.py index 058c79b4..e9bfde93 100644 --- a/podpac/core/coordinates/test/test_uniform_coordinates1d.py +++ b/podpac/core/coordinates/test/test_uniform_coordinates1d.py @@ -286,7 +286,6 @@ def test_datetime_year_step(self): def test_anchor_boundaries(self): # ascending, exact c = UniformCoordinates1d("2025-01-01T12", "2025-01-03T00", "1,D", anchor_boundary=None) - # a = np.array(["2025-01-01T12", "2025-01-03T00"]).astype(np.datetime64) assert c.start == np.datetime64("2025-01-01T12") assert c.stop == np.datetime64("2025-01-03T00") assert c.is_monotonic == True diff --git a/podpac/core/coordinates/utils.py b/podpac/core/coordinates/utils.py index f4e68980..7eac02c5 100644 --- a/podpac/core/coordinates/utils.py +++ b/podpac/core/coordinates/utils.py @@ -179,12 +179,11 @@ def make_coord_value(val): else: raise e - elif isinstance(val, np.datetime64) | isinstance(val, np.timedelta64): - pass - elif isinstance(val, numbers.Number): - val = float(val) - else: - raise TypeError("Invalid coordinate value, unsupported type '%s'" % type(val)) + elif not (isinstance(val, np.datetime64) | isinstance(val, np.timedelta64)): + if isinstance(val, numbers.Number): + val = float(val) + else: + raise TypeError("Invalid coordinate value, unsupported type '%s'" % type(val)) return val @@ -229,12 +228,11 @@ def make_coord_delta(val): val = get_timedelta(val) elif isinstance(val, datetime.timedelta): val = np.timedelta64(val) - elif isinstance(val, np.timedelta64): - pass - elif isinstance(val, numbers.Number): - val = float(val) - else: - raise TypeError("Invalid coordinate delta, unsupported type '%s'" % type(val)) + elif not isinstance(val, np.timedelta64): + if isinstance(val, numbers.Number): + val = float(val) + else: + raise TypeError("Invalid coordinate delta, unsupported type '%s'" % type(val)) return val @@ -262,19 +260,17 @@ def make_coord_array(values): a = np.atleast_1d(values) - if a.dtype == float or np.issubdtype(a.dtype, np.datetime64) or np.issubdtype(a.dtype, np.timedelta64): - pass + if not (a.dtype == float or np.issubdtype(a.dtype, np.datetime64) or np.issubdtype(a.dtype, np.timedelta64)): + if np.issubdtype(a.dtype, np.number): + a = a.astype(float) - elif np.issubdtype(a.dtype, np.number): - a = a.astype(float) - - else: - a = np.array([make_coord_value(e) for e in np.atleast_1d(np.array(values, dtype=object)).flatten()]).reshape( - a.shape - ) + else: + a = np.array( + [make_coord_value(e) for e in np.atleast_1d(np.array(values, dtype=object)).flatten()] + ).reshape(a.shape) - if not (np.issubdtype(a.dtype, np.datetime64) or np.issubdtype(a.dtype, np.timedelta64)): - raise ValueError("Invalid coordinate values (must be all numbers, all datetimes, or all timedeltas)") + if not (np.issubdtype(a.dtype, np.datetime64) or np.issubdtype(a.dtype, np.timedelta64)): + raise ValueError("Invalid coordinate values (must be all numbers, all datetimes, or all timedeltas)") return a @@ -305,17 +301,15 @@ def make_coord_delta_array(values): if a.ndim != 1: raise ValueError("Invalid coordinate deltas (ndim=%d, must be ndim=1)" % a.ndim) - if a.dtype == float or np.issubdtype(a.dtype, np.timedelta64): - pass + if not (a.dtype == float or np.issubdtype(a.dtype, np.timedelta64)): + if np.issubdtype(a.dtype, np.number): + a = a.astype(float) - elif np.issubdtype(a.dtype, np.number): - a = a.astype(float) - - else: - a = np.array([make_coord_delta(e) for e in np.atleast_1d(np.array(values, dtype=object))]) + else: + a = np.array([make_coord_delta(e) for e in np.atleast_1d(np.array(values, dtype=object))]) - if not np.issubdtype(a.dtype, np.timedelta64): - raise ValueError("Invalid coordinate deltas (must be all numbers or all compatible timedeltas)") + if not np.issubdtype(a.dtype, np.timedelta64): + raise ValueError("Invalid coordinate deltas (must be all numbers or all compatible timedeltas)") return a diff --git a/podpac/core/data/datasource.py b/podpac/core/data/datasource.py index c554d7d5..01d35e61 100755 --- a/podpac/core/data/datasource.py +++ b/podpac/core/data/datasource.py @@ -448,12 +448,6 @@ def _eval(self, coordinates, output=None, _selector=None): rsd = self._get_data(rsc, rsci) if output is None: - # if requested_coordinates.crs.lower() != coordinates.crs.lower(): - # if rsc.shape == rsd.shape: - # rsd = self.create_output_array(rsc, data=rsd.data) - # else: - # crds = Coordinates.from_xarray(rsd, crs=data.attrs.get("crs", None)) - # rsd = self.create_output_array(crds.transform(rsc.crs), data=rsd.data) output = rsd else: output.data[:] = rsd.data @@ -596,10 +590,9 @@ def _get_boundary(self, index): boundary = {} for c, I in zip(self.coordinates.values(), index): for dim in c.dims: - if dim not in self.boundary: - pass - elif np.array(self.boundary[dim]).ndim == 2: - boundary[dim] = np.array(self.boundary[dim][I]) - else: - boundary[dim] = self.boundary[dim] + if dim in self.boundary: + if np.array(self.boundary[dim]).ndim == 2: + boundary[dim] = np.array(self.boundary[dim][I]) + else: + boundary[dim] = self.boundary[dim] return boundary diff --git a/podpac/core/data/file_source.py b/podpac/core/data/file_source.py index 8bc6da01..f4557792 100644 --- a/podpac/core/data/file_source.py +++ b/podpac/core/data/file_source.py @@ -104,14 +104,20 @@ def dataset(self): return self._open(self._file, cache=False) # otherwise, open the file (and cache it if desired) + # A note on these NOSONAR lines: SonarQube considers it a security hotspot when + # non-encrypted protocols are used. However, it's not a security risk to permit + # this package to draw data from sources via unencrypted links. Some external geospatial data + # sources are public by design, and they can choose deliver data via FTP or HTTP if they please. + # Users concerned about these data sources being somehow poisoned can just not configure podpac + # to use unencrypted sources. if self.source.startswith("s3://"): _logger.info("Loading AWS resource: %s" % self.source) self._file = self.s3.open(self.source, "rb") - elif self.source.startswith("http://") or self.source.startswith("https://"): + elif self.source.startswith("http://") or self.source.startswith("https://"): # NOSONAR(S5332) _logger.info("Downloading: %s" % self.source) response = requests.get(self.source) self._file = BytesIO(response.content) - elif self.source.startswith("ftp://"): + elif self.source.startswith("ftp://"): # NOSONAR(S5332) _logger.info("Downloading: %s" % self.source) addinfourl = urlopen(self.source) self._file = BytesIO(addinfourl.read()) diff --git a/podpac/core/data/ogc.py b/podpac/core/data/ogc.py index b81d2d29..4a99173b 100644 --- a/podpac/core/data/ogc.py +++ b/podpac/core/data/ogc.py @@ -35,7 +35,7 @@ class MockWCSClient(tl.HasTraits): auth = tl.Any() def getCoverage( - self, + self, # NOSONAR(S107) - This is to match a method signature from external library owslib.wcs identifier=None, bbox=None, time=None, @@ -80,7 +80,6 @@ def getCoverage( request = {"version": self.version, "request": "GetCoverage", "service": "WCS"} assert len(identifier) > 0 request["Coverage"] = identifier - # request['identifier'] = ','.join(identifier) if bbox: request["BBox"] = ",".join([makeString(x) for x in bbox]) else: diff --git a/podpac/core/data/rasterio_source.py b/podpac/core/data/rasterio_source.py index 52ceb571..bc01a140 100644 --- a/podpac/core/data/rasterio_source.py +++ b/podpac/core/data/rasterio_source.py @@ -131,10 +131,9 @@ def get_coordinates(self): validate_crs = True if self.crs is not None: crs = self.crs - elif isinstance(self.dataset.crs, rasterio.crs.CRS) and "init" in self.dataset.crs: - crs = self.dataset.crs["init"].upper() - validate_crs = False - elif isinstance(self.dataset.crs, dict) and "init" in self.dataset.crs: + elif ( + isinstance(self.dataset.crs, rasterio.crs.CRS) or isinstance(self.dataset.crs, dict) + ) and "init" in self.dataset.crs: crs = self.dataset.crs["init"].upper() validate_crs = False else: diff --git a/podpac/core/data/test/test_dataset.py b/podpac/core/data/test/test_dataset.py index 4035e2d0..0259ad5a 100644 --- a/podpac/core/data/test/test_dataset.py +++ b/podpac/core/data/test/test_dataset.py @@ -35,7 +35,6 @@ def test_coordinates(self): # specify dimension keys node = Dataset(source=self.source, time_key="day") nc = node.coordinates - # assert nc.dims == ("time", "lat", "lon") # Xarray is free to change this order -- we don't care np.testing.assert_array_equal(nc["lat"].coordinates, self.lat) np.testing.assert_array_equal(nc["lon"].coordinates, self.lon) np.testing.assert_array_equal(nc["time"].coordinates, self.time) diff --git a/podpac/core/data/test/test_datasource.py b/podpac/core/data/test/test_datasource.py index b6c4ca40..1955e84b 100644 --- a/podpac/core/data/test/test_datasource.py +++ b/podpac/core/data/test/test_datasource.py @@ -260,11 +260,11 @@ def test_evaluate_at_coordinates(self): assert output.lat.shape == (11,) assert output.lon.shape == (11,) - # assert coordinates + # check coordinates assert isinstance(output.coords, DataArrayCoordinates) assert output.coords.dims == ("lat", "lon") - # assert attributes + # check attributes assert isinstance(output.attrs["layer_style"], Style) def test_evaluate_at_coordinates_with_output(self): diff --git a/podpac/core/data/test/test_file_source.py b/podpac/core/data/test/test_file_source.py index 28de8be6..bbca60c2 100644 --- a/podpac/core/data/test/test_file_source.py +++ b/podpac/core/data/test/test_file_source.py @@ -72,12 +72,6 @@ def test_s3(self): node = MockLoadFile(source=path) _ = node.dataset - @pytest.mark.aws - @pytest.mark.skip("Unreachable source") - def test_ftp(self): - node = MockLoadFile(source="ftp://speedtest.tele2.net/1KB.zip") - _ = node.dataset - @pytest.mark.aws # TODO @pytest.mark.skip("Unreachable source") def test_http(self): diff --git a/podpac/core/data/test/test_reprojected_source.py b/podpac/core/data/test/test_reprojected_source.py index 46eb3919..71ea36a7 100644 --- a/podpac/core/data/test/test_reprojected_source.py +++ b/podpac/core/data/test/test_reprojected_source.py @@ -86,7 +86,7 @@ def test_source_interpolation(self): # no source.interpolation to set (trigger logger warning) source = Node() with pytest.warns(DeprecationWarning): - node = ReprojectedSource(source=source, reprojected_coordinates=self.reprojected_coordinates).interpolate( + ReprojectedSource(source=source, reprojected_coordinates=self.reprojected_coordinates).interpolate( source_interpolation="bilinear" ) diff --git a/podpac/core/interpolation/nearest_neighbor_interpolator.py b/podpac/core/interpolation/nearest_neighbor_interpolator.py index 8a6e6188..52ee5134 100755 --- a/podpac/core/interpolation/nearest_neighbor_interpolator.py +++ b/podpac/core/interpolation/nearest_neighbor_interpolator.py @@ -52,11 +52,6 @@ class NearestNeighbor(Interpolator): remove_nan = tl.Bool(False) use_selector = tl.Bool(True) - def __repr__(self): - rep = super(NearestNeighbor, self).__repr__() - # rep += '\n\tspatial_tolerance: {}\n\ttime_tolerance: {}'.format(self.spatial_tolerance, self.time_tolerance) - return rep - @common_doc(COMMON_INTERPOLATOR_DOCS) def can_interpolate(self, udims, source_coordinates, eval_coordinates): """ diff --git a/podpac/core/interpolation/selector.py b/podpac/core/interpolation/selector.py index f118ac56..148e56f9 100755 --- a/podpac/core/interpolation/selector.py +++ b/podpac/core/interpolation/selector.py @@ -204,7 +204,6 @@ def _select_stacked(self, source, request, index_type): # two udims could be stacked, but in different dim groups, e.g. source (lat, lon), request (lat, time), (lon, alt) stacked = {d for d in request.dims for ud in udims if ud in d and request.is_stacked(ud)} - inds = np.array([]) # Parts of the below code is duplicated in NearestNeighborInterpolotor src_coords, req_coords_diag = _higher_precision_time_stack(source, request, udims) # For nD stacked coordinates we need to unravel the stacked dimension diff --git a/podpac/core/interpolation/test/test_interpolation.py b/podpac/core/interpolation/test/test_interpolation.py index 47b66ddc..47324e64 100644 --- a/podpac/core/interpolation/test/test_interpolation.py +++ b/podpac/core/interpolation/test/test_interpolation.py @@ -159,7 +159,7 @@ def test_silent_nearest_neighbor_interp_bug_issue412( coordinates=podpac.Coordinates([[1, 5, 9]], dims=["lat"]), ).interpolate(interpolation=[{"method": "bilinear", "dims": ["lat"], "interpolators": [ScipyGrid]}]) with pytest.raises(InterpolationException, match="can't be handled"): - o = node.eval(podpac.Coordinates([podpac.crange(1, 9, 1)], dims=["lat"])) + node.eval(podpac.Coordinates([podpac.crange(1, 9, 1)], dims=["lat"])) node = podpac.data.Array( source=[0, 1, 2], diff --git a/podpac/core/interpolation/test/test_interpolation_manager.py b/podpac/core/interpolation/test/test_interpolation_manager.py index fd9da621..ebc60084 100644 --- a/podpac/core/interpolation/test/test_interpolation_manager.py +++ b/podpac/core/interpolation/test/test_interpolation_manager.py @@ -120,7 +120,7 @@ def test_dict_definition(self): # should not allow custom methods if interpolators can't support with pytest.raises(InterpolatorException): - interp = InterpolationManager( + InterpolationManager( [{"method": "myinter", "interpolators": [NearestNeighbor, NearestPreview], "dims": ["lat", "lon"]}] ) @@ -232,7 +232,7 @@ def can_interpolate(self, udims, source_coordinates, eval_coordinates): # should throw an error if strict is set and not all dimensions can be handled with pytest.raises(InterpolationException): interp_copy = deepcopy(interp) - interpolator_queue = interp_copy._select_interpolator_queue(srccoords, reqcoords, "can_select", strict=True) + interp_copy._select_interpolator_queue(srccoords, reqcoords, "can_select", strict=True) # default = Nearest, which can handle all dims for can_interpolate interpolator_queue = interp._select_interpolator_queue(srccoords, reqcoords, "can_interpolate") diff --git a/podpac/core/interpolation/test/test_selector.py b/podpac/core/interpolation/test/test_selector.py index 3fa4ecb0..9244a9a8 100644 --- a/podpac/core/interpolation/test/test_selector.py +++ b/podpac/core/interpolation/test/test_selector.py @@ -25,7 +25,6 @@ class TestSelector(object): nn_request_coarse_from_fine = [1, 3, 6] lin_request_fine_from_coarse = [0, 1, 2] lin_request_coarse_from_fine = [0, 1, 3, 4, 6, 7] - # nn_request_fine_from_random_fine = [1, 1, 4, 6, 5, 0, 7, 2] nn_request_fine_from_random_fine = [0, 1, 2, 4, 5, 6, 7] nn_request_coarse_from_random_fine = [1, 5, 7] nn_request_fine_from_random_coarse = [0, 1, 2] diff --git a/podpac/core/interpolation/xarray_interpolator.py b/podpac/core/interpolation/xarray_interpolator.py index 319bb7e6..11262201 100644 --- a/podpac/core/interpolation/xarray_interpolator.py +++ b/podpac/core/interpolation/xarray_interpolator.py @@ -55,11 +55,6 @@ class XarrayInterpolator(Interpolator): kwargs = tl.Dict({"bounds_error": False}) - def __repr__(self): - rep = super(XarrayInterpolator, self).__repr__() - # rep += '\n\tspatial_tolerance: {}\n\ttime_tolerance: {}'.format(self.spatial_tolerance, self.time_tolerance) - return rep - @common_doc(COMMON_INTERPOLATOR_DOCS) def can_interpolate(self, udims, source_coordinates, eval_coordinates): """ diff --git a/podpac/core/managers/aws.py b/podpac/core/managers/aws.py index 5ec2fb31..19f02069 100644 --- a/podpac/core/managers/aws.py +++ b/podpac/core/managers/aws.py @@ -1055,10 +1055,6 @@ def validate_bucket(self): _log.error("Failed to find PODPAC dependencies in bucket") return False - # TODO: make sure trigger exists - if "S3" in self.function_triggers: - pass - return True def delete_bucket(self, delete_objects=False): @@ -1461,7 +1457,6 @@ def _eval_invoke(self, coordinates, output=None): if "FunctionError" in response: _log.error("Unhandled error from lambda function") - # logs = base64.b64decode(response["LogResult"]).decode("UTF-8").split('\n') payload = json.loads(response["Payload"].read().decode("UTF-8")) raise LambdaException( "Error in lambda function evaluation:\n\nError Type: {}\nError Message: {}\nStack Trace: {}".format( diff --git a/podpac/core/managers/parallel.py b/podpac/core/managers/parallel.py index 89db68ca..9087d287 100644 --- a/podpac/core/managers/parallel.py +++ b/podpac/core/managers/parallel.py @@ -96,7 +96,6 @@ def eval(self, coordinates, **kwargs): # noqa: A003 shape.append(coordinates[d].size) results = [] - # inputs = [] i = 0 for coords, slc in coordinates.iterchunks(shape, True): # inputs.append(coords) diff --git a/podpac/core/node.py b/podpac/core/node.py index 76dbd2a7..213b6ed8 100644 --- a/podpac/core/node.py +++ b/podpac/core/node.py @@ -1211,17 +1211,6 @@ def get_ui_spec(cls, help_as_html=False): Will need to ask @MPU how to define a node specific style. """ - # spec["style"] = { - # "name": "?", - # "units": "m", - # "clim": [-1.0, 1.0], - # "colormap": "jet", - # "enumeration_legend": "?", - # "enumeration_colors": "?", - # "default_enumeration_legend": "unknown", - # "default_enumeration_color": (0.2, 0.2, 0.2), - # } - spec.update(getattr(cls, "_ui_spec", {})) return spec diff --git a/podpac/core/test/test_authentication.py b/podpac/core/test/test_authentication.py index bc6eb7c8..884d96c3 100644 --- a/podpac/core/test/test_authentication.py +++ b/podpac/core/test/test_authentication.py @@ -113,7 +113,7 @@ def test_session(self): def test_auth_required(self): with settings: with pytest.raises(tl.TraitError): - node = SomeNode(hostname="auth.com", auth_required="true") + SomeNode(hostname="auth.com", auth_required="true") # no auth node = SomeNode(hostname="auth.com") diff --git a/podpac/core/test/test_node.py b/podpac/core/test/test_node.py index db6e353e..201c2f6e 100644 --- a/podpac/core/test/test_node.py +++ b/podpac/core/test/test_node.py @@ -941,8 +941,6 @@ def test_from_url(self): [ "algorithm.SinCoords", "%PARAMS%", - # urllib.urlencode({'a':'https://raw.githubusercontent.com/creare-com/podpac/develop/podpac/core/pipeline/test/test.json'})[2:], - # urllib.urlencode({'a':'s3://podpac-s3/test/test.json'})[2:] # Tested locally, works fine. Hard to test with CI ], params, ): diff --git a/podpac/core/test/test_style.py b/podpac/core/test/test_style.py index 53b3eb6f..303a48cc 100644 --- a/podpac/core/test/test_style.py +++ b/podpac/core/test/test_style.py @@ -28,7 +28,7 @@ def test_cmap(self): assert style.cmap.colors == ("c", "k") with pytest.raises(TypeError, match="Style can have a colormap or enumeration_colors"): - style = Style(colormap="cividis", enumeration_colors=({0: "c", 1: "k"})) + Style(colormap="cividis", enumeration_colors=({0: "c", 1: "k"})) def test_enumeration(self): # matplotlib enumeration tuples @@ -51,10 +51,10 @@ def test_enumeration(self): # invalid with pytest.raises(ValueError, match="Style enumeration_legend keys must match enumeration_colors keys"): - style = Style(enumeration_colors={1: "r", 3: "o"}, enumeration_legend={1: "apples"}) + Style(enumeration_colors={1: "r", 3: "o"}, enumeration_legend={1: "apples"}) with pytest.raises(TypeError, match="Style enumeration_legend requires enumeration_colors"): - style = Style(enumeration_legend={-1: "apples", 3: "oranges"}) + Style(enumeration_legend={-1: "apples", 3: "oranges"}) def test_serialization(self): # default diff --git a/podpac/core/test/test_units.py b/podpac/core/test/test_units.py index 594490e0..1901d070 100644 --- a/podpac/core/test/test_units.py +++ b/podpac/core/test/test_units.py @@ -436,11 +436,11 @@ def test_outputs(self): data = np.random.random(self.coords.shape + (2,)) with pytest.raises(ValueError, match="data with shape .* does not match"): - a = UnitsDataArray.create(self.coords, data=data, outputs=["a", "b", "c"]) + UnitsDataArray.create(self.coords, data=data, outputs=["a", "b", "c"]) data = np.random.random(self.coords.shape) with pytest.raises(ValueError, match="data with shape .* does not match"): - a = UnitsDataArray.create(self.coords, data=data, outputs=["a", "b", "c"]) + UnitsDataArray.create(self.coords, data=data, outputs=["a", "b", "c"]) def test_invalid_coords(self): with pytest.raises(TypeError): diff --git a/podpac/core/test/test_utils.py b/podpac/core/test/test_utils.py index e930980f..4caa1f85 100755 --- a/podpac/core/test/test_utils.py +++ b/podpac/core/test/test_utils.py @@ -144,7 +144,7 @@ class MyClass(tl.HasTraits): def test_args(self): # shape and ndim must match - t = ArrayTrait(ndim=2, shape=(2, 2)) + ArrayTrait(ndim=2, shape=(2, 2)) with pytest.raises(ValueError): ArrayTrait(ndim=1, shape=(2, 2)) diff --git a/podpac/core/utils.py b/podpac/core/utils.py index d09efe86..48dd523b 100755 --- a/podpac/core/utils.py +++ b/podpac/core/utils.py @@ -202,12 +202,6 @@ class DimsTrait(tl.List): def __init__(self, *args, **kwargs): super().__init__(tl.Enum(VALID_DIMENSION_NAMES), *args, minlen=1, maxlen=4, **kwargs) - # def validate(self, obj, value): - # super().validate(obj, value) - # if podpac.core.settings.settings["DEBUG"]: - # value = deepcopy(value) - # return value - class JSONEncoder(json.JSONEncoder): def default(self, obj): @@ -666,11 +660,6 @@ def get_ui_node_spec(module=None, category="default", help_as_html=False): disabled_categories = ["Algorithm", "DataSource", "DroughtMonitorCategory", "DroughtCategory", "IntakeCatalog"] for obj in dir(module): if obj in disabled_categories: - ob = getattr(module, obj) - # print(ob) - # print(ob.get_ui_spec()) - # would be fairly annoying to have to check all of the attrs for abstract - # still need a better solution continue ob = getattr(module, obj) if not inspect.isclass(ob): diff --git a/setup.py b/setup.py index dc713751..652197b2 100644 --- a/setup.py +++ b/setup.py @@ -107,7 +107,6 @@ def run(self): setup( - # ext_modules=None, name="podpac", version=__version__, description="Pipeline for Observational Data Processing, Analysis, and Collaboration", @@ -136,7 +135,4 @@ def run(self): cmdclass={"develop": PostDevelopCommand}, long_description=long_description, long_description_content_type="text/markdown", - # entry_points = { - # 'console_scripts' : [] - # } )