-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new point examples of date ranges
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import pandas as pd | ||
import pytest | ||
|
||
from polytope.datacube.backends.fdb import FDBDatacube | ||
from polytope.engine.hullslicer import HullSlicer | ||
from polytope.polytope import Polytope, Request | ||
from polytope.shapes import Select, Span | ||
|
||
|
||
class TestSlicingFDBDatacube: | ||
def setup_method(self, method): | ||
# Create a dataarray with 3 labelled axes using different index types | ||
self.options = { | ||
"values": { | ||
"transformation": {"mapper": {"type": "regular", "resolution": 30, "axes": ["latitude", "longitude"]}} | ||
}, | ||
"date": {"transformation": {"merge": {"with": "time", "linkers": ["T", "00"]}}}, | ||
"step": {"transformation": {"type_change": "int"}}, | ||
} | ||
self.config = {"class": "ea", "expver": "0001", "levtype": "pl", "step": 0} | ||
self.fdbdatacube = FDBDatacube(self.config, axis_options=self.options) | ||
self.slicer = HullSlicer() | ||
self.API = Polytope(datacube=self.fdbdatacube, engine=self.slicer, axis_options=self.options) | ||
|
||
# Testing different shapes | ||
@pytest.mark.skip(reason="can't install fdb branch on CI") | ||
def test_fdb_datacube(self): | ||
request = Request( | ||
Select("step", [0]), | ||
Select("levtype", ["pl"]), | ||
Span("date", pd.Timestamp("20170101T120000"), pd.Timestamp("20170102T120000")), | ||
Select("domain", ["g"]), | ||
Select("expver", ["0001"]), | ||
Select("param", ["129"]), | ||
Select("class", ["ea"]), | ||
Select("stream", ["enda"]), | ||
Select("type", ["an"]), | ||
Select("latitude", [0]), | ||
Select("longitude", [0]), | ||
Select("levelist", ["500", "850"]), | ||
Select("number", ["0"]), | ||
) | ||
result = self.API.retrieve(request) | ||
result.pprint() | ||
assert len(result.leaves) == 6 |