Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create hourly product in moorings products pipeline #206

Merged
merged 11 commits into from
Feb 24, 2020
14 changes: 11 additions & 3 deletions test_aodndata/moorings/getFeature_old_products.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@
"properties": {
"url": "IMOS/ANMN/NRS/NRSROT/aggregated_timeseries/IMOS_ANMN-NRS_TZ_20081120_NRSROT_FV01_DOX1-2-aggregated-timeseries_END-20190523_C-20190819.nc"
}
},
{
"type": "Feature",
"id": "moorings_all_map.fid--44e8da32_16d0014d48c_7b20",
"geometry": null,
"properties": {
"url": "IMOS/ANMN/NRS/NRSROT/hourly_timeseries/IMOS_ANMN-NRS_STZ_20081120_NRSROT_FV02_hourly-timeseries_END-20190523_C-20191010.nc"
}
}
],
"totalFeatures": 3,
"numberMatched": 3,
"numberReturned": 3,
"totalFeatures": 4,
"numberMatched": 4,
"numberReturned": 4,
"timeStamp": "2019-12-05T06:33:53.380Z",
"crs": null
}
39 changes: 25 additions & 14 deletions test_aodndata/moorings/test_mooringsProductsHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,44 @@ def test_good_manifest(self, mock_webfeatureservice):
self.assertCountEqual(INPUT_FILE_COLLECTION.get_attribute_list('dest_path'),
handler.input_file_collection.get_attribute_list('dest_path')
)
self.assertEqual(len(handler.file_collection), 7)

# check new product files
expected_new_products = {'TEMP-aggregated-timeseries',
'PSAL-aggregated-timeseries',
'CHLF-aggregated-timeseries',
'hourly-timeseries',
'hourly-timeseries-including-non-QC'
mhidas marked this conversation as resolved.
Show resolved Hide resolved
}
published_files = handler.file_collection.filter_by_attribute_id('publish_type',
PipelineFilePublishType.HARVEST_UPLOAD)
self.assertEqual(len(published_files), len(expected_new_products))
for f in published_files:
}
expected_deleted_products = {'TEMP-aggregated-timeseries',
'PSAL-aggregated-timeseries',
'hourly-timeseries',
}

self.assertEqual(len(handler.file_collection), len(expected_new_products) + len(expected_deleted_products))
for f in handler.file_collection:
self.assertTrue(f.is_harvested and f.is_stored)
published_products = {get_product_type(f.name) for f in published_files}

# check new product files
published_files = (handler.file_collection
.filter_by_attribute_id('publish_type', PipelineFilePublishType.HARVEST_UPLOAD)
.get_attribute_list('name')
)
self.assertEqual(len(published_files), len(expected_new_products))
published_products = {get_product_type(f) for f in published_files}
self.assertSetEqual(published_products, expected_new_products)

# check deletion of previous versions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part can also be a separate one

expected_deleted_products = {'TEMP-aggregated-timeseries', 'PSAL-aggregated-timeseries'}
deleted_files = handler.file_collection.filter_by_attribute_id('publish_type',
PipelineFilePublishType.DELETE_UNHARVEST)
deleted_files = (handler.file_collection
.filter_by_attribute_id('publish_type', PipelineFilePublishType.DELETE_UNHARVEST)
.get_attribute_list('name')
)
self.assertEqual(len(deleted_files), len(expected_deleted_products))
for f in deleted_files:
self.assertTrue(f.is_harvested and f.is_stored)
deleted_products = {get_product_type(f.name) for f in deleted_files}
deleted_products = {get_product_type(f) for f in deleted_files}
self.assertSetEqual(deleted_products, expected_deleted_products)

# published and deleted files should never have the same name!
self.assertEqual(set(), set(published_files) & set(deleted_files))

# check input files excluded from the products
self.assertEqual(len(handler.excluded_files), 1)

def test_publish_product_nc(self):
Expand Down