File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -505,8 +505,14 @@ def from_dict(cls, metadata_dict):
505
505
min_key = SpatialKey (** bounds_dict ['minKey' ])
506
506
max_key = SpatialKey (** bounds_dict ['maxKey' ])
507
507
else :
508
- min_key = SpaceTimeKey (** bounds_dict ['minKey' ])
509
- max_key = SpaceTimeKey (** bounds_dict ['maxKey' ])
508
+ scala_min_key = bounds_dict ['minKey' ]
509
+ scala_max_key = bounds_dict ['maxKey' ]
510
+
511
+ scala_min_key ['instant' ] = datetime .datetime .utcfromtimestamp (scala_min_key ['instant' ] / 1000 )
512
+ scala_max_key ['instant' ] = datetime .datetime .utcfromtimestamp (scala_max_key ['instant' ] / 1000 )
513
+
514
+ min_key = SpaceTimeKey (** scala_min_key )
515
+ max_key = SpaceTimeKey (** scala_max_key )
510
516
511
517
bounds = Bounds (min_key , max_key )
512
518
extent = Extent (** metadata_dict ['extent' ])
Original file line number Diff line number Diff line change @@ -63,6 +63,16 @@ def tearDown(self):
63
63
yield
64
64
BaseTestClass .pysc ._gateway .close ()
65
65
66
+ # This test should be moved to a more appropriate file once more spatial-temporal
67
+ # tests are made.
68
+ def test_spatial_metadata (self ):
69
+ metadata = self .raster_rdd .collect_metadata ()
70
+ min_key = metadata .bounds .minKey
71
+ max_key = metadata .bounds .maxKey
72
+
73
+ self .assertEqual (min_key .instant , self .time )
74
+ self .assertEqual (max_key .instant , self .time )
75
+
66
76
def test_to_spatial_raster_layer (self ):
67
77
actual = [k for k , v in self .raster_rdd .to_spatial_layer ().to_numpy_rdd ().collect ()]
68
78
You can’t perform that action at this time.
0 commit comments