Changeset 12651
- Timestamp:
- 07/18/12 14:11:21 (13 years ago)
- Location:
- issm/trunk-jpl/test
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/test/NightlyRun/runme.py
r12639 r12651 1 1 #! /usr/bin/env python 2 """RUNME - test deck for ISSM nightly runs""" 3 # 4 # In a test deck directory (tests/Vertification/NightlyRun for example) 5 # The following command will launch all the existing tests: 6 # >> runme 7 # To run the tests 101 and 102: 8 # >> runme('id',[101 102]) 9 # etc... 10 # 11 # Available options: 12 # 'id' followed by the list of ids requested 13 # 'exclude' ids to be excluded from the test 14 # 'benchmark' 'nightly' (nightly run/ daily run) 15 # 'ismip' : validation of ismip-hom tests 16 # 'eismint': validation of eismint tests 17 # 'thermal': validation of thermal tests 18 # 'mesh' : validation of mesh tests 19 # ... 20 # 'procedure' 'check' : run the test (default) 21 # 'update': update the archive 22 # 'model' : prepare the model but no test is run 23 # 24 # Usage: 25 # md=runme(varargin); 26 # 27 # Examples: 28 # runme; 29 # runme('exclude',101); 30 # md=runme('id',102,'procedure','model'); 2 """ 3 RUNME - test deck for ISSM nightly runs 4 5 In a test deck directory (tests/Vertification/NightlyRun for example) 6 The following command will launch all the existing tests: 7 >>> runme() 8 To run the tests 101 and 102: 9 >>> runme(id=[101,102]) 10 etc... 11 12 Available options: 13 'id' followed by the list of ids requested 14 'exclude' ids to be excluded from the test 15 'benchmark' 'nightly' (nightly run/ daily run) 16 'ismip' : validation of ismip-hom tests 17 'eismint': validation of eismint tests 18 'thermal': validation of thermal tests 19 'mesh' : validation of mesh tests 20 ... 21 'procedure' 'check' : run the test (default) 22 'update': update the archive 23 24 Usage: 25 md=runme(varargin); 26 27 Examples: 28 runme() 29 runme(exclude=101) 30 md=runme(id=102,procedure='update') 31 """ 31 32 32 33 import os … … 34 35 import socket 35 36 import numpy 36 import h5py 37 #import h5py 38 import netCDF4 37 39 import sys 38 40 from parallelrange import parallelrange … … 142 144 # raise RuntimeError("Nightly run archives must be saved on 'larsen' (hostname is '"+socket.gethostname()+"').") 143 145 print "Nightly run archives must be saved on 'larsen' (hostname is '"+socket.gethostname()+"')." 144 f = h5py.File(os.path.join('..','Archives',archive_name+'.hdf5'),'w') 146 # f = h5py.File(os.path.join('..','Archives',archive_name+'.hdf5'),'w') 147 f = netCDF4.Dataset(os.path.join('..','Archives',archive_name+'.nc'),'w') 145 148 for k,fieldname in enumerate(field_names): 146 149 field=numpy.array(field_values[k],dtype=float) 147 f.create_dataset(archive_name+'_field'+str(k),data=field) 150 # f.create_dataset(archive_name+'_field'+str(k),data=field) 151 f.createDimension(archive_name+'_field'+str(k)+'_0',numpy.size(field,0)) 152 f.createDimension(archive_name+'_field'+str(k)+'_1',numpy.size(field,1)) 153 v = f.createVariable(archive_name+'_field'+str(k),'f8',(archive_name+'_field'+str(k)+'_0',archive_name+'_field'+str(k)+'_1')) 154 v[:] = field 148 155 f.close() 149 print "File '%s' saved.\n" % os.path.join('..','Archives',archive_name+'. hdf5')156 print "File '%s' saved.\n" % os.path.join('..','Archives',archive_name+'.nc') 150 157 151 158 #ELSE: CHECK TEST … … 153 160 154 161 #load archive 155 if os.path.exists(os.path.join('..','Archives',archive_name+'.hdf5')): 156 f = h5py.File(os.path.join('..','Archives',archive_name+'.hdf5'),'r') 162 if os.path.exists(os.path.join('..','Archives',archive_name+'.nc')): 163 # f = h5py.File(os.path.join('..','Archives',archive_name+'.hdf5'),'r') 164 f = netCDF4.Dataset(os.path.join('..','Archives',archive_name+'.nc'),'r') 157 165 else: 158 raise IOError("Archive file '"+os.path.join('..','Archives',archive_name+'. hdf5')+"' does not exist.")166 raise IOError("Archive file '"+os.path.join('..','Archives',archive_name+'.nc')+"' does not exist.") 159 167 160 168 for k,fieldname in enumerate(field_names): … … 168 176 169 177 #compare to archive 170 if archive_name+'_field'+str(k) in f: 171 archive=f[archive_name+'_field'+str(k)][...] 178 # if archive_name+'_field'+str(k) in f: 179 # archive=f[archive_name+'_field'+str(k)][...] 180 if archive_name+'_field'+str(k) in f.variables: 181 archive=f.variables[archive_name+'_field'+str(k)][:] 172 182 else: 173 183 raise NameError("Field name '"+archive_name+'_field'+str(k)+"' does not exist in archive file.")
Note:
See TracChangeset
for help on using the changeset viewer.