Commit dff196dd authored by PIOLLE's avatar PIOLLE
Browse files

add trajectory subset in unit tests

parent 9e9f3639
...@@ -99,4 +99,4 @@ encoding: ...@@ -99,4 +99,4 @@ encoding:
time: time:
dtype: int32 dtype: int32
units: 'seconds since 1981-01-01 00:00:00' units: 'seconds since 1981-01-01 00:00:00.000000Z'
...@@ -45,7 +45,6 @@ setup( ...@@ -45,7 +45,6 @@ setup(
install_requires=[ install_requires=[
'netCDF4', 'netCDF4',
'xarray>=0.15', 'xarray>=0.15',
'cftime',
'Shapely>=1.2.18', 'Shapely>=1.2.18',
'scipy', 'scipy',
'pyyaml' 'pyyaml'
......
...@@ -302,6 +302,14 @@ class Checker(): ...@@ -302,6 +302,14 @@ class Checker():
subset = featureobj.extract(index={'lat': slice(j0, j1, 1), subset = featureobj.extract(index={'lat': slice(j0, j1, 1),
'lon': slice(i0, i1, 1)}) 'lon': slice(i0, i1, 1)})
elif featureobj.__class__.__name__ in ['Trajectory']:
times = featureobj.geodims['time']
width = min(times // 2, 5)
r0, r1 = times // 2 - width, times // 2 + width
print("Subset ")
print("time : ", r0, r1)
subset = featureobj.extract(index={'time': slice(r0, r1, 1)})
self.assertIsInstance(subset, featureobj.__class__) self.assertIsInstance(subset, featureobj.__class__)
return subset return subset
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment