From ed612fc95c41afd0fdda4a028c85f01fa93a0842 Mon Sep 17 00:00:00 2001 From: Clay Foye Date: Wed, 25 Jan 2023 07:25:33 -0500 Subject: [PATCH 1/6] MAINT: Propose API Scheme --- doc/source/api-scheme.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 doc/source/api-scheme.md diff --git a/doc/source/api-scheme.md b/doc/source/api-scheme.md new file mode 100644 index 00000000..53144fe0 --- /dev/null +++ b/doc/source/api-scheme.md @@ -0,0 +1,29 @@ +# API Scheme +A naming scheme for our API. The goal is to make the grammar of the entire API consistent. + +## Rules + +### Node Rules +All node names must be: +1. Nouns +2. Singular + +### Coordinates Rules +All Coordinates names must be: +1. Nouns + +### Core Directory Rules +Where a "Core Directory" is located inside podpac/core/* +All directory names must be: +1. Nouns +2. Pluarl + +### Package Rules: + +Where a "Package" is loaded by podpac.* + +All package names must be: +1. Nouns +2. Pluarl +*AND* +3. All packages must match their corresponding `podpac.core.*` directory name. \ No newline at end of file From 379fe9a77047ee561d9794da3ce7b8b9b05056f7 Mon Sep 17 00:00:00 2001 From: Clay Foye Date: Wed, 25 Jan 2023 07:29:27 -0500 Subject: [PATCH 2/6] FIX: Typos --- doc/source/api-scheme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/api-scheme.md b/doc/source/api-scheme.md index 53144fe0..c77c658a 100644 --- a/doc/source/api-scheme.md +++ b/doc/source/api-scheme.md @@ -16,7 +16,7 @@ All Coordinates names must be: Where a "Core Directory" is located inside podpac/core/* All directory names must be: 1. Nouns -2. Pluarl +2. Plural ### Package Rules: @@ -24,6 +24,6 @@ Where a "Package" is loaded by podpac.* All package names must be: 1. Nouns -2. Pluarl +2. Plural *AND* 3. All packages must match their corresponding `podpac.core.*` directory name. \ No newline at end of file From aaa3a259cd6493280a87c2b09c198b0234b9bae8 Mon Sep 17 00:00:00 2001 From: Clay Foye Date: Wed, 25 Jan 2023 07:46:52 -0500 Subject: [PATCH 3/6] MAINT: Refactor `algorithm` to `algorithms` --- doc/source/api-scheme.md | 6 +++ doc/source/api.rst | 44 +++++++++---------- doc/source/overview.md | 4 +- podpac/__init__.py | 2 +- podpac/alglib/climatology.py | 2 +- podpac/algorithm.py | 33 -------------- podpac/algorithms.py | 33 ++++++++++++++ .../{algorithm => algorithms}/__init__.py | 0 .../{algorithm => algorithms}/algorithm.py | 0 .../{algorithm => algorithms}/coord_select.py | 2 +- .../core/{algorithm => algorithms}/generic.py | 2 +- .../{algorithm => algorithms}/reprojection.py | 0 .../core/{algorithm => algorithms}/signal.py | 2 +- .../core/{algorithm => algorithms}/stats.py | 2 +- .../test/test_algorithm.py | 2 +- .../test/test_coord_select.py | 4 +- .../test/test_generic.py | 6 +-- .../test/test_reprojection.py | 2 +- .../test/test_signal.py | 4 +- .../test/test_stats.py | 12 ++--- .../test/test_utility.py | 2 +- .../core/{algorithm => algorithms}/utility.py | 2 +- podpac/core/cache/test/test_cache_ctrl.py | 2 +- podpac/core/cache/test/test_cache_stores.py | 2 +- .../compositor/test/test_base_compositor.py | 12 ++--- .../compositor/test/test_tiled_compositor.py | 2 +- .../core/data/test/test_reprojected_source.py | 2 +- .../core/managers/test/test_multiprocess.py | 2 +- podpac/core/managers/test/test_parallel.py | 2 +- podpac/core/node.py | 4 +- podpac/core/test/test_node.py | 34 +++++++------- podpac/core/test/test_utils.py | 10 ++--- podpac/core/utils.py | 2 +- podpac/datalib/drought_monitor.py | 2 +- 34 files changed, 124 insertions(+), 118 deletions(-) delete mode 100644 podpac/algorithm.py create mode 100644 podpac/algorithms.py rename podpac/core/{algorithm => algorithms}/__init__.py (100%) rename podpac/core/{algorithm => algorithms}/algorithm.py (100%) rename podpac/core/{algorithm => algorithms}/coord_select.py (99%) rename podpac/core/{algorithm => algorithms}/generic.py (99%) rename podpac/core/{algorithm => algorithms}/reprojection.py (100%) rename podpac/core/{algorithm => algorithms}/signal.py (99%) rename podpac/core/{algorithm => algorithms}/stats.py (99%) rename podpac/core/{algorithm => algorithms}/test/test_algorithm.py (99%) rename podpac/core/{algorithm => algorithms}/test/test_coord_select.py (97%) rename podpac/core/{algorithm => algorithms}/test/test_generic.py (97%) rename podpac/core/{algorithm => algorithms}/test/test_reprojection.py (98%) rename podpac/core/{algorithm => algorithms}/test/test_signal.py (99%) rename podpac/core/{algorithm => algorithms}/test/test_stats.py (96%) rename podpac/core/{algorithm => algorithms}/test/test_utility.py (94%) rename podpac/core/{algorithm => algorithms}/utility.py (98%) diff --git a/doc/source/api-scheme.md b/doc/source/api-scheme.md index c77c658a..99710f30 100644 --- a/doc/source/api-scheme.md +++ b/doc/source/api-scheme.md @@ -8,6 +8,11 @@ All node names must be: 1. Nouns 2. Singular +### Implementation File Riles +All implementation file names must be: +1. Nouns +2. Singular + ### Coordinates Rules All Coordinates names must be: 1. Nouns @@ -18,6 +23,7 @@ All directory names must be: 1. Nouns 2. Plural + ### Package Rules: Where a "Package" is loaded by podpac.* diff --git a/doc/source/api.rst b/doc/source/api.rst index 4bdcc7c1..acad0da7 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -119,7 +119,7 @@ Split/Apply/Combine nodes with algorithms :toctree: api/ :template: class.rst - podpac.algorithm.Algorithm + podpac.algorithms.Algorithm .. rubric:: General Purpose @@ -127,10 +127,10 @@ Split/Apply/Combine nodes with algorithms :toctree: api/ :template: class.rst - podpac.algorithm.Arithmetic - podpac.algorithm.SinCoords - podpac.algorithm.Arange - podpac.algorithm.CoordData + podpac.algorithms.Arithmetic + podpac.algorithms.SinCoords + podpac.algorithms.Arange + podpac.algorithms.CoordData .. rubric:: Statistical Methods @@ -138,18 +138,18 @@ Split/Apply/Combine nodes with algorithms :toctree: api/ :template: class.rst - podpac.algorithm.Min - podpac.algorithm.Max - podpac.algorithm.Sum - podpac.algorithm.Count - podpac.algorithm.Mean - podpac.algorithm.Median - podpac.algorithm.Variance - podpac.algorithm.StandardDeviation - podpac.algorithm.Skew - podpac.algorithm.Kurtosis - podpac.algorithm.DayOfYear - podpac.algorithm.GroupReduce + podpac.algorithms.Min + podpac.algorithms.Max + podpac.algorithms.Sum + podpac.algorithms.Count + podpac.algorithms.Mean + podpac.algorithms.Median + podpac.algorithms.Variance + podpac.algorithms.StandardDeviation + podpac.algorithms.Skew + podpac.algorithms.Kurtosis + podpac.algorithms.DayOfYear + podpac.algorithms.GroupReduce .. rubric:: Coordinates Modification @@ -157,8 +157,8 @@ Split/Apply/Combine nodes with algorithms :toctree: api/ :template: class.rst - podpac.algorithm.ExpandCoordinates - podpac.algorithm.SelectCoordinates + podpac.algorithms.ExpandCoordinates + podpac.algorithms.SelectCoordinates .. rubric:: Signal Processing @@ -166,9 +166,9 @@ Split/Apply/Combine nodes with algorithms :toctree: api/ :template: class.rst - podpac.algorithm.Convolution - podpac.algorithm.SpatialConvolution - podpac.algorithm.TimeConvolution + podpac.algorithms.Convolution + podpac.algorithms.SpatialConvolution + podpac.algorithms.TimeConvolution Compositor Nodes ---------------- diff --git a/doc/source/overview.md b/doc/source/overview.md index 3dc919b5..19af08aa 100644 --- a/doc/source/overview.md +++ b/doc/source/overview.md @@ -98,7 +98,7 @@ nodeA = podpac.data.Rasterio(source="elevation.tif", interpolation="cubic") nodeB = podpac.datalib.TerrainTiles(tile_format='geotiff', zoom=8) # average the two data sources together point-wise -alg_node = podpac.algorithm.Arithmetic(A=nodeA, B=nodeB, eqn='(A + B) / 2') +alg_node = podpac.algorithms.Arithmetic(A=nodeA, B=nodeB, eqn='(A + B) / 2') ``` Evaluate pipelines at arbitrary PODPAC coordinates. @@ -142,7 +142,7 @@ settings["AWS_ACCESS_KEY_ID"] = "access key id" settings["AWS_SECRET_ACCESS_KEY"] = "secrect access key" # create example data source node and AWS node -node = podpac.algorithm.SinCoords() +node = podpac.algorithms.SinCoords() aws_node = podpac.managers.aws.Lambda(source=node) # build AWS cloud resources to run analysis diff --git a/podpac/__init__.py b/podpac/__init__.py index 6943ce2b..56d4a5f8 100644 --- a/podpac/__init__.py +++ b/podpac/__init__.py @@ -47,7 +47,7 @@ def makedirs(name, mode=511, exist_ok=False): # Organized submodules # These files are simply wrappers to create a curated namespace of podpac modules -from podpac import algorithm +from podpac import algorithms from podpac import authentication from podpac import data from podpac import interpolators diff --git a/podpac/alglib/climatology.py b/podpac/alglib/climatology.py index d93bf5ad..666a81a4 100644 --- a/podpac/alglib/climatology.py +++ b/podpac/alglib/climatology.py @@ -15,7 +15,7 @@ # Internal dependencies import podpac -from podpac.core.algorithm.stats import DayOfYearWindow +from podpac.core.algorithms.stats import DayOfYearWindow # Set up logging _log = logging.getLogger(__name__) diff --git a/podpac/algorithm.py b/podpac/algorithm.py deleted file mode 100644 index 69cebe45..00000000 --- a/podpac/algorithm.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Algorithm Public Module -""" - -# REMINDER: update api docs (doc/source/user/api.rst) to reflect changes to this file - -from podpac.core.algorithm.algorithm import Algorithm, UnaryAlgorithm -from podpac.core.algorithm.generic import Arithmetic, Generic, Mask -from podpac.core.algorithm.utility import SinCoords, Arange, CoordData -from podpac.core.algorithm.stats import ( - Min, - Max, - Sum, - Count, - Mean, - Median, - Variance, - StandardDeviation, - Skew, - Percentile, - Kurtosis, - DayOfYear, - GroupReduce, - ResampleReduce, -) -from podpac.core.algorithm.coord_select import ( - ExpandCoordinates, - SelectCoordinates, - YearSubstituteCoordinates, - TransformTimeUnits, -) -from podpac.core.algorithm.signal import Convolution -from podpac.core.algorithm.reprojection import Reproject diff --git a/podpac/algorithms.py b/podpac/algorithms.py new file mode 100644 index 00000000..716918d5 --- /dev/null +++ b/podpac/algorithms.py @@ -0,0 +1,33 @@ +""" +Algorithm Public Module +""" + +# REMINDER: update api docs (doc/source/user/api.rst) to reflect changes to this file + +from podpac.core.algorithms.algorithm import Algorithm, UnaryAlgorithm +from podpac.core.algorithms.generic import Arithmetic, Generic, Mask +from podpac.core.algorithms.utility import SinCoords, Arange, CoordData +from podpac.core.algorithms.stats import ( + Min, + Max, + Sum, + Count, + Mean, + Median, + Variance, + StandardDeviation, + Skew, + Percentile, + Kurtosis, + DayOfYear, + GroupReduce, + ResampleReduce, +) +from podpac.core.algorithms.coord_select import ( + ExpandCoordinates, + SelectCoordinates, + YearSubstituteCoordinates, + TransformTimeUnits, +) +from podpac.core.algorithms.signal import Convolution +from podpac.core.algorithms.reprojection import Reproject diff --git a/podpac/core/algorithm/__init__.py b/podpac/core/algorithms/__init__.py similarity index 100% rename from podpac/core/algorithm/__init__.py rename to podpac/core/algorithms/__init__.py diff --git a/podpac/core/algorithm/algorithm.py b/podpac/core/algorithms/algorithm.py similarity index 100% rename from podpac/core/algorithm/algorithm.py rename to podpac/core/algorithms/algorithm.py diff --git a/podpac/core/algorithm/coord_select.py b/podpac/core/algorithms/coord_select.py similarity index 99% rename from podpac/core/algorithm/coord_select.py rename to podpac/core/algorithms/coord_select.py index 63e10aed..ed3f1e52 100644 --- a/podpac/core/algorithm/coord_select.py +++ b/podpac/core/algorithms/coord_select.py @@ -12,7 +12,7 @@ from podpac.core.coordinates import UniformCoordinates1d, ArrayCoordinates1d from podpac.core.coordinates import make_coord_value, make_coord_delta, add_coord from podpac.core.node import Node, COMMON_NODE_DOC -from podpac.core.algorithm.algorithm import UnaryAlgorithm +from podpac.core.algorithms.algorithm import UnaryAlgorithm from podpac.core.utils import common_doc, NodeTrait COMMON_DOC = COMMON_NODE_DOC.copy() diff --git a/podpac/core/algorithm/generic.py b/podpac/core/algorithms/generic.py similarity index 99% rename from podpac/core/algorithm/generic.py rename to podpac/core/algorithms/generic.py index 7fde8b71..3fa4e2af 100644 --- a/podpac/core/algorithm/generic.py +++ b/podpac/core/algorithms/generic.py @@ -20,7 +20,7 @@ from podpac import Coordinates from podpac.core.node import Node, NodeException from podpac.core.utils import NodeTrait -from podpac.core.algorithm.algorithm import Algorithm +from podpac.core.algorithms.algorithm import Algorithm if sys.version_info.major == 2: diff --git a/podpac/core/algorithm/reprojection.py b/podpac/core/algorithms/reprojection.py similarity index 100% rename from podpac/core/algorithm/reprojection.py rename to podpac/core/algorithms/reprojection.py diff --git a/podpac/core/algorithm/signal.py b/podpac/core/algorithms/signal.py similarity index 99% rename from podpac/core/algorithm/signal.py rename to podpac/core/algorithms/signal.py index 7029aa7f..7acac1ff 100644 --- a/podpac/core/algorithm/signal.py +++ b/podpac/core/algorithms/signal.py @@ -14,7 +14,7 @@ from podpac.core.coordinates import Coordinates, UniformCoordinates1d, ArrayCoordinates1d from podpac.core.coordinates import add_coord from podpac.core.node import Node -from podpac.core.algorithm.algorithm import UnaryAlgorithm +from podpac.core.algorithms.algorithm import UnaryAlgorithm from podpac.core.utils import common_doc, ArrayTrait, NodeTrait from podpac.core.node import COMMON_NODE_DOC diff --git a/podpac/core/algorithm/stats.py b/podpac/core/algorithms/stats.py similarity index 99% rename from podpac/core/algorithm/stats.py rename to podpac/core/algorithms/stats.py index 01931666..228f8bf7 100644 --- a/podpac/core/algorithm/stats.py +++ b/podpac/core/algorithms/stats.py @@ -19,7 +19,7 @@ import podpac from podpac.core.coordinates import Coordinates from podpac.core.node import Node -from podpac.core.algorithm.algorithm import UnaryAlgorithm, Algorithm +from podpac.core.algorithms.algorithm import UnaryAlgorithm, Algorithm from podpac.core.utils import common_doc, NodeTrait from podpac.core.node import COMMON_NODE_DOC diff --git a/podpac/core/algorithm/test/test_algorithm.py b/podpac/core/algorithms/test/test_algorithm.py similarity index 99% rename from podpac/core/algorithm/test/test_algorithm.py rename to podpac/core/algorithms/test/test_algorithm.py index d9144bb6..523e636f 100644 --- a/podpac/core/algorithm/test/test_algorithm.py +++ b/podpac/core/algorithms/test/test_algorithm.py @@ -6,7 +6,7 @@ import xarray as xr import podpac -from podpac.core.algorithm.algorithm import BaseAlgorithm, Algorithm, UnaryAlgorithm +from podpac.core.algorithms.algorithm import BaseAlgorithm, Algorithm, UnaryAlgorithm class TestBaseAlgorithm(object): diff --git a/podpac/core/algorithm/test/test_coord_select.py b/podpac/core/algorithms/test/test_coord_select.py similarity index 97% rename from podpac/core/algorithm/test/test_coord_select.py rename to podpac/core/algorithms/test/test_coord_select.py index b9dc48fa..d10b811e 100644 --- a/podpac/core/algorithm/test/test_coord_select.py +++ b/podpac/core/algorithms/test/test_coord_select.py @@ -7,8 +7,8 @@ import podpac from podpac.core.data.datasource import DataSource from podpac.core.data.array_source import Array -from podpac.core.algorithm.utility import Arange -from podpac.core.algorithm.coord_select import ExpandCoordinates, SelectCoordinates, YearSubstituteCoordinates +from podpac.core.algorithms.utility import Arange +from podpac.core.algorithms.coord_select import ExpandCoordinates, SelectCoordinates, YearSubstituteCoordinates def setup_module(module): diff --git a/podpac/core/algorithm/test/test_generic.py b/podpac/core/algorithms/test/test_generic.py similarity index 97% rename from podpac/core/algorithm/test/test_generic.py rename to podpac/core/algorithms/test/test_generic.py index e1ef7230..5e65d59d 100644 --- a/podpac/core/algorithm/test/test_generic.py +++ b/podpac/core/algorithms/test/test_generic.py @@ -8,11 +8,11 @@ import xarray as xr import podpac -from podpac.core.algorithm.utility import Arange, SinCoords -from podpac.core.algorithm.generic import GenericInputs, Arithmetic, Generic, Mask, Combine +from podpac.core.algorithms.utility import Arange, SinCoords +from podpac.core.algorithms.generic import GenericInputs, Arithmetic, Generic, Mask, Combine if sys.version_info.major == 2: - from podpac.core.algorithm.generic import PermissionError + from podpac.core.algorithms.generic import PermissionError class TestGenericInputs(object): diff --git a/podpac/core/algorithm/test/test_reprojection.py b/podpac/core/algorithms/test/test_reprojection.py similarity index 98% rename from podpac/core/algorithm/test/test_reprojection.py rename to podpac/core/algorithms/test/test_reprojection.py index d40c7a0c..f000b789 100644 --- a/podpac/core/algorithm/test/test_reprojection.py +++ b/podpac/core/algorithms/test/test_reprojection.py @@ -9,7 +9,7 @@ import podpac from podpac import Coordinates, clinspace from podpac.data import Array -from podpac.core.algorithm.reprojection import Reproject +from podpac.core.algorithms.reprojection import Reproject class TestReprojection(object): diff --git a/podpac/core/algorithm/test/test_signal.py b/podpac/core/algorithms/test/test_signal.py similarity index 99% rename from podpac/core/algorithm/test/test_signal.py rename to podpac/core/algorithms/test/test_signal.py index 55e84a4e..7a4c96af 100644 --- a/podpac/core/algorithm/test/test_signal.py +++ b/podpac/core/algorithms/test/test_signal.py @@ -8,9 +8,9 @@ import podpac from podpac import Coordinates, clinspace, crange -from podpac.algorithm import Arange +from podpac.algorithms import Arange from podpac.data import Array -from podpac.core.algorithm.signal import Convolution +from podpac.core.algorithms.signal import Convolution class TestConvolution(object): diff --git a/podpac/core/algorithm/test/test_stats.py b/podpac/core/algorithms/test/test_stats.py similarity index 96% rename from podpac/core/algorithm/test/test_stats.py rename to podpac/core/algorithms/test/test_stats.py index bf5a195c..d86eade1 100644 --- a/podpac/core/algorithm/test/test_stats.py +++ b/podpac/core/algorithms/test/test_stats.py @@ -7,13 +7,13 @@ import traitlets as tl import podpac -from podpac.core.algorithm.utility import Arange +from podpac.core.algorithms.utility import Arange from podpac.core.data.array_source import Array -from podpac.core.algorithm.stats import Reduce -from podpac.core.algorithm.stats import Min, Max, Sum, Count, Mean, Variance, Skew, Kurtosis, StandardDeviation -from podpac.core.algorithm.generic import Arithmetic -from podpac.core.algorithm.stats import Median, Percentile -from podpac.core.algorithm.stats import GroupReduce, DayOfYear, DayOfYearWindow +from podpac.core.algorithms.stats import Reduce +from podpac.core.algorithms.stats import Min, Max, Sum, Count, Mean, Variance, Skew, Kurtosis, StandardDeviation +from podpac.core.algorithms.generic import Arithmetic +from podpac.core.algorithms.stats import Median, Percentile +from podpac.core.algorithms.stats import GroupReduce, DayOfYear, DayOfYearWindow def setup_module(): diff --git a/podpac/core/algorithm/test/test_utility.py b/podpac/core/algorithms/test/test_utility.py similarity index 94% rename from podpac/core/algorithm/test/test_utility.py rename to podpac/core/algorithms/test/test_utility.py index 0cea76d6..aa616a9f 100644 --- a/podpac/core/algorithm/test/test_utility.py +++ b/podpac/core/algorithms/test/test_utility.py @@ -4,7 +4,7 @@ import numpy as np import podpac -from podpac.core.algorithm.utility import Arange, CoordData, SinCoords +from podpac.core.algorithms.utility import Arange, CoordData, SinCoords class TestArange(object): diff --git a/podpac/core/algorithm/utility.py b/podpac/core/algorithms/utility.py similarity index 98% rename from podpac/core/algorithm/utility.py rename to podpac/core/algorithms/utility.py index 484c84da..5e1140b5 100644 --- a/podpac/core/algorithm/utility.py +++ b/podpac/core/algorithms/utility.py @@ -10,7 +10,7 @@ # Internal dependencies from podpac.core.coordinates import Coordinates -from podpac.core.algorithm.algorithm import Algorithm +from podpac.core.algorithms.algorithm import Algorithm from podpac.core.style import Style diff --git a/podpac/core/cache/test/test_cache_ctrl.py b/podpac/core/cache/test/test_cache_ctrl.py index bbc74d05..18386a4b 100644 --- a/podpac/core/cache/test/test_cache_ctrl.py +++ b/podpac/core/cache/test/test_cache_ctrl.py @@ -353,7 +353,7 @@ def test_clear_cache(): podpac.settings["DEFAULT_CACHE"] = ["ram"] # fill the default cache - node = podpac.algorithm.Arange() + node = podpac.algorithms.Arange() node.put_cache(0, "mykey") assert node.has_cache("mykey") diff --git a/podpac/core/cache/test/test_cache_stores.py b/podpac/core/cache/test/test_cache_stores.py index a752306a..3ff0c589 100644 --- a/podpac/core/cache/test/test_cache_stores.py +++ b/podpac/core/cache/test/test_cache_stores.py @@ -18,7 +18,7 @@ COORDS1 = podpac.Coordinates([[0, 1, 2], [10, 20, 30, 40], ["2018-01-01", "2018-01-02"]], dims=["lat", "lon", "time"]) COORDS2 = podpac.Coordinates([[0, 1, 2], [10, 20, 30]], dims=["lat", "lon"]) NODE1 = podpac.data.Array(source=np.ones(COORDS1.shape), coordinates=COORDS1) -NODE2 = podpac.algorithm.Arange() +NODE2 = podpac.algorithms.Arange() class BaseCacheStoreTests(object): diff --git a/podpac/core/compositor/test/test_base_compositor.py b/podpac/core/compositor/test/test_base_compositor.py index baf7d0db..47081a12 100644 --- a/podpac/core/compositor/test/test_base_compositor.py +++ b/podpac/core/compositor/test/test_base_compositor.py @@ -47,38 +47,38 @@ def test_source_coordinates(self): # unstacked node = BaseCompositor( - sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], + sources=[podpac.algorithms.Arange(), podpac.algorithms.SinCoords()], source_coordinates=podpac.Coordinates([[0, 1]], dims=["time"]), ) # stacked node = BaseCompositor( - sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], + sources=[podpac.algorithms.Arange(), podpac.algorithms.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( - sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], + sources=[podpac.algorithms.Arange(), podpac.algorithms.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( - sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], + sources=[podpac.algorithms.Arange(), podpac.algorithms.SinCoords()], source_coordinates=podpac.Coordinates([[0, 1, 2]], dims=["time"]), ) # invalid ndims with pytest.raises(ValueError, match="Invalid source_coordinates"): node = BaseCompositor( - sources=[podpac.algorithm.Arange(), podpac.algorithm.SinCoords()], + sources=[podpac.algorithms.Arange(), podpac.algorithms.SinCoords()], source_coordinates=podpac.Coordinates([[0, 1], [10, 20]], dims=["time", "alt"]), ) def test_select_sources_default(self): - node = BaseCompositor(sources=[DataSource(), DataSource(), podpac.algorithm.Arange()]) + node = BaseCompositor(sources=[DataSource(), DataSource(), podpac.algorithms.Arange()]) sources = node.select_sources(podpac.Coordinates([[0, 10]], ["time"])) assert isinstance(sources, list) diff --git a/podpac/core/compositor/test/test_tiled_compositor.py b/podpac/core/compositor/test/test_tiled_compositor.py index df91f764..ed699d66 100644 --- a/podpac/core/compositor/test/test_tiled_compositor.py +++ b/podpac/core/compositor/test/test_tiled_compositor.py @@ -67,7 +67,7 @@ def test_get_source_data(self): # error with podpac.settings: podpac.settings.set_unsafe_eval(True) - d = podpac.algorithm.Arithmetic(eqn="a+2", a=a) + d = podpac.algorithms.Arithmetic(eqn="a+2", a=a) node = TileCompositorRaw(sources=[a, b, c, d]) with pytest.raises(ValueError, match="Cannot get composited source data"): node.get_source_data() diff --git a/podpac/core/data/test/test_reprojected_source.py b/podpac/core/data/test/test_reprojected_source.py index 9b45a1ff..bcdde648 100644 --- a/podpac/core/data/test/test_reprojected_source.py +++ b/podpac/core/data/test/test_reprojected_source.py @@ -6,7 +6,7 @@ from podpac.core.coordinates import Coordinates, clinspace from podpac.core.units import UnitsDataArray from podpac.core.node import Node -from podpac.core.algorithm.utility import Arange +from podpac.core.algorithms.utility import Arange from podpac.core.data.datasource import DataSource from podpac.core.data.array_source import Array from podpac.core.data.reprojection import ReprojectedSource diff --git a/podpac/core/managers/test/test_multiprocess.py b/podpac/core/managers/test/test_multiprocess.py index e37e32d3..72546525 100644 --- a/podpac/core/managers/test/test_multiprocess.py +++ b/podpac/core/managers/test/test_multiprocess.py @@ -4,7 +4,7 @@ from multiprocessing import Queue from podpac.core.coordinates import Coordinates -from podpac.core.algorithm.utility import Arange +from podpac.core.algorithms.utility import Arange from podpac.core.managers.multi_process import Process, _f diff --git a/podpac/core/managers/test/test_parallel.py b/podpac/core/managers/test/test_parallel.py index 6469bb55..c7cfcf2c 100644 --- a/podpac/core/managers/test/test_parallel.py +++ b/podpac/core/managers/test/test_parallel.py @@ -11,7 +11,7 @@ from podpac import settings from podpac.core.coordinates import Coordinates -from podpac.core.algorithm.utility import CoordData +from podpac.core.algorithms.utility import CoordData from podpac.core.managers.parallel import Parallel, ParallelOutputZarr, ParallelAsync, ParallelAsyncOutputZarr from podpac.core.managers.multi_process import Process diff --git a/podpac/core/node.py b/podpac/core/node.py index 8858944b..84ac8afb 100644 --- a/podpac/core/node.py +++ b/podpac/core/node.py @@ -1143,9 +1143,9 @@ def get_ui_spec(cls, help_as_html=False): dig into this and create node specific styling. This will have to be done under each node. But may be difficult to add style to each node? - Example: podpac.core.algorithm.utility.SinCoords.Style ----> returns a tl.Instance + Example: podpac.core.algorithmsutility.SinCoords.Style ----> returns a tl.Instance BUT if I do: - podpac.core.algorithm.utility.SinCoords().style.json ---> outputs style + podpac.core.algorithmsutility.SinCoords().style.json ---> outputs style ERROR if no parenthesis are given. So how can this be done without instantiating the class? diff --git a/podpac/core/test/test_node.py b/podpac/core/test/test_node.py index 055c5972..a03413bf 100644 --- a/podpac/core/test/test_node.py +++ b/podpac/core/test/test_node.py @@ -657,13 +657,13 @@ def b(self): class TestSerialization(object): @classmethod def setup_class(cls): - a = podpac.algorithm.Arange() + a = podpac.algorithms.Arange() b = podpac.data.Array(source=[10, 20, 30], coordinates=podpac.Coordinates([[0, 1, 2]], dims=["lat"])) c = podpac.compositor.OrderedCompositor(sources=[a, b]) with warnings.catch_warnings(): warnings.filterwarnings("ignore", "Insecure evaluation.*") - cls.node = podpac.algorithm.Arithmetic(A=a, B=b, C=c, eqn="A + B + C") + cls.node = podpac.algorithms.Arithmetic(A=a, B=b, C=c, eqn="A + B + C") def test_base_ref(self): node = Node() @@ -750,8 +750,8 @@ def test_definition(self): assert node is not self.node assert node == self.node - assert isinstance(node, podpac.algorithm.Arithmetic) - assert isinstance(node.inputs["A"], podpac.algorithm.Arange) + assert isinstance(node, podpac.algorithms.Arithmetic) + assert isinstance(node.inputs["A"], podpac.algorithms.Arange) assert isinstance(node.inputs["B"], podpac.data.Array) assert isinstance(node.inputs["C"], podpac.compositor.OrderedCompositor) @@ -770,7 +770,7 @@ def test_definition_inputs_array(self): class MyNodeWithArrayInput(Node): my_array = ArrayTrait().tag(attr=True) - node1 = MyNodeWithArrayInput(my_array=[podpac.algorithm.Arange()]) + node1 = MyNodeWithArrayInput(my_array=[podpac.algorithms.Arange()]) node2 = Node.from_definition(node1.definition) assert node2 is not node1 and node2 == node1 @@ -780,7 +780,7 @@ def test_definition_inputs_dict(self): class MyNodeWithDictInput(Node): my_dict = tl.Dict().tag(attr=True) - node1 = MyNodeWithDictInput(my_dict={"a": podpac.algorithm.Arange()}) + node1 = MyNodeWithDictInput(my_dict={"a": podpac.algorithms.Arange()}) node2 = Node.from_definition(node1.definition) assert node2 is not node1 and node2 == node1 @@ -801,8 +801,8 @@ def test_json(self): node = Node.from_json(s) assert node is not self.node assert node == self.node - assert isinstance(node, podpac.algorithm.Arithmetic) - assert isinstance(node.inputs["A"], podpac.algorithm.Arange) + assert isinstance(node, podpac.algorithms.Arithmetic) + assert isinstance(node.inputs["A"], podpac.algorithms.Arange) assert isinstance(node.inputs["B"], podpac.data.Array) assert isinstance(node.inputs["C"], podpac.compositor.OrderedCompositor) @@ -820,8 +820,8 @@ def test_file(self): assert node is not self.node assert node == self.node - assert isinstance(node, podpac.algorithm.Arithmetic) - assert isinstance(node.inputs["A"], podpac.algorithm.Arange) + assert isinstance(node, podpac.algorithms.Arithmetic) + assert isinstance(node.inputs["A"], podpac.algorithms.Arange) assert isinstance(node.inputs["B"], podpac.data.Array) assert isinstance(node.inputs["C"], podpac.compositor.OrderedCompositor) @@ -936,12 +936,12 @@ def test_from_url(self): r"&bbox=40,-71,41,70&time=2018-05-19&PARAMS={params}" ) - params = ["{}", '{"a":{"node":"algorithm.Arange"}}', "{}", "{}"] + params = ["{}", '{"a":{"node":"algorithms.Arange"}}', "{}", "{}"] for service, layername in zip(["WMS", "WCS"], ["LAYERS", "COVERAGE"]): for layer, param in zip( [ - "algorithm.SinCoords", + "algorithms.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 @@ -955,7 +955,7 @@ def test_from_url_with_plugin_style_params(self): r"https://mobility-devel.crearecomputing.com/geowatch?&SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&" r"LAYERS=Arange&STYLES=&FORMAT=image%2Fpng&TRANSPARENT=true&HEIGHT=256&WIDTH=256" r"&CRS=EPSG%3A3857&BBOX=-20037508.342789244,10018754.171394618,-10018754.171394622,20037508.34278071&" - r'PARAMS={"plugin": "podpac.algorithm"}' + r'PARAMS={"plugin": "podpac.algorithms"}' ) url1 = ( r"https://mobility-devel.crearecomputing.com/geowatch?&SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&" @@ -968,18 +968,18 @@ def test_from_url_with_plugin_style_params(self): def test_from_name_params(self): # Normal - name = "algorithm.Arange" + name = "algorithms.Arange" node = Node.from_name_params(name) # Normal with params - name = "algorithm.CoordData" + name = "algorithms.CoordData" params = {"coord_name": "alt"} node = Node.from_name_params(name, params) assert node.coord_name == "alt" # Plugin style name = "CoordData" - params = {"plugin": "podpac.algorithm", "attrs": {"coord_name": "alt"}} + params = {"plugin": "podpac.algorithms", "attrs": {"coord_name": "alt"}} node = Node.from_name_params(name, params) assert node.coord_name == "alt" @@ -1085,7 +1085,7 @@ def test_lookup_attrs(self): """ node = Node.from_json(s) - assert isinstance(node, podpac.algorithm.CoordData) + assert isinstance(node, podpac.algorithms.CoordData) assert node.coord_name == "lat" # invalid type diff --git a/podpac/core/test/test_utils.py b/podpac/core/test/test_utils.py index 481d3151..c41f4ee9 100644 --- a/podpac/core/test/test_utils.py +++ b/podpac/core/test/test_utils.py @@ -471,7 +471,7 @@ def test_nontuple(self): assert ind2slice([1, 3, 5]) == slice(1, 7, 2) -class AnotherOne(podpac.algorithm.Algorithm): +class AnotherOne(podpac.algorithms.Algorithm): def algorithm(self, inputs, coordinates): return self.create_output_array(coordinates, data=1) @@ -484,7 +484,7 @@ class TestNodeProber(object): two = podpac.data.Array( source=np.ones((3, 3)) * 2, coordinates=coords, style=podpac.style.Style(name="two_style", units="t") ) - arange = podpac.algorithm.Arange() + arange = podpac.algorithms.Arange() nan = podpac.data.Array(source=np.ones((3, 3)) * np.nan, coordinates=coords) another_one = AnotherOne() @@ -505,8 +505,8 @@ def test_single_prober(self): def test_serial_prober(self): with podpac.settings: podpac.settings.set_unsafe_eval(True) - a = podpac.algorithm.Arithmetic(one=self.one, eqn="one * 2") - b = podpac.algorithm.Arithmetic(a=a, eqn="a*3", style=podpac.style.Style(name="six_style", units="m")) + a = podpac.algorithms.Arithmetic(one=self.one, eqn="one * 2") + b = podpac.algorithms.Arithmetic(a=a, eqn="a*3", style=podpac.style.Style(name="six_style", units="m")) expected = { "Array": { "active": True, @@ -539,7 +539,7 @@ def test_serial_prober(self): def test_parallel_prober(self): with podpac.settings: podpac.settings.set_unsafe_eval(True) - a = podpac.algorithm.Arithmetic(one=self.one, two=self.two, eqn="one * two") + a = podpac.algorithms.Arithmetic(one=self.one, two=self.two, eqn="one * two") expected = { "Array": { "active": True, diff --git a/podpac/core/utils.py b/podpac/core/utils.py index 7949845b..a9dead60 100644 --- a/podpac/core/utils.py +++ b/podpac/core/utils.py @@ -626,7 +626,7 @@ def get_ui_node_spec(module=None, category="default", help_as_html=False): if module is None: modcat = zip( - [podpac.data, podpac.algorithm, podpac.compositor, podpac.datalib], + [podpac.data, podpac.algorithms, podpac.compositor, podpac.datalib], ["data", "algorithm", "compositor", "datalib"], ) for mod, cat in modcat: diff --git a/podpac/datalib/drought_monitor.py b/podpac/datalib/drought_monitor.py index 54bc74ba..c06aedba 100644 --- a/podpac/datalib/drought_monitor.py +++ b/podpac/datalib/drought_monitor.py @@ -1,4 +1,4 @@ -from podpac.algorithm import Algorithm +from podpac.algorithms import Algorithm from podpac.data import Zarr from podpac.style import Style from podpac.utils import NodeTrait From 49004716ec4fa5dce2aa1f1306ceffe03e39a6b8 Mon Sep 17 00:00:00 2001 From: Clay Foye Date: Wed, 25 Jan 2023 08:17:38 -0500 Subject: [PATCH 4/6] MAINT: Refactor `compositor` to `compositors` --- doc/source/api.rst | 6 +- doc/source/nodes.md | 2 +- doc/source/wrapping-datasets.md | 2 +- podpac/__init__.py | 2 +- podpac/compositor.py | 8 -- podpac/compositors.py | 8 ++ .../{compositor => compositors}/__init__.py | 0 .../{compositor => compositors}/compositor.py | 0 .../ordered_compositor.py | 2 +- .../test/test_base_compositor.py | 2 +- .../test/test_ordered_compositor.py | 2 +- .../test/test_tiled_compositor.py | 2 +- .../tile_compositor.py | 2 +- .../interpolation/test/test_interpolation.py | 2 +- podpac/core/test/test_node.py | 80 +++++++++---------- podpac/core/test/test_utils.py | 8 +- podpac/core/utils.py | 4 +- podpac/datalib/cosmos_stations.py | 2 +- podpac/datalib/egi.py | 2 +- podpac/datalib/gfs.py | 2 +- podpac/datalib/modis_pds.py | 2 +- podpac/datalib/satutils.py | 4 +- podpac/datalib/soilscape.py | 2 +- podpac/datalib/terraintiles.py | 2 +- 24 files changed, 74 insertions(+), 74 deletions(-) delete mode 100644 podpac/compositor.py create mode 100644 podpac/compositors.py rename podpac/core/{compositor => compositors}/__init__.py (100%) rename podpac/core/{compositor => compositors}/compositor.py (100%) rename podpac/core/{compositor => compositors}/ordered_compositor.py (97%) rename podpac/core/{compositor => compositors}/test/test_base_compositor.py (99%) rename podpac/core/{compositor => compositors}/test/test_ordered_compositor.py (99%) rename podpac/core/{compositor => compositors}/test/test_tiled_compositor.py (97%) rename podpac/core/{compositor => compositors}/tile_compositor.py (97%) diff --git a/doc/source/api.rst b/doc/source/api.rst index acad0da7..a4185e26 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -179,9 +179,9 @@ Stitch multiple data sources together :toctree: api/ :template: class.rst - podpac.compositor.OrderedCompositor - podpac.compositor.UniformTileCompositor - podpac.compositor.UniformTileMixin + podpac.compositors.OrderedCompositor + podpac.compositors.UniformTileCompositor + podpac.compositors.UniformTileMixin Datalib diff --git a/doc/source/nodes.md b/doc/source/nodes.md index 8d4ed5bc..59721aa6 100644 --- a/doc/source/nodes.md +++ b/doc/source/nodes.md @@ -241,7 +241,7 @@ Additional properties and examples for each of the core node types are provided * The `node` path should include the submodule path and the node class. The submodule path is omitted for top-level classes. For example: - `"node": "datalib.smap.SMAP"` is equivalent to `from podpac.datalib.smap import SMAP`. - - `"node": "compositor.OrderedCompositor"` is equivalent to `from podpac.compositor import OrderedCompositor`. + - `"node": "compositor.OrderedCompositor"` is equivalent to `from podpac.compositorsimport OrderedCompositor`. * The `plugin` path replaces 'podpac' in the full node path. For example - `"plugin": "path.to.myplugin", "node": "mymodule.MyCustomNode"` is equivalent to `from path.to.myplugin.mymodule import MyCustomNode`. - `"plugin": "myplugin", "node": "MyCustomNode"` is equivalent to `from myplugin import MyCustomNode` \ No newline at end of file diff --git a/doc/source/wrapping-datasets.md b/doc/source/wrapping-datasets.md index 9dcec61b..5e226d03 100644 --- a/doc/source/wrapping-datasets.md +++ b/doc/source/wrapping-datasets.md @@ -20,7 +20,7 @@ In theory, to wrap a new `DataSource`: 1. `coordinates` is a `podpac.Coordinates` object and it's in the same coordinate system as the data source (i.e. a subset of what comes out of `get_coordinates`) 2. `coordinates_index` is a list (or tuple?) of slices or boolean arrays or index arrays to indexes into the output of `get_coordinates()` to produce `coordinates` that come into this function. -In practice, the real trick is implementing a compositor to put multiple tiles together to look like a single `DataSource`. We tend to use the `podpac.compositor.OrderedCompositor` node for this task, but it does not handle interpolation between tiles. Instead, see the `podpac.core.compositor.tile_compositor` module. +In practice, the real trick is implementing a compositor to put multiple tiles together to look like a single `DataSource`. We tend to use the `podpac.compositors.OrderedCompositor` node for this task, but it does not handle interpolation between tiles. Instead, see the `podpac.core.compositors.tile_compositor` module. When using compositors, it is prefered the that `sources` attribute is populated at instantiation, but on-the-fly (i.e. at eval) population of sources is also acceptible and sometimes necessary for certain datasources. diff --git a/podpac/__init__.py b/podpac/__init__.py index 56d4a5f8..95fe2c35 100644 --- a/podpac/__init__.py +++ b/podpac/__init__.py @@ -52,7 +52,7 @@ def makedirs(name, mode=511, exist_ok=False): from podpac import data from podpac import interpolators from podpac import coordinates -from podpac import compositor +from podpac import compositors from podpac import managers from podpac import utils from podpac import style diff --git a/podpac/compositor.py b/podpac/compositor.py deleted file mode 100644 index 200c6f32..00000000 --- a/podpac/compositor.py +++ /dev/null @@ -1,8 +0,0 @@ -""" -Compositor Public Module -""" - -# REMINDER: update api docs (doc/source/user/api.rst) to reflect changes to this file - -from podpac.core.compositor.ordered_compositor import OrderedCompositor -from podpac.core.compositor.tile_compositor import TileCompositor, TileCompositorRaw diff --git a/podpac/compositors.py b/podpac/compositors.py new file mode 100644 index 00000000..567cb31e --- /dev/null +++ b/podpac/compositors.py @@ -0,0 +1,8 @@ +""" +Compositor Public Module +""" + +# REMINDER: update api docs (doc/source/user/api.rst) to reflect changes to this file + +from podpac.core.compositors.ordered_compositor import OrderedCompositor +from podpac.core.compositors.tile_compositor import TileCompositor, TileCompositorRaw diff --git a/podpac/core/compositor/__init__.py b/podpac/core/compositors/__init__.py similarity index 100% rename from podpac/core/compositor/__init__.py rename to podpac/core/compositors/__init__.py diff --git a/podpac/core/compositor/compositor.py b/podpac/core/compositors/compositor.py similarity index 100% rename from podpac/core/compositor/compositor.py rename to podpac/core/compositors/compositor.py diff --git a/podpac/core/compositor/ordered_compositor.py b/podpac/core/compositors/ordered_compositor.py similarity index 97% rename from podpac/core/compositor/ordered_compositor.py rename to podpac/core/compositors/ordered_compositor.py index 1be0312f..d8ea2398 100644 --- a/podpac/core/compositor/ordered_compositor.py +++ b/podpac/core/compositors/ordered_compositor.py @@ -6,7 +6,7 @@ from podpac.core.node import NodeException from podpac.core.units import UnitsDataArray from podpac.core.utils import common_doc -from podpac.core.compositor.compositor import COMMON_COMPOSITOR_DOC, BaseCompositor +from podpac.core.compositors.compositor import COMMON_COMPOSITOR_DOC, BaseCompositor @common_doc(COMMON_COMPOSITOR_DOC) diff --git a/podpac/core/compositor/test/test_base_compositor.py b/podpac/core/compositors/test/test_base_compositor.py similarity index 99% rename from podpac/core/compositor/test/test_base_compositor.py rename to podpac/core/compositors/test/test_base_compositor.py index 47081a12..8fb98bcf 100644 --- a/podpac/core/compositor/test/test_base_compositor.py +++ b/podpac/core/compositors/test/test_base_compositor.py @@ -4,7 +4,7 @@ import podpac from podpac.core.data.datasource import DataSource from podpac.core.data.array_source import Array -from podpac.core.compositor.compositor import BaseCompositor +from podpac.core.compositors.compositor import BaseCompositor COORDS = podpac.Coordinates( [podpac.clinspace(45, 0, 16), podpac.clinspace(-70, -65, 16), podpac.clinspace(0, 1, 2)], diff --git a/podpac/core/compositor/test/test_ordered_compositor.py b/podpac/core/compositors/test/test_ordered_compositor.py similarity index 99% rename from podpac/core/compositor/test/test_ordered_compositor.py rename to podpac/core/compositors/test/test_ordered_compositor.py index 02ca35a1..d9690bdf 100644 --- a/podpac/core/compositor/test/test_ordered_compositor.py +++ b/podpac/core/compositors/test/test_ordered_compositor.py @@ -4,7 +4,7 @@ import podpac from podpac.core.data.array_source import Array -from podpac.core.compositor.ordered_compositor import OrderedCompositor +from podpac.core.compositors.ordered_compositor import OrderedCompositor COORDS = podpac.Coordinates( [podpac.clinspace(45, 0, 16), podpac.clinspace(-70, -65, 16), podpac.clinspace(0, 1, 2)], diff --git a/podpac/core/compositor/test/test_tiled_compositor.py b/podpac/core/compositors/test/test_tiled_compositor.py similarity index 97% rename from podpac/core/compositor/test/test_tiled_compositor.py rename to podpac/core/compositors/test/test_tiled_compositor.py index ed699d66..79382be7 100644 --- a/podpac/core/compositor/test/test_tiled_compositor.py +++ b/podpac/core/compositors/test/test_tiled_compositor.py @@ -3,7 +3,7 @@ import podpac from podpac.core.data.array_source import ArrayRaw -from podpac.core.compositor.tile_compositor import TileCompositorRaw, TileCompositor +from podpac.core.compositors.tile_compositor import TileCompositorRaw, TileCompositor class TestTileCompositor(object): diff --git a/podpac/core/compositor/tile_compositor.py b/podpac/core/compositors/tile_compositor.py similarity index 97% rename from podpac/core/compositor/tile_compositor.py rename to podpac/core/compositors/tile_compositor.py index 141b6169..588c8ffd 100644 --- a/podpac/core/compositor/tile_compositor.py +++ b/podpac/core/compositors/tile_compositor.py @@ -6,7 +6,7 @@ import traitlets as tl from podpac.core.utils import common_doc -from podpac.core.compositor.compositor import COMMON_COMPOSITOR_DOC, BaseCompositor +from podpac.core.compositors.compositor import COMMON_COMPOSITOR_DOC, BaseCompositor from podpac.core.units import UnitsDataArray from podpac.core.interpolation.interpolation import InterpolationMixin from podpac.core.coordinates import Coordinates diff --git a/podpac/core/interpolation/test/test_interpolation.py b/podpac/core/interpolation/test/test_interpolation.py index 3579b4af..31aa77b2 100644 --- a/podpac/core/interpolation/test/test_interpolation.py +++ b/podpac/core/interpolation/test/test_interpolation.py @@ -20,7 +20,7 @@ from podpac.core.interpolation.interpolation_manager import InterpolationException from podpac.core.interpolation.interpolation import Interpolate, InterpolationMixin from podpac.core.data.array_source import Array, ArrayRaw -from podpac.core.compositor.tile_compositor import TileCompositorRaw +from podpac.core.compositors.tile_compositor import TileCompositorRaw from podpac.core.interpolation.scipy_interpolator import ScipyGrid diff --git a/podpac/core/test/test_node.py b/podpac/core/test/test_node.py index a03413bf..907d9691 100644 --- a/podpac/core/test/test_node.py +++ b/podpac/core/test/test_node.py @@ -659,7 +659,7 @@ class TestSerialization(object): def setup_class(cls): a = podpac.algorithms.Arange() b = podpac.data.Array(source=[10, 20, 30], coordinates=podpac.Coordinates([[0, 1, 2]], dims=["lat"])) - c = podpac.compositor.OrderedCompositor(sources=[a, b]) + c = podpac.compositors.OrderedCompositor(sources=[a, b]) with warnings.catch_warnings(): warnings.filterwarnings("ignore", "Insecure evaluation.*") @@ -753,13 +753,13 @@ def test_definition(self): assert isinstance(node, podpac.algorithms.Arithmetic) assert isinstance(node.inputs["A"], podpac.algorithms.Arange) assert isinstance(node.inputs["B"], podpac.data.Array) - assert isinstance(node.inputs["C"], podpac.compositor.OrderedCompositor) + assert isinstance(node.inputs["C"], podpac.compositors.OrderedCompositor) def test_definition_duplicate_base_ref(self): n1 = Node(units="m") n2 = Node(units="ft") n3 = Node(units="in") - node = podpac.compositor.OrderedCompositor(sources=[n1, n2, n3]) + node = podpac.compositors.OrderedCompositor(sources=[n1, n2, n3]) d = node.definition assert n1.base_ref == n2.base_ref == n3.base_ref assert len(d) == 5 @@ -804,7 +804,7 @@ def test_json(self): assert isinstance(node, podpac.algorithms.Arithmetic) assert isinstance(node.inputs["A"], podpac.algorithms.Arange) assert isinstance(node.inputs["B"], podpac.data.Array) - assert isinstance(node.inputs["C"], podpac.compositor.OrderedCompositor) + assert isinstance(node.inputs["C"], podpac.compositors.OrderedCompositor) def test_file(self): path = tempfile.mkdtemp(prefix="podpac-test-") @@ -823,7 +823,7 @@ def test_file(self): assert isinstance(node, podpac.algorithms.Arithmetic) assert isinstance(node.inputs["A"], podpac.algorithms.Arange) assert isinstance(node.inputs["B"], podpac.data.Array) - assert isinstance(node.inputs["C"], podpac.compositor.OrderedCompositor) + assert isinstance(node.inputs["C"], podpac.compositors.OrderedCompositor) def test_json_pretty(self): node = Node() @@ -1048,7 +1048,7 @@ def test_inputs(self): s = """ { "a": { - "node": "algorithm.Min", + "node": "algorithms.Min", "inputs": { "source": 10 } } } @@ -1061,7 +1061,7 @@ def test_inputs(self): s = """ { "a": { - "node": "algorithm.Min", + "node": "algorithms.Min", "inputs": { "source": "nonexistent" } } } @@ -1074,11 +1074,11 @@ def test_lookup_attrs(self): s = """ { "a": { - "node": "algorithm.CoordData", + "node": "algorithms.CoordData", "attrs": { "coord_name": "lat" } }, "b": { - "node": "algorithm.CoordData", + "node": "algorithms.CoordData", "lookup_attrs": { "coord_name": "a.coord_name" } } } @@ -1092,11 +1092,11 @@ def test_lookup_attrs(self): s = """ { "a": { - "node": "algorithm.CoordData", + "node": "algorithms.CoordData", "attrs": { "coord_name": "lat" } }, "b": { - "node": "algorithm.CoordData", + "node": "algorithms.CoordData", "lookup_attrs": { "coord_name": 10 } } } @@ -1109,11 +1109,11 @@ def test_lookup_attrs(self): s = """ { "a": { - "node": "algorithm.CoordData", + "node": "algorithms.CoordData", "attrs": { "coord_name": "lat" } }, "b": { - "node": "algorithm.CoordData", + "node": "algorithms.CoordData", "lookup_attrs": { "coord_name": "nonexistent.coord_name" } } } @@ -1126,11 +1126,11 @@ def test_lookup_attrs(self): s = """ { "a": { - "node": "algorithm.CoordData", + "node": "algorithms.CoordData", "attrs": { "coord_name": "lat" } }, "b": { - "node": "algorithm.CoordData", + "node": "algorithms.CoordData", "lookup_attrs": { "coord_name": "a.nonexistent" } } } @@ -1143,7 +1143,7 @@ def test_invalid_property(self): s = """ { "a": { - "node": "algorithm.Arange", + "node": "algorithms.Arange", "invalid_property": "value" } } @@ -1187,15 +1187,15 @@ def test_debuggable(self): s = """ { "a": { - "node": "algorithm.Arange" + "node": "algorithms.Arange" }, "mean": { - "node": "algorithm.Convolution", + "node": "algorithms.Convolution", "lookup_attrs": {"source": "a"}, "attrs": {"kernel_type": "mean,3", "kernel_dims": ["lat", "lon"]} }, "c": { - "node": "algorithm.Arithmetic", + "node": "algorithms.Arithmetic", "lookup_attrs": {"A": "a", "B": "mean"}, "attrs": {"eqn": "a-b"} } @@ -1219,7 +1219,7 @@ def test_from_definition_version_warning(self): s = """ { "a": { - "node": "algorithm.Arange" + "node": "algorithms.Arange" }, "podpac_version": "other" } @@ -1232,7 +1232,7 @@ def test_from_proper_json(self): not_ordered_json = """ { "Arithmetic": { - "node": "core.algorithm.generic.Arithmetic", + "node": "core.algorithms.generic.Arithmetic", "attrs": { "eqn": "a+b", "params": { @@ -1245,7 +1245,7 @@ def test_from_proper_json(self): } }, "SinCoords": { - "node": "core.algorithm.utility.SinCoords", + "node": "core.algorithms.utility.SinCoords", "style": { "colormap": "jet", "clim": [ @@ -1255,7 +1255,7 @@ def test_from_proper_json(self): } }, "Arange": { - "node": "core.algorithm.utility.Arange" + "node": "core.algorithms.utility.Arange" }, "podpac_version": "3.2.0" } @@ -1263,7 +1263,7 @@ def test_from_proper_json(self): not_ordered_json_2 = """ { "SinCoords": { - "node": "core.algorithm.utility.SinCoords", + "node": "core.algorithms.utility.SinCoords", "style": { "colormap": "jet", "clim": [ @@ -1273,7 +1273,7 @@ def test_from_proper_json(self): } }, "Arithmetic": { - "node": "core.algorithm.generic.Arithmetic", + "node": "core.algorithms.generic.Arithmetic", "attrs": { "eqn": "a+b", "params": { @@ -1286,7 +1286,7 @@ def test_from_proper_json(self): } }, "Arange": { - "node": "core.algorithm.utility.Arange" + "node": "core.algorithms.utility.Arange" }, "podpac_version": "3.2.0" } @@ -1294,7 +1294,7 @@ def test_from_proper_json(self): ordered_json = """ { "SinCoords": { - "node": "core.algorithm.utility.SinCoords", + "node": "core.algorithms.utility.SinCoords", "style": { "colormap": "jet", "clim": [ @@ -1304,10 +1304,10 @@ def test_from_proper_json(self): } }, "Arange": { - "node": "core.algorithm.utility.Arange" + "node": "core.algorithms.utility.Arange" }, "Arithmetic": { - "node": "core.algorithm.generic.Arithmetic", + "node": "core.algorithms.generic.Arithmetic", "attrs": { "eqn": "a+b", "params": { @@ -1333,10 +1333,10 @@ def test_from_proper_json(self): incomplete_json = """ { "Arange": { - "node": "core.algorithm.utility.Arange" + "node": "core.algorithms.utility.Arange" }, "Arithmetic": { - "node": "core.algorithm.generic.Arithmetic", + "node": "core.algorithms.generic.Arithmetic", "attrs": { "eqn": "a+b", "params": { @@ -1358,7 +1358,7 @@ def test_output_node(self): included_json = """ { "Arithmetic": { - "node": "core.algorithm.generic.Arithmetic", + "node": "core.algorithms.generic.Arithmetic", "attrs": { "eqn": "a+b", "params": { @@ -1371,7 +1371,7 @@ def test_output_node(self): } }, "SinCoords": { - "node": "core.algorithm.utility.SinCoords", + "node": "core.algorithms.utility.SinCoords", "style": { "colormap": "jet", "clim": [ @@ -1381,7 +1381,7 @@ def test_output_node(self): } }, "Arange": { - "node": "core.algorithm.utility.Arange" + "node": "core.algorithms.utility.Arange" }, "podpac_version": "3.2.0", "podpac_output_node": "Arithmetic" @@ -1390,7 +1390,7 @@ def test_output_node(self): ordered_json = """ { "SinCoords": { - "node": "core.algorithm.utility.SinCoords", + "node": "core.algorithms.utility.SinCoords", "style": { "colormap": "jet", "clim": [ @@ -1400,10 +1400,10 @@ def test_output_node(self): } }, "Arange": { - "node": "core.algorithm.utility.Arange" + "node": "core.algorithms.utility.Arange" }, "Arithmetic": { - "node": "core.algorithm.generic.Arithmetic", + "node": "core.algorithms.generic.Arithmetic", "attrs": { "eqn": "a+b", "params": { @@ -1426,7 +1426,7 @@ def test_output_node(self): wrong_name_json = """ { "SinCoords": { - "node": "core.algorithm.utility.SinCoords", + "node": "core.algorithms.utility.SinCoords", "style": { "colormap": "jet", "clim": [ @@ -1436,10 +1436,10 @@ def test_output_node(self): } }, "Arange": { - "node": "core.algorithm.utility.Arange" + "node": "core.algorithms.utility.Arange" }, "Arithmetic": { - "node": "core.algorithm.generic.Arithmetic", + "node": "core.algorithms.generic.Arithmetic", "attrs": { "eqn": "a+b", "params": { diff --git a/podpac/core/test/test_utils.py b/podpac/core/test/test_utils.py index c41f4ee9..8a634bd9 100644 --- a/podpac/core/test/test_utils.py +++ b/podpac/core/test/test_utils.py @@ -570,7 +570,7 @@ def test_parallel_prober(self): assert out == expected def test_composited_prober(self): - a = podpac.compositor.OrderedCompositor(sources=[self.one, self.arange]) + a = podpac.compositors.OrderedCompositor(sources=[self.one, self.arange]) expected = { "Array": { "active": True, @@ -600,7 +600,7 @@ def test_composited_prober(self): out = probe_node(a, lat=1, lon=1) assert out == expected - a = podpac.compositor.OrderedCompositor(sources=[self.nan, self.two]) + a = podpac.compositors.OrderedCompositor(sources=[self.nan, self.two]) expected = { "Array": { "active": False, @@ -633,7 +633,7 @@ def test_composited_prober(self): out[k]["value"] = "nan" assert out == expected - a = podpac.compositor.OrderedCompositor(sources=[self.nan, self.one, self.another_one]) + a = podpac.compositors.OrderedCompositor(sources=[self.nan, self.one, self.another_one]) expected = { "Array": { "active": False, @@ -675,7 +675,7 @@ def test_composited_prober(self): assert out == expected def test_composited_prober_nested(self): - a = podpac.compositor.OrderedCompositor( + a = podpac.compositors.OrderedCompositor( sources=[self.one, self.arange], style=podpac.style.Style(name="composited", units="c") ) expected = { diff --git a/podpac/core/utils.py b/podpac/core/utils.py index a9dead60..bdcf59a8 100644 --- a/podpac/core/utils.py +++ b/podpac/core/utils.py @@ -587,7 +587,7 @@ def get_entry(key, out, definition): "node_hash": n.hash, } # Fix sources for Compositors - if isinstance(n, podpac.compositor.OrderedCompositor): + if isinstance(n, podpac.compositors.OrderedCompositor): searching_for_active = True for inp in inputs: out[inp]["active"] = False @@ -626,7 +626,7 @@ def get_ui_node_spec(module=None, category="default", help_as_html=False): if module is None: modcat = zip( - [podpac.data, podpac.algorithms, podpac.compositor, podpac.datalib], + [podpac.data, podpac.algorithms, podpac.compositors, podpac.datalib], ["data", "algorithm", "compositor", "datalib"], ) for mod, cat in modcat: diff --git a/podpac/datalib/cosmos_stations.py b/podpac/datalib/cosmos_stations.py index ebcd45fb..b2beb8c4 100644 --- a/podpac/datalib/cosmos_stations.py +++ b/podpac/datalib/cosmos_stations.py @@ -23,7 +23,7 @@ import podpac from podpac.core.utils import _get_from_url, cached_property from podpac.data import DataSource -from podpac.compositor import TileCompositorRaw +from podpac.compositors import TileCompositorRaw from podpac.interpolators import InterpolationMixin _logger = logging.getLogger(__name__) diff --git a/podpac/datalib/egi.py b/podpac/datalib/egi.py index 5725584b..da94af56 100644 --- a/podpac/datalib/egi.py +++ b/podpac/datalib/egi.py @@ -26,7 +26,7 @@ # Internal dependencies from podpac import Coordinates, Node -from podpac.compositor import OrderedCompositor +from podpac.compositors import OrderedCompositor from podpac.data import DataSource from podpac.interpolators import InterpolationMixin from podpac import authentication diff --git a/podpac/datalib/gfs.py b/podpac/datalib/gfs.py index 2de2d4f3..d4178e82 100644 --- a/podpac/datalib/gfs.py +++ b/podpac/datalib/gfs.py @@ -14,7 +14,7 @@ from podpac.core.authentication import S3Mixin from podpac.coordinates import Coordinates from podpac.utils import cached_property, DiskCacheMixin -from podpac.compositor import TileCompositor +from podpac.compositors import TileCompositor BUCKET = "noaa-gfs-pds" diff --git a/podpac/datalib/modis_pds.py b/podpac/datalib/modis_pds.py index 9b57c168..a904a2d2 100644 --- a/podpac/datalib/modis_pds.py +++ b/podpac/datalib/modis_pds.py @@ -12,7 +12,7 @@ import podpac from podpac.utils import cached_property -from podpac.compositor import TileCompositorRaw +from podpac.compositors import TileCompositorRaw from podpac.core.data.rasterio_source import RasterioRaw from podpac.authentication import S3Mixin from podpac.interpolators import InterpolationMixin diff --git a/podpac/datalib/satutils.py b/podpac/datalib/satutils.py index 75687697..5559154d 100644 --- a/podpac/datalib/satutils.py +++ b/podpac/datalib/satutils.py @@ -19,7 +19,7 @@ # Internal dependencies import podpac -from podpac.compositor import TileCompositor +from podpac.compositors import TileCompositor from podpac.core.data.rasterio_source import RasterioRaw from podpac.core.units import UnitsDataArray from podpac.authentication import S3Mixin @@ -79,7 +79,7 @@ class SatUtils(S3Mixin, TileCompositor): PODPAC DataSource node to access the data using sat-utils developed by Development Seed See https://github.com/sat-utils - See :class:`podpac.compositor.OrderedCompositor` for more information. + See :class:`podpac.compositors.OrderedCompositor` for more information. Parameters ---------- diff --git a/podpac/datalib/soilscape.py b/podpac/datalib/soilscape.py index b72aec59..754ef4c0 100644 --- a/podpac/datalib/soilscape.py +++ b/podpac/datalib/soilscape.py @@ -554,7 +554,7 @@ def filename(self): return "soil_moist_20min_{site}_n{node}".format(site=self.site, node=self.node) -class SoilSCAPE20minRaw(podpac.compositor.TileCompositorRaw): +class SoilSCAPE20minRaw(podpac.compositors.TileCompositorRaw): """Raw SoilSCAPE 20min soil moisture data for an entire site. Data is loaded from the THREDDS https fileserver. diff --git a/podpac/datalib/terraintiles.py b/podpac/datalib/terraintiles.py index 5e35d688..2b30cce8 100644 --- a/podpac/datalib/terraintiles.py +++ b/podpac/datalib/terraintiles.py @@ -43,7 +43,7 @@ import podpac from podpac.core.data.rasterio_source import RasterioRaw -from podpac.compositor import TileCompositorRaw +from podpac.compositors import TileCompositorRaw from podpac.interpolators import InterpolationMixin from podpac.interpolators import RasterioInterpolator, ScipyGrid, ScipyPoint from podpac.utils import cached_property From a3aac9dc8f498a498116c72b581e4a1836545435 Mon Sep 17 00:00:00 2001 From: Clay Foye Date: Wed, 25 Jan 2023 08:32:51 -0500 Subject: [PATCH 5/6] MAINT: cleanup dirs, Refactor `interpolator` --- podpac/core/algorithms/reprojection.py | 2 +- podpac/core/compositors/tile_compositor.py | 2 +- podpac/core/data/array_source.py | 2 +- podpac/core/data/csv_source.py | 2 +- podpac/core/data/dataset_source.py | 2 +- podpac/core/data/h5py_source.py | 2 +- podpac/core/data/ogc.py | 2 +- podpac/core/data/ogr.py | 2 +- podpac/core/data/pydap_source.py | 2 +- podpac/core/data/rasterio_source.py | 2 +- podpac/core/data/reprojection.py | 2 +- podpac/core/data/zarr_source.py | 2 +- .../{interpolation => interpolators}/__init__.py | 0 .../interpolation.py | 2 +- .../interpolation_manager.py | 12 ++++++------ .../{interpolation => interpolators}/interpolator.py | 2 +- .../nearest_neighbor_interpolator.py | 4 ++-- .../none_interpolator.py | 4 ++-- .../rasterio_interpolator.py | 2 +- .../scipy_interpolator.py | 2 +- .../{interpolation => interpolators}/selector.py | 0 .../test/test_interpolation.py | 6 +++--- .../test/test_interpolation_manager.py | 8 ++++---- .../test/test_interpolator.py | 2 +- .../test/test_interpolators.py | 12 ++++++------ .../test/test_selector.py | 2 +- .../xarray_interpolator.py | 2 +- podpac/data.py | 2 +- podpac/interpolators.py | 12 ++++++------ 29 files changed, 49 insertions(+), 49 deletions(-) rename podpac/core/{interpolation => interpolators}/__init__.py (100%) rename podpac/core/{interpolation => interpolators}/interpolation.py (99%) rename podpac/core/{interpolation => interpolators}/interpolation_manager.py (98%) rename podpac/core/{interpolation => interpolators}/interpolator.py (99%) rename podpac/core/{interpolation => interpolators}/nearest_neighbor_interpolator.py (99%) rename podpac/core/{interpolation => interpolators}/none_interpolator.py (94%) rename podpac/core/{interpolation => interpolators}/rasterio_interpolator.py (98%) rename podpac/core/{interpolation => interpolators}/scipy_interpolator.py (99%) rename podpac/core/{interpolation => interpolators}/selector.py (100%) rename podpac/core/{interpolation => interpolators}/test/test_interpolation.py (97%) rename podpac/core/{interpolation => interpolators}/test/test_interpolation_manager.py (98%) rename podpac/core/{interpolation => interpolators}/test/test_interpolator.py (96%) rename podpac/core/{interpolation => interpolators}/test/test_interpolators.py (99%) rename podpac/core/{interpolation => interpolators}/test/test_selector.py (99%) rename podpac/core/{interpolation => interpolators}/xarray_interpolator.py (98%) diff --git a/podpac/core/algorithms/reprojection.py b/podpac/core/algorithms/reprojection.py index 091c79e5..589605c9 100644 --- a/podpac/core/algorithms/reprojection.py +++ b/podpac/core/algorithms/reprojection.py @@ -13,7 +13,7 @@ # Internal dependencies from podpac.core.node import Node from podpac.core.coordinates.coordinates import Coordinates, merge_dims -from podpac.core.interpolation.interpolation import Interpolate +from podpac.core.interpolators.interpolation import Interpolate from podpac.core.utils import NodeTrait, cached_property from podpac import settings diff --git a/podpac/core/compositors/tile_compositor.py b/podpac/core/compositors/tile_compositor.py index 588c8ffd..dc80c051 100644 --- a/podpac/core/compositors/tile_compositor.py +++ b/podpac/core/compositors/tile_compositor.py @@ -8,7 +8,7 @@ from podpac.core.utils import common_doc from podpac.core.compositors.compositor import COMMON_COMPOSITOR_DOC, BaseCompositor from podpac.core.units import UnitsDataArray -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin from podpac.core.coordinates import Coordinates diff --git a/podpac/core/data/array_source.py b/podpac/core/data/array_source.py index e6fc48f3..96fc4e23 100644 --- a/podpac/core/data/array_source.py +++ b/podpac/core/data/array_source.py @@ -17,7 +17,7 @@ from podpac.core.node import NoCacheMixin from podpac.core.coordinates import Coordinates from podpac.core.data.datasource import COMMON_DATA_DOC, DataSource -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin class ArrayRaw(NoCacheMixin, DataSource): diff --git a/podpac/core/data/csv_source.py b/podpac/core/data/csv_source.py index 5289dbd7..f72b295f 100644 --- a/podpac/core/data/csv_source.py +++ b/podpac/core/data/csv_source.py @@ -5,7 +5,7 @@ from podpac.core.coordinates import Coordinates, StackedCoordinates from podpac.core.data.datasource import COMMON_DATA_DOC, DATA_DOC from podpac.core.data.file_source import BaseFileSource, FileKeysMixin, LoadFileMixin -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin @common_doc(COMMON_DATA_DOC) diff --git a/podpac/core/data/dataset_source.py b/podpac/core/data/dataset_source.py index 2efcf789..006d00a0 100644 --- a/podpac/core/data/dataset_source.py +++ b/podpac/core/data/dataset_source.py @@ -4,7 +4,7 @@ from podpac.core.utils import common_doc, cached_property from podpac.core.data.datasource import COMMON_DATA_DOC, DATA_DOC from podpac.core.data.file_source import BaseFileSource, FileKeysMixin, LoadFileMixin -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin from podpac.core.coordinates.coordinates import Coordinates diff --git a/podpac/core/data/h5py_source.py b/podpac/core/data/h5py_source.py index 8a7300ba..ecba48e1 100644 --- a/podpac/core/data/h5py_source.py +++ b/podpac/core/data/h5py_source.py @@ -7,7 +7,7 @@ from podpac.core.utils import common_doc, cached_property from podpac.core.data.datasource import COMMON_DATA_DOC, DATA_DOC from podpac.core.data.file_source import BaseFileSource, FileKeysMixin -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin @common_doc(COMMON_DATA_DOC) diff --git a/podpac/core/data/ogc.py b/podpac/core/data/ogc.py index 98688252..25c641f5 100644 --- a/podpac/core/data/ogc.py +++ b/podpac/core/data/ogc.py @@ -13,7 +13,7 @@ from podpac.core.utils import common_doc, cached_property, resolve_bbox_order from podpac.core.data.datasource import DataSource -from podpac.core.interpolation.interpolation import InterpolationMixin, InterpolationTrait +from podpac.core.interpolators.interpolation import InterpolationMixin, InterpolationTrait from podpac.core.node import NodeException from podpac.core.coordinates import Coordinates from podpac.core.coordinates import UniformCoordinates1d, ArrayCoordinates1d, Coordinates1d, StackedCoordinates diff --git a/podpac/core/data/ogr.py b/podpac/core/data/ogr.py index 76147179..ed166624 100644 --- a/podpac/core/data/ogr.py +++ b/podpac/core/data/ogr.py @@ -11,7 +11,7 @@ from podpac import Node, Coordinates, cached_property, settings, clinspace from podpac.core.utils import common_doc from podpac.core.node import COMMON_NODE_DOC -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin class OGRRaw(Node): diff --git a/podpac/core/data/pydap_source.py b/podpac/core/data/pydap_source.py index 415ff6d4..90539d56 100644 --- a/podpac/core/data/pydap_source.py +++ b/podpac/core/data/pydap_source.py @@ -19,7 +19,7 @@ from podpac.core import authentication from podpac.core.utils import common_doc, cached_property from podpac.core.data.datasource import COMMON_DATA_DOC, DataSource -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin # Optional dependencies diff --git a/podpac/core/data/rasterio_source.py b/podpac/core/data/rasterio_source.py index f52c03e3..0e8649f2 100644 --- a/podpac/core/data/rasterio_source.py +++ b/podpac/core/data/rasterio_source.py @@ -21,7 +21,7 @@ from podpac.core.data.datasource import COMMON_DATA_DOC, DATA_DOC from podpac.core.data.file_source import BaseFileSource from podpac.core.authentication import S3Mixin -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin _logger = logging.getLogger(__name__) diff --git a/podpac/core/data/reprojection.py b/podpac/core/data/reprojection.py index 53f5b53a..b368ea8d 100644 --- a/podpac/core/data/reprojection.py +++ b/podpac/core/data/reprojection.py @@ -11,7 +11,7 @@ from podpac.core.coordinates import Coordinates from podpac.core.node import Node from podpac.core.data.datasource import COMMON_DATA_DOC, DataSource -from podpac.core.interpolation import InterpolationTrait +from podpac.core.interpolators import InterpolationTrait _logger = logging.getLogger(__name__) diff --git a/podpac/core/data/zarr_source.py b/podpac/core/data/zarr_source.py index eb0785b9..2c4c694c 100644 --- a/podpac/core/data/zarr_source.py +++ b/podpac/core/data/zarr_source.py @@ -13,7 +13,7 @@ from podpac.core.utils import common_doc, cached_property from podpac.core.data.datasource import COMMON_DATA_DOC, DATA_DOC from podpac.core.data.file_source import BaseFileSource, FileKeysMixin -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation import InterpolationMixin class ZarrRaw(S3Mixin, FileKeysMixin, BaseFileSource): diff --git a/podpac/core/interpolation/__init__.py b/podpac/core/interpolators/__init__.py similarity index 100% rename from podpac/core/interpolation/__init__.py rename to podpac/core/interpolators/__init__.py diff --git a/podpac/core/interpolation/interpolation.py b/podpac/core/interpolators/interpolation.py similarity index 99% rename from podpac/core/interpolation/interpolation.py rename to podpac/core/interpolators/interpolation.py index ddf70ef0..49612c03 100644 --- a/podpac/core/interpolation/interpolation.py +++ b/podpac/core/interpolators/interpolation.py @@ -15,7 +15,7 @@ from podpac.core.utils import NodeTrait, common_doc, cached_property from podpac.core.units import UnitsDataArray from podpac.core.coordinates import merge_dims, Coordinates -from podpac.core.interpolation.interpolation_manager import InterpolationManager, InterpolationTrait +from podpac.core.interpolators.interpolation_manager import InterpolationManager, InterpolationTrait from podpac.core.cache.cache_ctrl import CacheCtrl from podpac.core.data.datasource import DataSource diff --git a/podpac/core/interpolation/interpolation_manager.py b/podpac/core/interpolators/interpolation_manager.py similarity index 98% rename from podpac/core/interpolation/interpolation_manager.py rename to podpac/core/interpolators/interpolation_manager.py index daaa3f23..9e726e43 100644 --- a/podpac/core/interpolation/interpolation_manager.py +++ b/podpac/core/interpolators/interpolation_manager.py @@ -13,12 +13,12 @@ from podpac.core.units import UnitsDataArray from podpac.core.coordinates import merge_dims, Coordinates, StackedCoordinates from podpac.core.coordinates.utils import VALID_DIMENSION_NAMES -from podpac.core.interpolation.interpolator import Interpolator -from podpac.core.interpolation.nearest_neighbor_interpolator import NearestNeighbor, NearestPreview -from podpac.core.interpolation.rasterio_interpolator import RasterioInterpolator -from podpac.core.interpolation.scipy_interpolator import ScipyPoint, ScipyGrid -from podpac.core.interpolation.xarray_interpolator import XarrayInterpolator -from podpac.core.interpolation.none_interpolator import NoneInterpolator +from podpac.core.interpolators.interpolator import Interpolator +from podpac.core.interpolators.nearest_neighbor_interpolator import NearestNeighbor, NearestPreview +from podpac.core.interpolators.rasterio_interpolator import RasterioInterpolator +from podpac.core.interpolators.scipy_interpolator import ScipyPoint, ScipyGrid +from podpac.core.interpolators.xarray_interpolator import XarrayInterpolator +from podpac.core.interpolators.none_interpolator import NoneInterpolator _logger = logging.getLogger(__name__) diff --git a/podpac/core/interpolation/interpolator.py b/podpac/core/interpolators/interpolator.py similarity index 99% rename from podpac/core/interpolation/interpolator.py rename to podpac/core/interpolators/interpolator.py index 1669dbab..639926a4 100644 --- a/podpac/core/interpolation/interpolator.py +++ b/podpac/core/interpolators/interpolator.py @@ -15,7 +15,7 @@ import traitlets as tl import six from podpac.core.utils import common_doc -from podpac.core.interpolation.selector import Selector +from podpac.core.interpolators.selector import Selector # Set up logging _log = logging.getLogger(__name__) diff --git a/podpac/core/interpolation/nearest_neighbor_interpolator.py b/podpac/core/interpolators/nearest_neighbor_interpolator.py similarity index 99% rename from podpac/core/interpolation/nearest_neighbor_interpolator.py rename to podpac/core/interpolators/nearest_neighbor_interpolator.py index ae39d038..b9729115 100644 --- a/podpac/core/interpolation/nearest_neighbor_interpolator.py +++ b/podpac/core/interpolators/nearest_neighbor_interpolator.py @@ -14,12 +14,12 @@ # podac imports -from podpac.core.interpolation.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException +from podpac.core.interpolators.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException from podpac.core.coordinates import Coordinates, UniformCoordinates1d, StackedCoordinates from podpac.core.coordinates.utils import make_coord_delta, make_coord_value from podpac.core.utils import common_doc from podpac.core.coordinates.utils import get_timedelta -from podpac.core.interpolation.selector import Selector, _higher_precision_time_coords1d, _higher_precision_time_stack +from podpac.core.interpolators.selector import Selector, _higher_precision_time_coords1d, _higher_precision_time_stack @common_doc(COMMON_INTERPOLATOR_DOCS) diff --git a/podpac/core/interpolation/none_interpolator.py b/podpac/core/interpolators/none_interpolator.py similarity index 94% rename from podpac/core/interpolation/none_interpolator.py rename to podpac/core/interpolators/none_interpolator.py index 28f84f44..7ec18779 100644 --- a/podpac/core/interpolation/none_interpolator.py +++ b/podpac/core/interpolators/none_interpolator.py @@ -14,12 +14,12 @@ # podac imports -from podpac.core.interpolation.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException +from podpac.core.interpolators.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException from podpac.core.coordinates import Coordinates, UniformCoordinates1d, StackedCoordinates from podpac.core.coordinates.utils import make_coord_delta, make_coord_value from podpac.core.utils import common_doc from podpac.core.coordinates.utils import get_timedelta -from podpac.core.interpolation.selector import Selector, _higher_precision_time_coords1d, _higher_precision_time_stack +from podpac.core.interpolators.selector import Selector, _higher_precision_time_coords1d, _higher_precision_time_stack @common_doc(COMMON_INTERPOLATOR_DOCS) diff --git a/podpac/core/interpolation/rasterio_interpolator.py b/podpac/core/interpolators/rasterio_interpolator.py similarity index 98% rename from podpac/core/interpolation/rasterio_interpolator.py rename to podpac/core/interpolators/rasterio_interpolator.py index 123f070e..01fed86b 100644 --- a/podpac/core/interpolation/rasterio_interpolator.py +++ b/podpac/core/interpolators/rasterio_interpolator.py @@ -17,7 +17,7 @@ rasterio = None # podac imports -from podpac.core.interpolation.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException +from podpac.core.interpolators.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException from podpac.core.units import UnitsDataArray from podpac.core.coordinates import Coordinates, UniformCoordinates1d, StackedCoordinates from podpac.core.utils import common_doc diff --git a/podpac/core/interpolation/scipy_interpolator.py b/podpac/core/interpolators/scipy_interpolator.py similarity index 99% rename from podpac/core/interpolation/scipy_interpolator.py rename to podpac/core/interpolators/scipy_interpolator.py index 93cc44a0..f85f506d 100644 --- a/podpac/core/interpolation/scipy_interpolator.py +++ b/podpac/core/interpolators/scipy_interpolator.py @@ -16,7 +16,7 @@ scipy = None # podac imports -from podpac.core.interpolation.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException +from podpac.core.interpolators.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException from podpac.core.units import UnitsDataArray from podpac.core.coordinates import Coordinates, UniformCoordinates1d, StackedCoordinates from podpac.core.utils import common_doc diff --git a/podpac/core/interpolation/selector.py b/podpac/core/interpolators/selector.py similarity index 100% rename from podpac/core/interpolation/selector.py rename to podpac/core/interpolators/selector.py diff --git a/podpac/core/interpolation/test/test_interpolation.py b/podpac/core/interpolators/test/test_interpolation.py similarity index 97% rename from podpac/core/interpolation/test/test_interpolation.py rename to podpac/core/interpolators/test/test_interpolation.py index 31aa77b2..a476f49a 100644 --- a/podpac/core/interpolation/test/test_interpolation.py +++ b/podpac/core/interpolators/test/test_interpolation.py @@ -17,11 +17,11 @@ from podpac.core.units import UnitsDataArray from podpac.core.node import Node from podpac.core.coordinates import Coordinates -from podpac.core.interpolation.interpolation_manager import InterpolationException -from podpac.core.interpolation.interpolation import Interpolate, InterpolationMixin +from podpac.core.interpolators.interpolation_manager import InterpolationException +from podpac.core.interpolators.interpolation import Interpolate, InterpolationMixin from podpac.core.data.array_source import Array, ArrayRaw from podpac.core.compositors.tile_compositor import TileCompositorRaw -from podpac.core.interpolation.scipy_interpolator import ScipyGrid +from podpac.core.interpolators.scipy_interpolator import ScipyGrid class TestInterpolationMixin(object): diff --git a/podpac/core/interpolation/test/test_interpolation_manager.py b/podpac/core/interpolators/test/test_interpolation_manager.py similarity index 98% rename from podpac/core/interpolation/test/test_interpolation_manager.py rename to podpac/core/interpolators/test/test_interpolation_manager.py index 54014592..cd502d02 100644 --- a/podpac/core/interpolation/test/test_interpolation_manager.py +++ b/podpac/core/interpolators/test/test_interpolation_manager.py @@ -15,14 +15,14 @@ import podpac from podpac.core.units import UnitsDataArray from podpac.core.coordinates import Coordinates -from podpac.core.interpolation.interpolation_manager import InterpolationManager, InterpolationException -from podpac.core.interpolation.interpolation_manager import ( +from podpac.core.interpolators.interpolation_manager import InterpolationManager, InterpolationException +from podpac.core.interpolators.interpolation_manager import ( INTERPOLATION_METHODS, INTERPOLATION_DEFAULT, INTERPOLATION_METHODS_DICT, ) -from podpac.core.interpolation.interpolator import Interpolator, InterpolatorException -from podpac.core.interpolation.nearest_neighbor_interpolator import NearestNeighbor, NearestPreview +from podpac.core.interpolators.interpolator import Interpolator, InterpolatorException +from podpac.core.interpolators.nearest_neighbor_interpolator import NearestNeighbor, NearestPreview class TestInterpolation(object): diff --git a/podpac/core/interpolation/test/test_interpolator.py b/podpac/core/interpolators/test/test_interpolator.py similarity index 96% rename from podpac/core/interpolation/test/test_interpolator.py rename to podpac/core/interpolators/test/test_interpolator.py index 8e7e3640..8f182406 100644 --- a/podpac/core/interpolation/test/test_interpolator.py +++ b/podpac/core/interpolators/test/test_interpolator.py @@ -9,7 +9,7 @@ import numpy as np from podpac.core.coordinates import Coordinates, clinspace -from podpac.core.interpolation.interpolator import Interpolator +from podpac.core.interpolators.interpolator import Interpolator class TestInterpolator(object): diff --git a/podpac/core/interpolation/test/test_interpolators.py b/podpac/core/interpolators/test/test_interpolators.py similarity index 99% rename from podpac/core/interpolation/test/test_interpolators.py rename to podpac/core/interpolators/test/test_interpolators.py index 2f6b7895..6ba349ef 100644 --- a/podpac/core/interpolation/test/test_interpolators.py +++ b/podpac/core/interpolators/test/test_interpolators.py @@ -15,12 +15,12 @@ from podpac.core.coordinates import Coordinates, clinspace from podpac.core.data.rasterio_source import rasterio from podpac.core.data.datasource import DataSource -from podpac.core.interpolation.interpolation_manager import InterpolationManager, InterpolationException -from podpac.core.interpolation.nearest_neighbor_interpolator import NearestNeighbor, NearestPreview -from podpac.core.interpolation.rasterio_interpolator import RasterioInterpolator -from podpac.core.interpolation.scipy_interpolator import ScipyGrid, ScipyPoint -from podpac.core.interpolation.xarray_interpolator import XarrayInterpolator -from podpac.core.interpolation.interpolation import InterpolationMixin +from podpac.core.interpolators.interpolation_manager import InterpolationManager, InterpolationException +from podpac.core.interpolators.nearest_neighbor_interpolator import NearestNeighbor, NearestPreview +from podpac.core.interpolators.rasterio_interpolator import RasterioInterpolator +from podpac.core.interpolators.scipy_interpolator import ScipyGrid, ScipyPoint +from podpac.core.interpolators.xarray_interpolator import XarrayInterpolator +from podpac.core.interpolators.interpolation import InterpolationMixin class MockArrayDataSource(InterpolationMixin, DataSource): diff --git a/podpac/core/interpolation/test/test_selector.py b/podpac/core/interpolators/test/test_selector.py similarity index 99% rename from podpac/core/interpolation/test/test_selector.py rename to podpac/core/interpolators/test/test_selector.py index 4ebb380a..38ecdcf0 100644 --- a/podpac/core/interpolation/test/test_selector.py +++ b/podpac/core/interpolators/test/test_selector.py @@ -4,7 +4,7 @@ from podpac.core.node import Node from podpac.core.coordinates import Coordinates, clinspace -from podpac.core.interpolation.selector import Selector +from podpac.core.interpolators.selector import Selector class TestSelector(object): diff --git a/podpac/core/interpolation/xarray_interpolator.py b/podpac/core/interpolators/xarray_interpolator.py similarity index 98% rename from podpac/core/interpolation/xarray_interpolator.py rename to podpac/core/interpolators/xarray_interpolator.py index 99c25a09..f911194e 100644 --- a/podpac/core/interpolation/xarray_interpolator.py +++ b/podpac/core/interpolators/xarray_interpolator.py @@ -13,7 +13,7 @@ # podac imports -from podpac.core.interpolation.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException +from podpac.core.interpolators.interpolator import COMMON_INTERPOLATOR_DOCS, Interpolator, InterpolatorException from podpac.core.coordinates import Coordinates, UniformCoordinates1d, StackedCoordinates from podpac.core.utils import common_doc from podpac.core.coordinates.utils import get_timedelta diff --git a/podpac/data.py b/podpac/data.py index ab4127a7..ccbf8584 100644 --- a/podpac/data.py +++ b/podpac/data.py @@ -15,4 +15,4 @@ from podpac.core.data.ogc import WCS from podpac.core.data.ogr import OGR from podpac.core.data.reprojection import ReprojectedSource -from podpac.core.interpolation.interpolation_manager import INTERPOLATION_METHODS +from podpac.core.interpolators.interpolation_manager import INTERPOLATION_METHODS diff --git a/podpac/interpolators.py b/podpac/interpolators.py index 16a7036b..fd4e5cdb 100644 --- a/podpac/interpolators.py +++ b/podpac/interpolators.py @@ -5,9 +5,9 @@ # REMINDER: update api docs (doc/source/user/api.rst) to reflect changes to this file -from podpac.core.interpolation.interpolation import Interpolate, InterpolationMixin -from podpac.core.interpolation.interpolator import Interpolator -from podpac.core.interpolation.nearest_neighbor_interpolator import NearestNeighbor, NearestPreview -from podpac.core.interpolation.rasterio_interpolator import RasterioInterpolator -from podpac.core.interpolation.scipy_interpolator import ScipyGrid, ScipyPoint -from podpac.core.interpolation.xarray_interpolator import XarrayInterpolator +from podpac.core.interpolators.interpolation import Interpolate, InterpolationMixin +from podpac.core.interpolators.interpolator import Interpolator +from podpac.core.interpolators.nearest_neighbor_interpolator import NearestNeighbor, NearestPreview +from podpac.core.interpolators.rasterio_interpolator import RasterioInterpolator +from podpac.core.interpolators.scipy_interpolator import ScipyGrid, ScipyPoint +from podpac.core.interpolators.xarray_interpolator import XarrayInterpolator From 1d1170e880c1e161e57ff85a827aa686beb5f82b Mon Sep 17 00:00:00 2001 From: Clay Foye Date: Wed, 25 Jan 2023 08:37:56 -0500 Subject: [PATCH 6/6] MAINT: Expand/Select Coords refactor --- doc/source/api.rst | 4 +- podpac/algorithms.py | 4 +- podpac/core/algorithms/coord_select.py | 6 +-- .../core/algorithms/test/test_coord_select.py | 38 +++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/doc/source/api.rst b/doc/source/api.rst index a4185e26..ecac9332 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -157,8 +157,8 @@ Split/Apply/Combine nodes with algorithms :toctree: api/ :template: class.rst - podpac.algorithms.ExpandCoordinates - podpac.algorithms.SelectCoordinates + podpac.algorithms.CoordinatesExpander + podpac.algorithms.CoordinatesSelector .. rubric:: Signal Processing diff --git a/podpac/algorithms.py b/podpac/algorithms.py index 716918d5..a767b5ab 100644 --- a/podpac/algorithms.py +++ b/podpac/algorithms.py @@ -24,8 +24,8 @@ ResampleReduce, ) from podpac.core.algorithms.coord_select import ( - ExpandCoordinates, - SelectCoordinates, + CoordinatesExpander, + CoordinatesSelector, YearSubstituteCoordinates, TransformTimeUnits, ) diff --git a/podpac/core/algorithms/coord_select.py b/podpac/core/algorithms/coord_select.py index ed3f1e52..66ca8373 100644 --- a/podpac/core/algorithms/coord_select.py +++ b/podpac/core/algorithms/coord_select.py @@ -99,7 +99,7 @@ def _eval(self, coordinates, output=None, _selector=None): return output -class ExpandCoordinates(ModifyCoordinates): +class CoordinatesExpander(ModifyCoordinates): """Evaluate a source node with expanded coordinates. This is normally used in conjunction with a reduce operation @@ -185,7 +185,7 @@ def get_modified_coordinates1d(self, coords, dim): return ArrayCoordinates1d(np.concatenate([c.coordinates for c in cs]), **coords1d.properties) -class SelectCoordinates(ModifyCoordinates): +class CoordinatesSelector(ModifyCoordinates): """Evaluate a source node with select coordinates. While this is simple to do when @@ -234,7 +234,7 @@ def get_modified_coordinates1d(self, coords, dim): available_coordinates = self.coordinates_source.find_coordinates() if len(available_coordinates) != 1: raise ValueError( - "SelectCoordinates Node cannot determine the step size between bounds for dimension" + "CoordinatesSelector Node cannot determine the step size between bounds for dimension" + "{} because source node (source.find_coordinates()) has {} different coordinates.".format( dim, len(available_coordinates) ) diff --git a/podpac/core/algorithms/test/test_coord_select.py b/podpac/core/algorithms/test/test_coord_select.py index d10b811e..5c01c722 100644 --- a/podpac/core/algorithms/test/test_coord_select.py +++ b/podpac/core/algorithms/test/test_coord_select.py @@ -8,7 +8,7 @@ from podpac.core.data.datasource import DataSource from podpac.core.data.array_source import Array from podpac.core.algorithms.utility import Arange -from podpac.core.algorithms.coord_select import ExpandCoordinates, SelectCoordinates, YearSubstituteCoordinates +from podpac.core.algorithms.coord_select import CoordinatesExpander, CoordinatesSelector, YearSubstituteCoordinates def setup_module(module): @@ -34,68 +34,68 @@ def get_data(self, coordinates, slc): # TODO add assertions to tests -class TestExpandCoordinates(object): +class TestCoordinatesExpander(object): def test_no_expansion(self): - node = ExpandCoordinates(source=Arange()) + node = CoordinatesExpander(source=Arange()) o = node.eval(COORDS) def test_time_expansion(self): - node = ExpandCoordinates(source=Arange(), time=("-5,D", "0,D", "1,D")) + node = CoordinatesExpander(source=Arange(), time=("-5,D", "0,D", "1,D")) o = node.eval(COORDS) def test_spatial_expansion(self): - node = ExpandCoordinates(source=Arange(), lat=(-1, 1, 0.1)) + node = CoordinatesExpander(source=Arange(), lat=(-1, 1, 0.1)) o = node.eval(COORDS) def test_time_expansion_implicit_coordinates(self): - node = ExpandCoordinates(source=MyDataSource(), time=("-15,D", "0,D")) + node = CoordinatesExpander(source=MyDataSource(), time=("-15,D", "0,D")) o = node.eval(COORDS) - node = ExpandCoordinates(source=MyDataSource(), time=("-15,Y", "0,D", "1,Y")) + node = CoordinatesExpander(source=MyDataSource(), time=("-15,Y", "0,D", "1,Y")) o = node.eval(COORDS) - node = ExpandCoordinates(source=MyDataSource(), time=("-5,M", "0,D", "1,M")) + node = CoordinatesExpander(source=MyDataSource(), time=("-5,M", "0,D", "1,M")) o = node.eval(COORDS) # Behaviour a little strange on these? - node = ExpandCoordinates(source=MyDataSource(), time=("-15,Y", "0,D", "4,Y")) + node = CoordinatesExpander(source=MyDataSource(), time=("-15,Y", "0,D", "4,Y")) o = node.eval(COORDS) - node = ExpandCoordinates(source=MyDataSource(), time=("-15,Y", "0,D", "13,M")) + node = CoordinatesExpander(source=MyDataSource(), time=("-15,Y", "0,D", "13,M")) o = node.eval(COORDS) - node = ExpandCoordinates(source=MyDataSource(), time=("-144,M", "0,D", "13,M")) + node = CoordinatesExpander(source=MyDataSource(), time=("-144,M", "0,D", "13,M")) o = node.eval(COORDS) def test_spatial_expansion_ultiple_outputs(self): multi = Array(source=np.random.random(COORDS.shape + (2,)), coordinates=COORDS, outputs=["a", "b"]) - node = ExpandCoordinates(source=multi, lat=(-1, 1, 0.1)) + node = CoordinatesExpander(source=multi, lat=(-1, 1, 0.1)) o = node.eval(COORDS) -class TestSelectCoordinates(object): +class TestCoordinatesSelector(object): def test_no_expansion(self): - node = SelectCoordinates(source=Arange()) + node = CoordinatesSelector(source=Arange()) o = node.eval(COORDS) def test_time_selection(self): - node = SelectCoordinates(source=Arange(), time=("2017-08-01", "2017-09-30", "1,D")) + node = CoordinatesSelector(source=Arange(), time=("2017-08-01", "2017-09-30", "1,D")) o = node.eval(COORDS) def test_spatial_selection(self): - node = SelectCoordinates(source=Arange(), lat=(46, 56, 1)) + node = CoordinatesSelector(source=Arange(), lat=(46, 56, 1)) o = node.eval(COORDS) def test_time_selection_implicit_coordinates(self): - node = SelectCoordinates(source=MyDataSource(), time=("2011-01-01", "2011-02-01")) + node = CoordinatesSelector(source=MyDataSource(), time=("2011-01-01", "2011-02-01")) o = node.eval(COORDS) - node = SelectCoordinates(source=MyDataSource(), time=("2011-01-01", "2017-01-01", "1,Y")) + node = CoordinatesSelector(source=MyDataSource(), time=("2011-01-01", "2017-01-01", "1,Y")) o = node.eval(COORDS) def test_spatial_selection_multiple_outputs(self): multi = Array(source=np.random.random(COORDS.shape + (2,)), coordinates=COORDS, outputs=["a", "b"]) - node = SelectCoordinates(source=multi, lat=(46, 56, 1)) + node = CoordinatesSelector(source=multi, lat=(46, 56, 1)) o = node.eval(COORDS)