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 – NEMO

Changeset 15461


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

Location:
utils/tools_r4.0-HEAD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • utils/tools_r4.0-HEAD/MISCELLANEOUS/icb_pp.py

    r9325 r15461  
    7979    # skip any files with no icebergs 
    8080    if len(fw.dimensions['n']) > 0: 
    81         print pathstart+nn+'.nc' 
     81        print (pathstart+nn+'.nc') 
    8282        ic = fw.variables['iceberg_number'][:,0] 
    8383        ts = fw.variables['timestep'][:] 
     
    9696except ValueError: 
    9797    # No icebergs: create an empty output file. 
    98     print 'No icebergs in the model.' 
     98    print ('No icebergs in the model.') 
    9999    fw = Dataset(pathstart+'0000.nc') 
    100100    fo = Dataset(pathout, 'w', format='NETCDF4_CLASSIC') 
     
    104104    for key, value in varlist.iteritems() : 
    105105        if key != "iceberg_number" : 
    106             print 'key is ',key 
     106            print ('key is ',key) 
    107107            oout = fo.createVariable(key, value.dtype, ('ntraj'), 
    108108                                 zlib=True, complevel=1) 
     
    173173        inx = np.zeros(m, dtype=int) 
    174174        tsx = np.zeros(m, dtype=int) 
    175         #print pathstart+nn+'.nc' 
     175        #print (pathstart+nn+'.nc') 
    176176        ic = fw.variables['iceberg_number'][:,0] 
    177177        ts = fw.variables['timestep'][:] 
  • 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.