@@ -47,7 +47,7 @@ class ESGFException(ClefException):
4747 pass
4848
4949
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 ):
5151 """Search the ESGF
5252
5353 Searches the ESGF using its `API
@@ -79,16 +79,16 @@ def esgf_query(query=None, fields=[], otype='File', limit=20000, offset=0, dist
7979 'query' : query ,
8080 'fields' : fields ,
8181 'offset' : offset ,
82- # 'limit': 20000 ,
82+ 'limit' : limit ,
8383 'distrib' : distrib ,
8484 'replica' : replica ,
8585 'latest' : latest ,
8686 'type' : otype ,
8787 'format' : 'application/solr+json' ,
8888 }
8989 params .update (kwargs )
90- if otype == 'Dataset' : params . pop ( 'type' )
91- print ( f"Params: { params } " )
90+ if otype == 'Dataset' :
91+ params . pop ( 'type' )
9292
9393 try :
9494 #r = requests.get('https://esgf-node.llnl.gov/esg-search/search',
@@ -189,6 +189,7 @@ def find_checksum_id(query, **kwargs):
189189 records .append (doc )
190190 else :
191191 nosums .append (doc )
192+ print (doc )
192193
193194 record_list = [
194195 (doc ['checksum' ][0 ],
@@ -215,7 +216,7 @@ def find_checksum_id(query, **kwargs):
215216 column ('score' , Float ),
216217 name = 'esgf_table'
217218 ).data (record_list )
218- print ( record_list )
219+ nocksum = False
219220 if record_list == []:
220221 table = sqlalvalues (
221222 column ('checksum' , String ),
@@ -226,9 +227,9 @@ def find_checksum_id(query, **kwargs):
226227 column ('score' , Float ),
227228 name = 'esgf_table'
228229 ).data (nosums_list )
230+ nocksum = True
229231
230- print ('this is ok' )
231- return table
232+ return table , nocksum
232233
233234
234235def match_query (session , query , latest = None , ** kwargs ):
@@ -247,7 +248,7 @@ def match_query(session, query, latest=None, **kwargs):
247248 Returns:
248249 Joined result of :class:`clef.model.Path` and :func:`find_checksum_id`
249250 """
250- checksum_table = find_checksum_id (query , latest = latest , ** kwargs )
251+ checksum_table , nocksum = find_checksum_id (query , latest = latest , ** kwargs )
251252
252253 if latest is True :
253254 # Exact match on checksum
@@ -261,10 +262,13 @@ def match_query(session, query, latest=None, **kwargs):
261262 #return values.outerjoin(Path, Path.path.like('%/'+values.c.title))
262263 #return values.outerjoin(Path, func.regexp_replace(Path.path, '^.*/', '') == values.c.title)
263264 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 ))
266269 return matches
267270
271+
268272def find_local_path (session , subq ):
269273 """Find the filesystem paths of ESGF matches
270274
0 commit comments