Changeset 9325
- Timestamp:
- 2018-02-13T17:28:22+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2017/dev_merge_2017/NEMOGCM/TOOLS/MISCELLANEOUS/icb_pp.py
r8509 r9325 92 92 # Now flatten the lists and reduce to the unique spanning set 93 93 # 94 icu = np.concatenate(icu) 94 try: 95 icu = np.concatenate(icu) 96 except ValueError: 97 # No icebergs: create an empty output file. 98 print 'No icebergs in the model.' 99 fw = Dataset(pathstart+'0000.nc') 100 fo = Dataset(pathout, 'w', format='NETCDF4_CLASSIC') 101 ntrj = fo.createDimension('ntraj', None) 102 icbn = fo.createVariable('iceberg_number', 'i4',('ntraj')) 103 n = 0 104 for key, value in varlist.iteritems() : 105 if key != "iceberg_number" : 106 print 'key is ',key 107 oout = fo.createVariable(key, value.dtype, ('ntraj'), 108 zlib=True, complevel=1) 109 oout.long_name = fw.variables[key].getncattr('long_name') 110 oout.units = fw.variables[key].getncattr('units') 111 n = n + 1 112 fw.close() 113 fo.close() 114 sys.exit() 115 95 116 icu = np.unique(icu) 96 117 times = np.concatenate(times)
Note: See TracChangeset
for help on using the changeset viewer.