@@ -306,7 +306,7 @@ async def test_get_tree_cover_loss_by_drivers_as_csv(
306
306
307
307
assert (
308
308
response .content
309
- == b'"tsc_tree_cover_loss_drivers__driver","area__ha"\r \n "Permanent agriculture",10.0\r \n "Hard commodities",12.0\r \n "Shifting cultivation",7.0\r \n "Forest management",93.4\r \n "Wildfires",42.0\r \n "Settlements and infrastructure",13.562\r \n "Other natural disturbances",6.0\r \n '
309
+ == b'"umd_tree_cover_loss__year"," tsc_tree_cover_loss_drivers__driver","area__ha"\r \n "2001"," Permanent agriculture",10.0\r \n "2001"," Hard commodities",12.0\r \n "2001"," Shifting cultivation",7.0\r \n "2001"," Forest management",93.4\r \n "2001"," Wildfires",42.0\r \n "2001"," Settlements and infrastructure",13.562\r \n "2001", "Other natural disturbances",6.0\r \n '
310
310
)
311
311
312
312
@@ -333,7 +333,7 @@ async def test_compute_tree_cover_loss_by_driver(geostore):
333
333
mock_query_dataset_json .assert_awaited_once_with (
334
334
"umd_tree_cover_loss" ,
335
335
"v1.8" ,
336
- "SELECT SUM(area__ha) FROM data WHERE umd_tree_cover_density_2000__threshold >= 30 GROUP BY tsc_tree_cover_loss_drivers__driver" ,
336
+ "SELECT SUM(area__ha) FROM data WHERE umd_tree_cover_density_2000__threshold >= 30 GROUP BY umd_tree_cover_loss__year, tsc_tree_cover_loss_drivers__driver" ,
337
337
geostore_common ,
338
338
DEFAULT_LAND_DATASET_VERSIONS | {"umd_tree_cover_loss" : "v1.8" },
339
339
)
@@ -376,30 +376,37 @@ async def test_compute_tree_cover_loss_by_driver_error(geostore):
376
376
377
377
MOCK_RESULT = [
378
378
{
379
+ "umd_tree_cover_loss__year" : "2001" ,
379
380
"tsc_tree_cover_loss_drivers__driver" : "Permanent agriculture" ,
380
381
"area__ha" : 10 ,
381
382
},
382
383
{
384
+ "umd_tree_cover_loss__year" : "2001" ,
383
385
"tsc_tree_cover_loss_drivers__driver" : "Hard commodities" ,
384
386
"area__ha" : 12 ,
385
387
},
386
388
{
389
+ "umd_tree_cover_loss__year" : "2001" ,
387
390
"tsc_tree_cover_loss_drivers__driver" : "Shifting cultivation" ,
388
391
"area__ha" : 7 ,
389
392
},
390
393
{
394
+ "umd_tree_cover_loss__year" : "2001" ,
391
395
"tsc_tree_cover_loss_drivers__driver" : "Forest management" ,
392
396
"area__ha" : 93.4 ,
393
397
},
394
398
{
399
+ "umd_tree_cover_loss__year" : "2001" ,
395
400
"tsc_tree_cover_loss_drivers__driver" : "Wildfires" ,
396
401
"area__ha" : 42 ,
397
402
},
398
403
{
404
+ "umd_tree_cover_loss__year" : "2001" ,
399
405
"tsc_tree_cover_loss_drivers__driver" : "Settlements and infrastructure" ,
400
406
"area__ha" : 13.562 ,
401
407
},
402
408
{
409
+ "umd_tree_cover_loss__year" : "2001" ,
403
410
"tsc_tree_cover_loss_drivers__driver" : "Other natural disturbances" ,
404
411
"area__ha" : 6 ,
405
412
},
@@ -409,14 +416,27 @@ async def test_compute_tree_cover_loss_by_driver_error(geostore):
409
416
MOCK_RESOURCE = {
410
417
"status" : "saved" ,
411
418
"message" : None ,
412
- "tree_cover_loss_by_driver" : {
413
- "Permanent agriculture" : 10.0 ,
414
- "Hard commodities" : 12.0 ,
415
- "Shifting cultivation" : 7.0 ,
416
- "Forest management" : 93.4 ,
417
- "Wildfires" : 42.0 ,
418
- "Settlements and infrastructure" : 13.562 ,
419
- "Other natural disturbances" : 6.0 ,
419
+ "result" : {
420
+ "tree_cover_loss_by_driver" : {
421
+ "Permanent agriculture" : 10.0 ,
422
+ "Hard commodities" : 12.0 ,
423
+ "Shifting cultivation" : 7.0 ,
424
+ "Forest management" : 93.4 ,
425
+ "Wildfires" : 42.0 ,
426
+ "Settlements and infrastructure" : 13.562 ,
427
+ "Other natural disturbances" : 6.0 ,
428
+ },
429
+ "yearly_tree_cover_loss_by_driver" : {
430
+ "2001" : {
431
+ "Permanent agriculture" : 10.0 ,
432
+ "Hard commodities" : 12.0 ,
433
+ "Shifting cultivation" : 7.0 ,
434
+ "Forest management" : 93.4 ,
435
+ "Wildfires" : 42.0 ,
436
+ "Settlements and infrastructure" : 13.562 ,
437
+ "Other natural disturbances" : 6.0 ,
438
+ }
439
+ },
420
440
},
421
441
"metadata" : {
422
442
"geostore_id" : "" ,
0 commit comments