Changeset 15461
- Timestamp:
- 2021-10-29T12:46:23+02:00 (3 years ago)
- Location:
- utils/tools_r4.0-HEAD
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
utils/tools_r4.0-HEAD/MISCELLANEOUS/icb_pp.py
r9325 r15461 79 79 # skip any files with no icebergs 80 80 if len(fw.dimensions['n']) > 0: 81 print pathstart+nn+'.nc'81 print (pathstart+nn+'.nc') 82 82 ic = fw.variables['iceberg_number'][:,0] 83 83 ts = fw.variables['timestep'][:] … … 96 96 except ValueError: 97 97 # No icebergs: create an empty output file. 98 print 'No icebergs in the model.'98 print ('No icebergs in the model.') 99 99 fw = Dataset(pathstart+'0000.nc') 100 100 fo = Dataset(pathout, 'w', format='NETCDF4_CLASSIC') … … 104 104 for key, value in varlist.iteritems() : 105 105 if key != "iceberg_number" : 106 print 'key is ',key106 print ('key is ',key) 107 107 oout = fo.createVariable(key, value.dtype, ('ntraj'), 108 108 zlib=True, complevel=1) … … 173 173 inx = np.zeros(m, dtype=int) 174 174 tsx = np.zeros(m, dtype=int) 175 #print pathstart+nn+'.nc'175 #print (pathstart+nn+'.nc') 176 176 ic = fw.variables['iceberg_number'][:,0] 177 177 ts = fw.variables['timestep'][:] -
utils/tools_r4.0-HEAD/REBUILD_NEMO/icb_combrest.py
r6622 r15461 79 79 fw = Dataset(pathstart+nn+'.nc') 80 80 except: 81 print 'Error: unable to open input file: ' + pathstart+nn+'.nc'81 print ('Error: unable to open input file: ' + pathstart+nn+'.nc') 82 82 sys.exit(12) 83 83 for d in fw.dimensions : 84 84 if d == 'n' : 85 85 if len(fw.dimensions['n']) > 0: 86 # print 'icebergs found in: ' + pathstart+nn+'.nc'86 # print ('icebergs found in: ' + pathstart+nn+'.nc' ) 87 87 if len(fw.dimensions['k']) > nk : 88 88 nk = len(fw.dimensions['k']) … … 124 124 m = len(fw.dimensions['n']) 125 125 if m > 0: 126 # print pathstart+nn+'.nc'126 # print (pathstart+nn+'.nc') 127 127 lons[nt:nt+m] = fw.variables['lon'][:] 128 128 lats[nt:nt+m] = fw.variables['lat'][:] … … 150 150 fo = Dataset(pathout, 'w', format='NETCDF4') 151 151 except: 152 print 'Error accessing output file: ' + pathout153 print 'Check it is a writable location.'152 print ('Error accessing output file: ' + pathout) 153 print ('Check it is a writable location.') 154 154 sys.exit(13) 155 155 else : … … 160 160 os.rename(pathout,pathout.replace('.nc','_WORK.nc')) 161 161 except OSError: 162 print 'Error: unable to move icebergs restart file: '+pathout162 print ('Error: unable to move icebergs restart file: '+pathout) 163 163 sys.exit(14) 164 164 # … … 166 166 fi = Dataset(pathout.replace('.nc','_WORK.nc'), 'r') 167 167 except: 168 print 'Error: unable to open icebergs restart file: '+pathout.replace('.nc','_WORK.nc')168 print ('Error: unable to open icebergs restart file: '+pathout.replace('.nc','_WORK.nc')) 169 169 sys.exit(15) 170 170 fo = Dataset(pathout, 'w') … … 185 185 for d in fo.dimensions : 186 186 if d == 'n' : 187 print 'Error: dimension n already exists in output file'187 print ('Error: dimension n already exists in output file') 188 188 sys.exit(16) 189 189 if d == 'k' :
Note: See TracChangeset
for help on using the changeset viewer.