Skip to content

Commit f19f5c2

Browse files
committed
reoslution extraction
1 parent 994c017 commit f19f5c2

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

compliance_checker_v0.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ def files_and_subdirectories(path):
166166
temp_mandatory_var = mandatory_variables
167167
if variable in mandatory_variables:
168168
temp_mandatory_var.remove(variable)
169-
170-
experiment_name = xp[:-3]
171-
grid_resolution = int(xp[-2:])
169+
#get the experiment name (example: exp05)
170+
experiment_name = xp.split('_')[0]
171+
#get the resolution as integer
172+
grid_resolution = int(xp.split('_')[1])
172173

173174
if experiment_name in [dic['experiment'] for dic in experiments]:
174175
f.write('\n ')
@@ -369,13 +370,13 @@ def files_and_subdirectories(path):
369370
f.write(' - ERROR: the experiment lasts ' + str(duration_years) + ' years. The duration should be ' + str(experiments[index_exp]['duration']) + ' years\n')
370371
var_time_errors += 1
371372
# test Time step
372-
if isinstance((ds['time'].values[11]-ds['time'].values[10]),datetime.timedelta):
373-
time_step = (ds['time'].values[11]-ds['time'].values[10]).days
373+
if isinstance((ds['time'].values[1]-ds['time'].values[0]),datetime.timedelta):
374+
time_step = (ds['time'].values[1]-ds['time'].values[0]).days
374375
else:
375-
if isinstance((ds['time'].values[11]-ds['time'].values[10]),np.timedelta64):
376-
time_step = np.timedelta64(ds['time'].values[11]-ds['time'].values[10], 'D')/ np.timedelta64(1, 'D')
376+
if isinstance((ds['time'].values[1]-ds['time'].values[0]),np.timedelta64):
377+
time_step = np.timedelta64(ds['time'].values[1]-ds['time'].values[0], 'D')/ np.timedelta64(1, 'D')
377378
else:
378-
time_step = ds['time'].values[11]-ds['time'].values[10]
379+
time_step = ds['time'].values[1]-ds['time'].values[10]
379380

380381
if 360<=time_step<=367:
381382
f.write(' - Time step: ' + str(time_step) + ' days' + '\n')

test/compliance_checker_log.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
************************************************************************************
44
version: 0
55
verification criteria: ismip6_criteria_v0.csv
6-
date: 2022/08/03
6+
date: 2022/08/05
77
source: https://github.com/jbbarre/ISM_SimulationChecker
88

99
------------------------------------------------------------------------------------
@@ -29,7 +29,7 @@ Tips: Use Cltr+F to look for specific problems.
2929

3030

3131
**********************************************************
32-
Experiment: exp05
32+
** Experiment: exp05
3333
**********************************************************
3434

3535
ERROR: In experiment exp05_32, these mandatory variable(s) is (are) missing: ['acabf', 'base', 'libmassbfgr', 'lithk', 'orog', 'sftflf', 'sftgif', 'sftgrf', 'strbasemag', 'topg', 'xvelmean', 'yvelmean']
@@ -50,7 +50,7 @@ TIME Tests
5050
- Experiment starts correctly on 2015-07-01.
5151
- Experiment ends correctly on 2100-07-01.
5252
- Experiment lasts 85 years.
53-
- Time step: 365.0 days
53+
- Time step: 366.0 days
5454

5555
----------------------------------------------------------
5656
exp05 - libmassbffl - File:libmassbffl_AIS_IMAU_IMAUICE1_exp05.nc

0 commit comments

Comments
 (0)