New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 15461 for utils/tools_r4.0-HEAD/REBUILD_NEMO/icb_combrest.py – NEMO

Ignore:
Timestamp:
2021-10-29T12:46:23+02:00 (3 years ago)
Author:
acc
Message:

Minor changes to print statements in icb python tools to make then python3 compatible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • utils/tools_r4.0-HEAD/REBUILD_NEMO/icb_combrest.py

    r6622 r15461  
    7979   fw = Dataset(pathstart+nn+'.nc') 
    8080 except: 
    81    print 'Error: unable to open input file: ' + pathstart+nn+'.nc' 
     81   print ('Error: unable to open input file: ' + pathstart+nn+'.nc') 
    8282   sys.exit(12) 
    8383 for d in fw.dimensions : 
    8484  if d == 'n' : 
    8585   if len(fw.dimensions['n']) > 0: 
    86 #    print 'icebergs found in: ' + pathstart+nn+'.nc'  
     86#    print ('icebergs found in: ' + pathstart+nn+'.nc' ) 
    8787     if len(fw.dimensions['k']) > nk : 
    8888       nk = len(fw.dimensions['k']) 
     
    124124    m  = len(fw.dimensions['n']) 
    125125    if m > 0: 
    126 #     print pathstart+nn+'.nc' 
     126#     print (pathstart+nn+'.nc') 
    127127      lons[nt:nt+m]  = fw.variables['lon'][:] 
    128128      lats[nt:nt+m]  = fw.variables['lat'][:] 
     
    150150    fo = Dataset(pathout, 'w', format='NETCDF4') 
    151151  except: 
    152     print 'Error accessing output file: ' + pathout 
    153     print 'Check it is a writable location.' 
     152    print ('Error accessing output file: ' + pathout) 
     153    print ('Check it is a writable location.') 
    154154    sys.exit(13) 
    155155else : 
     
    160160    os.rename(pathout,pathout.replace('.nc','_WORK.nc')) 
    161161  except OSError: 
    162     print 'Error: unable to move icebergs restart file: '+pathout 
     162    print ('Error: unable to move icebergs restart file: '+pathout) 
    163163    sys.exit(14) 
    164164  # 
     
    166166    fi = Dataset(pathout.replace('.nc','_WORK.nc'), 'r') 
    167167  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')) 
    169169    sys.exit(15) 
    170170  fo = Dataset(pathout, 'w') 
     
    185185for d in fo.dimensions : 
    186186  if d == 'n' : 
    187     print 'Error: dimension n already exists in output file' 
     187    print ('Error: dimension n already exists in output file') 
    188188    sys.exit(16) 
    189189  if d == 'k' : 
Note: See TracChangeset for help on using the changeset viewer.