Skip to content

Commit 6aec1e2

Browse files
committed
ready for 1.5.1 release rolled back esgf dataset-id query
1 parent cc7b632 commit 6aec1e2

File tree

7 files changed

+16
-21
lines changed

7 files changed

+16
-21
lines changed

clef/cli.py

+1
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ def common_esgf_cli(ctx, project, query, latest, replica, distrib,
379379
limit=10000,
380380
**constraints,
381381
)
382+
val = [x for x in s.query(q)][0]
382383

383384
ids=sorted(set(x.dataset_id for x in s.query(q)))
384385
# when stats or csvf are True first extract attributes from dataset_ids

clef/esgf.py

+8-14
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from sqlalchemy import String, Float, Integer, or_, func
3838

3939
#from .pgvalues import values
40-
from .model import Path, Checksum
40+
from .model import Path, Checksum, C6Dataset, C5Dataset, CordexDataset
4141
from .exception import ClefException
4242

4343

@@ -167,11 +167,8 @@ def find_checksum_id(query, **kwargs):
167167
raise ESGFException('No matches found on ESGF, check at %s'%link_to_esgf(query, **constraints))
168168

169169
if response['response']['numFound'] > int(response['responseHeader']['params']['rows']):
170-
print(f"Too many files ({response['response']['numFound']}), try limiting your search.\n")
171-
print("Returning only dataset results, hence a full comparison with local collection is not possible")
172-
response = esgf_query(query, 'id,dataset_id,title,version', otype='Dataset', **constraints)
173-
#raise ESGFException('Too many results (%d), try limiting your search %s'%(response['response']['numFound'],
174-
# link_to_esgf(query, **constraints)))
170+
raise ESGFException('Too many results (%d), try limiting your search %s'%(response['response']['numFound'],
171+
link_to_esgf(query, **constraints)))
175172
# separate records that do not have checksum in response (nosums list) from others (records list)
176173
# we should call local_search for these i.e. a search not based on checksums but is not yet implemented
177174
nosums=[]
@@ -189,8 +186,7 @@ def find_checksum_id(query, **kwargs):
189186
records.append(doc)
190187
else:
191188
nosums.append(doc)
192-
print(doc)
193-
189+
194190
record_list = [
195191
(doc['checksum'][0],
196192
doc['id'].split('|')[0], # drop the server name
@@ -202,7 +198,7 @@ def find_checksum_id(query, **kwargs):
202198
nosums_list = [
203199
('NA',
204200
doc['id'].split('|')[0], # drop the server name
205-
doc['dataset_id'].split('|')[0], # Drop the server name
201+
doc['id'].split('|')[0], # Drop the server name
206202
doc['title'],
207203
doc['version'],
208204
doc['score'])
@@ -221,7 +217,7 @@ def find_checksum_id(query, **kwargs):
221217
table = sqlalvalues(
222218
column('checksum', String),
223219
column('id', String),
224-
#column('dataset_id', String),
220+
column('dataset_id', String),
225221
column('title', String),
226222
column('version', Integer),
227223
column('score', Float),
@@ -259,13 +255,11 @@ def match_query(session, query, latest=None, **kwargs):
259255
.outerjoin(Path))
260256
else:
261257
# Match on file name
262-
#return values.outerjoin(Path, Path.path.like('%/'+values.c.title))
263-
#return values.outerjoin(Path, func.regexp_replace(Path.path, '^.*/', '') == values.c.title)
264258
matches = checksum_table.join(Path, func.regexp_replace(Path.path, '^.*/', '') == checksum_table.c.title)
265259

266260
if nocksum is True:
267-
if project == 'CMIP6':
268-
matches = (checksum_table.join(C6Dataset, C6.Dataset.dataset_id == checksum_table.c.dataset_id))
261+
raise ESGFException(f'Some datasets have incomplete records try --local option')
262+
269263
return matches
270264

271265

clef/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def expr(self, model):
8383

8484

8585
class Path(Base):
86-
"""Path of a file on Raijin, with links to metadata
86+
"""Path of a file on Gadi, with links to metadata
8787
"""
8888
__tablename__ = 'esgf_paths'
8989

conda/meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% set version = "1.5.0" %}
1+
{% set version = "1.5.1" %}
22
package:
33
name: clef
44
version: {{ version }}

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
#version = _dist.parsed_version.base_version
6868
# The full version, including alpha/beta/rc tags.
6969
#release = _dist.version
70-
version = u'1.5.0'
71-
release = u'1.5.0'
70+
version = u'1.5.1'
71+
release = u'1.5.1'
7272

7373
# The language for content autogenerated by Sphinx. Refer to documentation
7474
# for a list of supported languages.

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = clef
3-
version = 1.5.0
3+
version = 1.5.1
44
author = Scott Wales, Paola Petrelli
55
66
summary = 'CleF queries ESGF data at NCI'

test/test_esgf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ def test_checksum_id_empty(session):
131131
"""
132132
with mock.patch('clef.esgf.esgf_query', side_effect=empty_query):
133133
with pytest.raises(ClefException):
134-
table = find_checksum_id('')
134+
table, nocksum = find_checksum_id('')
135135

136136
def test_checksum_id_missing(session):
137137
"""
138138
Create a values table with the returned result
139139
"""
140140
with mock.patch('clef.esgf.esgf_query', side_effect=missing_query):
141-
table = find_checksum_id('')
141+
table, nocksum = find_checksum_id('')
142142
match = session.query(table).one()
143143
assert match.id == 'abcde'
144144
assert match.score == 1.0

0 commit comments

Comments
 (0)