-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #316 from ecmwf/develop
v 1.0.26
- Loading branch information
Showing
4 changed files
with
146 additions
and
10 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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.0.25" | ||
__version__ = "1.0.26" |
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,69 @@ | ||
import pandas as pd | ||
import pytest | ||
|
||
from polytope_feature.polytope import Polytope, Request | ||
from polytope_feature.shapes import Box, Select, Span | ||
|
||
|
||
class TestSlicingFDBDatacube: | ||
def setup_method(self, method): | ||
# Create a dataarray with 3 labelled axes using different index types | ||
self.options = { | ||
"axis_config": [ | ||
{"axis_name": "step", "transformations": [{"name": "type_change", "type": "int"}]}, | ||
{"axis_name": "date", "transformations": [{"name": "type_change", "type": "date"}]}, | ||
{"axis_name": "time", "transformations": [{"name": "type_change", "type": "time"}]}, | ||
{ | ||
"axis_name": "values", | ||
"transformations": [ | ||
{"name": "mapper", "type": "octahedral", "resolution": 1280, "axes": ["latitude", "longitude"]} | ||
], | ||
}, | ||
{"axis_name": "latitude", "transformations": [{"name": "reverse", "is_reverse": True}]}, | ||
{"axis_name": "longitude", "transformations": [{"name": "cyclic", "range": [0, 360]}]}, | ||
], | ||
"pre_path": {"class": "od", "expver": "0001", "levtype": "sfc", "stream": "oper", "type": "fc"}, | ||
"compressed_axes_config": [ | ||
"longitude", | ||
"latitude", | ||
"levtype", | ||
"step", | ||
"date", | ||
"domain", | ||
"expver", | ||
"param", | ||
"class", | ||
"stream", | ||
"type", | ||
], | ||
} | ||
|
||
# Testing different shapes | ||
@pytest.mark.fdb | ||
def test_fdb_datacube(self): | ||
import pygribjump as gj | ||
|
||
request = Request( | ||
Select("step", [0]), | ||
Select("levtype", ["sfc"]), | ||
# Select("date", [pd.Timestamp("20240118")]), | ||
Select("time", [pd.Timedelta("00:00:00")]), | ||
# Span("time", [pd.Timedelta("00:00:00")]), | ||
Span("date", pd.Timestamp("20240118"), pd.Timestamp("20240119")), | ||
Select("domain", ["g"]), | ||
Select("expver", ["0001"]), | ||
Select("param", ["167"]), | ||
Select("class", ["od"]), | ||
Select("stream", ["oper"]), | ||
Select("type", ["fc"]), | ||
Box(["latitude", "longitude"], [0, 0], [0.2, 0.2]), | ||
) | ||
self.fdbdatacube = gj.GribJump() | ||
self.API = Polytope( | ||
datacube=self.fdbdatacube, | ||
options=self.options, | ||
) | ||
result = self.API.retrieve(request) | ||
result.pprint() | ||
assert len(result.leaves) == 3 | ||
assert len(result.leaves[0].result) == 3 |