Skip to content

Commit

Permalink
fixed the var filter so it works only for CMIP5/not latest
Browse files Browse the repository at this point in the history
  • Loading branch information
paolap committed Oct 23, 2018
1 parent ef985aa commit 04ec3c3
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 288 deletions.
6 changes: 2 additions & 4 deletions clef/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ def helpdesk(user, rootdir, fname, project):
''' Send e-mail and synda request to helpdesk '''
msg = MIMEMultipart()
msg['From'] = user+'@nci.org.au'
#msg['To'] = '[email protected]'
msg['To'] = '[email protected]'
msg['Subject'] = 'Test Synda request: ' + fname
msg['To'] = '[email protected]'
msg['Subject'] = 'Synda request: ' + fname
message = project + " synda download requested from user: " + user
#message = project + " synda download requested from user: " + user + "\n This is a test message for Kate"
msg.attach(MIMEText(message, 'plain'))
f = open(rootdir + fname)
attachment=MIMEText(f.read())
Expand Down
7 changes: 5 additions & 2 deletions clef/esgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ def find_checksum_id(query, **kwargs):
nosums=[]
records=[]
# another issue appears when latest=False, then the ESGF return in the response all the variables in same dataset-id, this happens with CMIP5
matches_list = ['.'+var+'_' for var in constraints['variable'] ]
no_filter = True
if constraints['project'] == 'CMIP5' and constraints['latest']==False:
matches_list = ['.'+var+'_' for var in constraints['variable'] ]
no_filter = False
for doc in response['response']['docs']:
if any(st in doc['id'] for st in matches_list):
if no_filter or any(st in doc['id'] for st in matches_list):
if 'checksum' in doc.keys():
records.append(doc)
else:
Expand Down
Loading

0 comments on commit 04ec3c3

Please sign in to comment.