@@ -26,7 +26,7 @@ def test_full_dataset_processing(self, cmr_dataset):
26
26
assert cmr_dataset .limitations == "None"
27
27
assert cmr_dataset .format == "application/vnd.nasa.cmr.umm+json"
28
28
assert cmr_dataset .temporal_extent == "" # No SingleDateTimes in example
29
- assert cmr_dataset .intended_use == "exploration " # ProcessingLevel is 4
29
+ assert cmr_dataset .intended_use == "Path A " # ProcessingLevel is 4
30
30
assert cmr_dataset .source_link == "https://doi.org/10.7927/H4NK3BZJ"
31
31
assert "Long temporal extent" in cmr_dataset .strengths
32
32
assert "No recent data available" in cmr_dataset .weaknesses
@@ -180,6 +180,130 @@ def test_non_global_coverage(self):
180
180
dataset = CmrDataset (data )
181
181
assert dataset .geographic_coverage == ""
182
182
183
+ def test_spatial_resolution_varies (self ):
184
+ """Test spatial resolution when it varies."""
185
+ data = {
186
+ "umm" : {
187
+ "SpatialExtent" : {
188
+ "HorizontalSpatialDomain" : {
189
+ "ResolutionAndCoordinateSystem" : {"HorizontalDataResolution" : {"VariesResolution" : "Varies" }}
190
+ }
191
+ }
192
+ }
193
+ }
194
+ dataset = CmrDataset (data )
195
+ assert dataset .spatial_resolution == "Varies"
196
+
197
+ def test_spatial_resolution_gridded_range (self ):
198
+ """Test spatial resolution with gridded range resolutions."""
199
+ data = {
200
+ "umm" : {
201
+ "SpatialExtent" : {
202
+ "HorizontalSpatialDomain" : {
203
+ "ResolutionAndCoordinateSystem" : {
204
+ "HorizontalDataResolution" : {
205
+ "GriddedRangeResolutions" : [
206
+ {
207
+ "MinimumXDimension" : 5.0 ,
208
+ "MinimumYDimension" : 5.0 ,
209
+ "MaximumXDimension" : 50.0 ,
210
+ "MaximumYDimension" : 40.0 ,
211
+ "Unit" : "Kilometers" ,
212
+ }
213
+ ]
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ dataset = CmrDataset (data )
221
+ assert dataset .spatial_resolution == "50.0 kilometers"
222
+
223
+ def test_spatial_resolution_gridded (self ):
224
+ """Test spatial resolution with gridded resolutions."""
225
+ data = {
226
+ "umm" : {
227
+ "SpatialExtent" : {
228
+ "HorizontalSpatialDomain" : {
229
+ "ResolutionAndCoordinateSystem" : {
230
+ "HorizontalDataResolution" : {
231
+ "GriddedResolutions" : [{"XDimension" : 30.0 , "YDimension" : 30.0 , "Unit" : "Meters" }]
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+ dataset = CmrDataset (data )
239
+ assert dataset .spatial_resolution == "30.0 meters"
240
+
241
+ def test_spatial_resolution_generic (self ):
242
+ """Test spatial resolution with generic resolutions."""
243
+ data = {
244
+ "umm" : {
245
+ "SpatialExtent" : {
246
+ "HorizontalSpatialDomain" : {
247
+ "ResolutionAndCoordinateSystem" : {
248
+ "HorizontalDataResolution" : {
249
+ "GenericResolutions" : [{"XDimension" : 10.0 , "YDimension" : 10.0 , "Unit" : "Kilometers" }]
250
+ }
251
+ }
252
+ }
253
+ }
254
+ }
255
+ }
256
+ dataset = CmrDataset (data )
257
+ assert dataset .spatial_resolution == "10.0 kilometers"
258
+
259
+ def test_spatial_resolution_missing (self ):
260
+ """Test spatial resolution when resolution data is missing."""
261
+ data = {"umm" : {"SpatialExtent" : {"HorizontalSpatialDomain" : {"ResolutionAndCoordinateSystem" : {}}}}}
262
+ dataset = CmrDataset (data )
263
+ assert dataset .spatial_resolution == ""
264
+
265
+ def test_spatial_resolution_different_dimensions (self ):
266
+ """Test spatial resolution when X and Y dimensions differ."""
267
+ data = {
268
+ "umm" : {
269
+ "SpatialExtent" : {
270
+ "HorizontalSpatialDomain" : {
271
+ "ResolutionAndCoordinateSystem" : {
272
+ "HorizontalDataResolution" : {
273
+ "GriddedResolutions" : [{"XDimension" : 30.0 , "YDimension" : 40.0 , "Unit" : "Meters" }]
274
+ }
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
280
+ dataset = CmrDataset (data )
281
+ assert dataset .spatial_resolution == "40.0 meters"
282
+
283
+ def test_spatial_resolution_incomplete_data (self ):
284
+ """Test spatial resolution with incomplete resolution data."""
285
+ data = {
286
+ "umm" : {
287
+ "SpatialExtent" : {
288
+ "HorizontalSpatialDomain" : {
289
+ "ResolutionAndCoordinateSystem" : {
290
+ "HorizontalDataResolution" : {
291
+ "GriddedResolutions" : [
292
+ {
293
+ "XDimension" : 30.0 ,
294
+ # Missing YDimension
295
+ "Unit" : "Meters" ,
296
+ }
297
+ ]
298
+ }
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ dataset = CmrDataset (data )
305
+ assert dataset .spatial_resolution == ""
306
+
183
307
184
308
class TestDownloadProcessing :
185
309
"""Unit tests for download information processing"""
0 commit comments