@@ -47,7 +47,7 @@ class ESGFException(ClefException):
47
47
pass
48
48
49
49
50
- def esgf_query (query = None , fields = [], otype = 'File' , limit = 20000 , offset = 0 , distrib = True , replica = False , latest = None , ** kwargs ):
50
+ def esgf_query (query = None , fields = [], otype = 'File' , limit = 10000 , offset = 0 , distrib = True , replica = False , latest = None , ** kwargs ):
51
51
"""Search the ESGF
52
52
53
53
Searches the ESGF using its `API
@@ -79,16 +79,16 @@ def esgf_query(query=None, fields=[], otype='File', limit=20000, offset=0, dist
79
79
'query' : query ,
80
80
'fields' : fields ,
81
81
'offset' : offset ,
82
- # 'limit': 20000 ,
82
+ 'limit' : limit ,
83
83
'distrib' : distrib ,
84
84
'replica' : replica ,
85
85
'latest' : latest ,
86
86
'type' : otype ,
87
87
'format' : 'application/solr+json' ,
88
88
}
89
89
params .update (kwargs )
90
- if otype == 'Dataset' : params . pop ( 'type' )
91
- print ( f"Params: { params } " )
90
+ if otype == 'Dataset' :
91
+ params . pop ( 'type' )
92
92
93
93
try :
94
94
#r = requests.get('https://esgf-node.llnl.gov/esg-search/search',
@@ -189,6 +189,7 @@ def find_checksum_id(query, **kwargs):
189
189
records .append (doc )
190
190
else :
191
191
nosums .append (doc )
192
+ print (doc )
192
193
193
194
record_list = [
194
195
(doc ['checksum' ][0 ],
@@ -215,7 +216,7 @@ def find_checksum_id(query, **kwargs):
215
216
column ('score' , Float ),
216
217
name = 'esgf_table'
217
218
).data (record_list )
218
- print ( record_list )
219
+ nocksum = False
219
220
if record_list == []:
220
221
table = sqlalvalues (
221
222
column ('checksum' , String ),
@@ -226,9 +227,9 @@ def find_checksum_id(query, **kwargs):
226
227
column ('score' , Float ),
227
228
name = 'esgf_table'
228
229
).data (nosums_list )
230
+ nocksum = True
229
231
230
- print ('this is ok' )
231
- return table
232
+ return table , nocksum
232
233
233
234
234
235
def match_query (session , query , latest = None , ** kwargs ):
@@ -247,7 +248,7 @@ def match_query(session, query, latest=None, **kwargs):
247
248
Returns:
248
249
Joined result of :class:`clef.model.Path` and :func:`find_checksum_id`
249
250
"""
250
- checksum_table = find_checksum_id (query , latest = latest , ** kwargs )
251
+ checksum_table , nocksum = find_checksum_id (query , latest = latest , ** kwargs )
251
252
252
253
if latest is True :
253
254
# Exact match on checksum
@@ -261,10 +262,13 @@ def match_query(session, query, latest=None, **kwargs):
261
262
#return values.outerjoin(Path, Path.path.like('%/'+values.c.title))
262
263
#return values.outerjoin(Path, func.regexp_replace(Path.path, '^.*/', '') == values.c.title)
263
264
matches = checksum_table .join (Path , func .regexp_replace (Path .path , '^.*/' , '' ) == checksum_table .c .title )
264
- if checksum_table .c .checksum .contains ("NA" ):
265
- matches = (checksum_table .join (C6Dataset , C6 .Dataset .dataset_id == checksum_table .c .dataset_id ))
265
+
266
+ if nocksum is True :
267
+ if project == 'CMIP6' :
268
+ matches = (checksum_table .join (C6Dataset , C6 .Dataset .dataset_id == checksum_table .c .dataset_id ))
266
269
return matches
267
270
271
+
268
272
def find_local_path (session , subq ):
269
273
"""Find the filesystem paths of ESGF matches
270
274
0 commit comments