-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcesmep_simu_finder.py
94 lines (79 loc) · 2.62 KB
/
cesmep_simu_finder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from CM_atlas import *
# --------------------------------------------------------------------------
# -- USER INTERFACE
# -- Specify your simulation/dataset request here
# -- This tool helps you to browse the existing results using '*'
# -- and refine your request
# -- Dictionary of your requested dataset -> same dictionary as in the models list in datasets_setup.py
dat_dict = dict(
project='IGCM_OUT',
root='/ccc/store/cont003/thredds',
login='p86denvb',
model='IPSLCM6',
experiment='historical',
simulation='*',
period='0001_9998',
frequency='monthly',
)
# -- Variable dictionary -> specifications that might be project-dependant to reach one file
var_dict = dict(
variable='ua',
DIR='ATM',
)
# -- control the verbosity (debug for maximum, critical for minimum)
clog('debug')
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------
# -- CESMEP SIMU FINDER
# -- Get the comparison name and build the datasets_setup.py file name
args = sys.argv
dataset_number = None
models = None
if len(args) >= 2:
comparison = args[1]
if not comparison[len(comparison) - 1] == '/':
comparison += '/'
datasets_setup_file = comparison + 'datasets_setup.py'
execfile(datasets_setup_file)
if len(args) == 3:
dataset_number = int(args[2])
# -- Analyse if we use the datasets_setup of a comparison or dat_dict (provided by the user)
if not models:
apply_period_manager = False
models = [dat_dict]
else:
apply_period_manager = True
if not dataset_number:
ind = range(len(models))
else:
ind = [dataset_number - 1]
# -- Loop on models
for i in ind:
model = models[i]
# -- Update dictionary
model.update(var_dict)
# -- Apply frequency and period manager
if apply_period_manager:
frequency_manager_for_diag(model, diag='clim')
get_period_manager(model)
# -- Find the datasets
dat = ds(**model)
if dat.baseFiles():
print ' '
print ' '
print ' '
print ' CliMAF found those files with your request ', model
print '--> '
for found_file in str.split(dat.baseFiles(), ' '):
print found_file
print ' '
print ' -- Check that your request points to only one simulation, variable and frequency ' \
'(and table for MIP simulations)'
print ' '
else:
print ' '
print ' '
print ' '
print 'No File found for your request -- ', model
print ' '
# --------------------------------------------------------------------------