11
11
from tqdm import tqdm
12
12
import hashlib
13
13
import json
14
+ import logging
14
15
15
16
from facet_scanner .collection_handlers .base import CollectionHandler
16
17
from facet_scanner .collection_handlers .utils import CatalogueDatasets
17
18
from facet_scanner .utils import parse_key
18
19
from tag_scanner .tagger import ProcessDatasets
19
20
21
+ from facet_scanner import logstream
22
+
23
+ logger = logging .getLogger (__name__ )
24
+ logger .addHandler (logstream )
25
+ logger .propagate = False
26
+
20
27
def nested_get (key_list , input_dict , default = None ):
21
28
"""
22
29
Takes an iterable of keys and returns none if not found or the value
@@ -113,8 +120,11 @@ def get_facets(self, path):
113
120
:return: Dict Facet:value pairs
114
121
"""
115
122
123
+ logger .debug ('Getting facets for CCI-type path' )
124
+
116
125
tagged_dataset = self .pds .get_file_tags (path )
117
126
127
+ logger .debug ('Translating tagging code to facet map' )
118
128
# Translate between output from tagging code to map to named facets
119
129
mapped_facets = {}
120
130
for tag_name , tag_value in tagged_dataset .labels .items ():
@@ -128,6 +138,7 @@ def get_facets(self, path):
128
138
if tag_name == facet and tag_name_mapping is None :
129
139
mapped_facets [facet ] = tag_value
130
140
141
+ logger .debug ('Obtaining moles record metadata' )
131
142
# Get MOLES catalogue
132
143
moles_info = self .catalogue .get_moles_record_metadata (path )
133
144
@@ -137,6 +148,7 @@ def get_facets(self, path):
137
148
if moles_info :
138
149
mapped_facets ['datasetId' ] = moles_info ['url' ].split ('uuid/' )[- 1 ]
139
150
151
+ logger .debug ('Completed facet mapping' )
140
152
return mapped_facets
141
153
142
154
@staticmethod
@@ -256,7 +268,6 @@ def _get_collection_variables(self, results, file_index):
256
268
257
269
if values :
258
270
ids = [x ['key' ] for x in values ]
259
- print (ids )
260
271
261
272
# Sample 1 netCDF file from each DRS
262
273
for id in ids :
0 commit comments