Changeset 23707


Ignore:
Timestamp:
02/11/19 04:11:43 (6 years ago)
Author:
bdef
Message:

CHG: translate from python 2 to3

Location:
issm/trunk-jpl/test
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/test/NightlyRun/IdFromString.py

    r23178 r23707  
    3838        #Return if no test found
    3939        if not ids:
    40                 print "No test matches '%s'." % string
     40                print("No test matches '%s'." % string)
    4141                return ids
    4242
     
    4848
    4949        if verbose:
    50                 print "%s tests match '%s':" % (len(ids),string)
     50                print("%s tests match '%s':" % (len(ids),string))
    5151                for i in range(len(ids)):
    52                         print "   %s : %s" % (ids[i],idnames[i])
     52                        print("   %s : %s" % (ids[i],idnames[i]))
    5353        #else:
    5454                #print ids
  • issm/trunk-jpl/test/NightlyRun/runme.py

    r23535 r23707  
    77from socket import gethostname
    88from GetIds import *
     9from parallelrange import parallelrange
     10from IdToName import IdToName
     11from arch import archread
     12from arch import archwrite
     13from arch import archdisp
    914
    1015def runme(id=None,exclude=None,benchmark='nightly',procedure='check',output='none',rank=1,numprocs=1):
     
    4954               runme(id=[[101,102],['Dakota','Slr']])
    5055        """
    51         from parallelrange import parallelrange
    52         from IdToName import IdToName
    53         from arch import archread
    54         from arch import archwrite
    55         from arch import archdisp
    56 
    5756        #Get ISSM_DIR variable
    5857        ISSM_DIR=os.environ['ISSM_DIR']
     
    6160        #GET benchmark {{{
    6261        if not benchmark in ['all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing','adolc','slr','referential']:
    63                 print("runme warning: benchmark '{}' not supported, defaulting to test 'nightly'.".format(benchmark))
     62                print(("runme warning: benchmark '{}' not supported, defaulting to test 'nightly'.".format(benchmark)))
    6463                benchmark='nightly'
    6564        # }}}
    6665        #GET procedure {{{
    6766        if not procedure in ['check','update']:
    68                 print("runme warning: procedure '{}' not supported, defaulting to test 'check'.".format(procedure))
     67                print(("runme warning: procedure '{}' not supported, defaulting to test 'check'.".format(procedure)))
    6968                procedure='check'
    7069        # }}}
    7170        #GET output {{{
    7271        if not output in ['nightly','none']:
    73                 print("runme warning: output '{}' not supported, defaulting to test 'none'.".format(output))
     72                print(("runme warning: output '{}' not supported, defaulting to test 'none'.".format(output)))
    7473                output='none'
    7574        # }}}
     
    126125        root=os.getcwd()
    127126        for id in test_ids:
    128                 print "----------------starting:%i-----------------------" % id
     127                print(("----------------starting:{}-----------------------".format(id)))
    129128                try:
    130129
     
    132131                        os.chdir(root)
    133132                        id_string=IdToName(id)
    134                         execfile('test'+str(id)+'.py',globals())
     133                        exec(compile(open('test'+str(id)+'.py').read(), 'test'+str(id)+'.py', 'exec'),globals())
    135134
    136135                        #UPDATE ARCHIVE?
     
    151150                                        # Matlab uses base 1, so use base 1 in labels
    152151                                        archwrite(archive_file,archive_name+'_field'+str(k+1),field)
    153                                 print "File '%s' saved.\n" % os.path.join('..','Archives',archive_name+'.arch')
     152                                print(("File {} saved. \n".format(os.path.join('..','Archives',archive_name+'.arch'))))
    154153
    155154                        #ELSE: CHECK TEST
     
    185184
    186185                                                error_diff=np.amax(np.abs(archive-field),axis=0)/(np.amax(np.abs(archive),axis=0)+float_info.epsilon)
    187 
    188                                                 if not np.isscalar(error_diff): error_diff=error_diff[0]
     186                                                if not np.isscalar(error_diff):
     187                                                        error_diff=error_diff[0]
    189188
    190189                                                #disp test result
    191190                                                if (np.any(error_diff>tolerance) or np.isnan(error_diff)):
    192                                                         print('ERROR   difference: {} > {} test id: {} test name: {} field: {}'.format(error_diff,tolerance,id,id_string,fieldname))
     191                                                        print(('ERROR   difference: {} > {} test id: {} test name: {} field: {}'.format(error_diff,tolerance,id,id_string,fieldname)))
    193192                                                else:
    194                                                         print('SUCCESS difference: {} < {} test id: {} test name: {} field: {}'.format(error_diff,tolerance,id,id_string,fieldname))
     193                                                        print(('SUCCESS difference: {} < {} test id: {} test name: {} field: {}'.format(error_diff,tolerance,id,id_string,fieldname)))
    195194
    196195                                        except Exception as message:
    197196
    198197                                                #something went wrong, print failure message:
    199                                                 print format_exc()
     198                                                print((format_exc()))
    200199                                                directory=os.getcwd().split('/')    #  not used?
    201200                                                if output=='nightly':
     
    204203                                                        fid.write('\n------------------------------------------------------------------\n')
    205204                                                        fid.close()
    206                                                         print('FAILURE difference: N/A test id: {} test name: {} field: {}'.format(id,id_string,fieldname))
     205                                                        print(('FAILURE difference: N/A test id: {} test name: {} field: {}'.format(id,id_string,fieldname)))
    207206                                                else:
    208                                                         print('FAILURE difference: N/A test id: {} test name: {} field: {}'.format(id,id_string,fieldname))
     207                                                        print(('FAILURE difference: N/A test id: {} test name: {} field: {}'.format(id,id_string,fieldname)))
    209208                                                        raise RuntimeError(message)
    210209
     
    213212
    214213                        #something went wrong, print failure message:
    215                         print format_exc()
     214                        print((format_exc()))
    216215                        directory=os.getcwd().split('/')    #  not used?
    217216                        if output=='nightly':
     
    220219                                fid.write('\n------------------------------------------------------------------\n')
    221220                                fid.close()
    222                                 print('FAILURE difference: N/A test id: {} test name: {} field: {}'.format(id,id_string,'N/A'))
     221                                print(('FAILURE difference: N/A test id: {} test name: {} field: {}'.format(id,id_string,'N/A')))
    223222                        else:
    224                                 print('FAILURE difference: N/A test id: {} test name: {} field: {}'.format(id,id_string,'N/A'))
     223                                print(('FAILURE difference: N/A test id: {} test name: {} field: {}'.format(id,id_string,'N/A')))
    225224                                raise RuntimeError(message)
    226225
    227                 print "----------------finished:%i-----------------------" % id
     226                print(("----------------finished:{}-----------------------".format(id)))
    228227        return
    229228
     
    235234                if os.path.exists(PYTHONSTARTUP):
    236235                        try:
    237                                 execfile(PYTHONSTARTUP)
     236                                exec(compile(open(PYTHONSTARTUP).read(), PYTHONSTARTUP, 'exec'))
    238237                        except Exception as e:
    239                                 print "PYTHONSTARTUP error: ",e
     238                                print(("PYTHONSTARTUP error: ",e))
    240239                else:
    241                         print("PYTHONSTARTUP file '{}' does not exist.".format(PYTHONSTARTUP))
     240                        print(("PYTHONSTARTUP file '{}' does not exist.".format(PYTHONSTARTUP)))
    242241
    243242        parser = argparse.ArgumentParser(description='RUNME - test deck for ISSM nightly runs')
     
    256255
    257256        if args.output=='nightly':
    258                 print "PYTHONEXITEDCORRECTLY"
     257                print("PYTHONEXITEDCORRECTLY")
    259258
    260259        exit(md)
  • issm/trunk-jpl/test/NightlyRun/test101.py

    r23577 r23707  
    1515md=setflowequation(md,'SSA','all')
    1616md.cluster=generic('name',gethostname(),'np',3)
    17 
     17md.verbose=verbose('all')
     18md.verbose.solver=True
    1819#outputs
    1920md.stressbalance.requested_outputs=['default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy','MassFlux1','MassFlux2','MassFlux3','MassFlux4','MassFlux5','MassFlux6']
  • issm/trunk-jpl/test/NightlyRun/test1104.py

    r22868 r23707  
    4444
    4545        md.stressbalance.vertex_pairing=np.vstack((np.vstack((posx+1,posx2+1)).T,np.vstack((posy+1,posy2+1)).T))
    46         print np.shape(md.stressbalance.vertex_pairing)
     46        print(np.shape(md.stressbalance.vertex_pairing))
    4747        #Compute the stressbalance
    4848        md.stressbalance.abstol=np.nan
  • issm/trunk-jpl/test/NightlyRun/test1201.py

    r21411 r23707  
    1717results=[]
    1818
    19 for stabilization in xrange(1,4):
     19for stabilization in range(1,4):
    2020        #The goal is to test the masstransport model
    2121        md=bamg(model(),'domain','../Exp/SquareEISMINT.exp','hmax',3000.)
     
    2626        md.cluster=generic('name',gethostname(),'np',8)
    2727
    28         print "      initial velocity"
     28        print("      initial velocity")
    2929        md.initialization.vx=np.zeros((md.mesh.numberofvertices))
    3030        md.initialization.vy=-400.*np.ones((md.mesh.numberofvertices))
  • issm/trunk-jpl/test/NightlyRun/test1205.py

    r21408 r23707  
    5050vel=np.zeros((md.mesh.numberofvertices2d))
    5151
    52 for i in xrange(0,md.mesh.numberofvertices2d):
     52for i in range(0,md.mesh.numberofvertices2d):
    5353        node_vel=0.
    54         for j in xrange(0,md.mesh.numberoflayers-1):
     54        for j in range(0,md.mesh.numberoflayers-1):
    5555                node_vel=node_vel+1./(2.*(md.mesh.numberoflayers-1))*(np.sqrt(vx[i+(j+1)*md.mesh.numberofvertices2d,0]**2+vy[i+(j+1)*md.mesh.numberofvertices2d,0]**2)+np.sqrt(vx[i+j*md.mesh.numberofvertices2d,0]**2+vy[i+j*md.mesh.numberofvertices2d,0]**2))
    5656        vel[i]=node_vel
  • issm/trunk-jpl/test/NightlyRun/test1206.py

    r21408 r23707  
    5050vel=np.zeros((md.mesh.numberofvertices2d))
    5151
    52 for i in xrange(0,md.mesh.numberofvertices2d):
     52for i in range(0,md.mesh.numberofvertices2d):
    5353        node_vel=0.
    54         for j in xrange(0,md.mesh.numberoflayers-1):
     54        for j in range(0,md.mesh.numberoflayers-1):
    5555                node_vel=node_vel+1./(2.*(md.mesh.numberoflayers-1))*\
    5656                        (np.sqrt(vx[i+(j+1)*md.mesh.numberofvertices2d,0]**2+vy[i+(j+1)*md.mesh.numberofvertices2d,0]**2)+\
  • issm/trunk-jpl/test/NightlyRun/test1207.py

    r21408 r23707  
    5050vel=np.zeros((md.mesh.numberofvertices2d))
    5151
    52 for i in xrange(0,md.mesh.numberofvertices2d):
     52for i in range(0,md.mesh.numberofvertices2d):
    5353        node_vel=0.
    54         for j in xrange(0,md.mesh.numberoflayers-1):
     54        for j in range(0,md.mesh.numberoflayers-1):
    5555                node_vel=node_vel+1./(2.*(md.mesh.numberoflayers-1))*\
    5656                        (np.sqrt(vx[i+(j+1)*md.mesh.numberofvertices2d,0]**2+vy[i+(j+1)*md.mesh.numberofvertices2d,0]**2)+\
  • issm/trunk-jpl/test/NightlyRun/test1501.py

    r21408 r23707  
    3131md=solve(md,'Masstransport')
    3232
    33 for i in xrange(1,11):
     33for i in range(1,11):
    3434         md=solve(md,'Masstransport')
    3535         md.smb.mass_balance= md.smb.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness)
  • issm/trunk-jpl/test/NightlyRun/test1502.py

    r21408 r23707  
    3232md=solve(md,'Masstransport')
    3333
    34 for i in xrange(1,11):
     34for i in range(1,11):
    3535         md=solve(md,'Masstransport')
    3636         md.smb.mass_balance= md.smb.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness)
  • issm/trunk-jpl/test/NightlyRun/test1601.py

    r21632 r23707  
    3535vel1=md.results.StressbalanceSolution.Vel
    3636#plotmodel(md,'data',vel0,'data',vel1,'data',vel1-vel0,'title','Cartesian CS','title','Rotated CS','title','difference')
    37 print "Error between Cartesian and rotated CS: %g" % (np.max(np.abs(vel0-vel1))/(np.max(np.abs(vel0))+sys.float_info.epsilon))
     37print("Error between Cartesian and rotated CS: %g" % (np.max(np.abs(vel0-vel1))/(np.max(np.abs(vel0))+sys.float_info.epsilon)))
    3838
    3939#Now, put CS back to normal except on the side where the spc are applied
     
    4646
    4747#plotmodel(md,'data',vel0,'data',vel2,'data',vel2-vel0,'title','Cartesian CS','title','Rotated CS','title','difference')
    48 print "Error between Cartesian and rotated CS: %g" % (np.max(np.abs(vel0-vel2))/(np.max(np.abs(vel0))+sys.float_info.epsilon))
     48print("Error between Cartesian and rotated CS: %g" % (np.max(np.abs(vel0-vel2))/(np.max(np.abs(vel0))+sys.float_info.epsilon)))
    4949
    5050#Fields and tolerances to track changes
  • issm/trunk-jpl/test/NightlyRun/test1602.py

    r21614 r23707  
    3737
    3838#plotmodel(md,'data',vel0,'data',vel1,'data',vel1-vel0,'title','Cartesian CS','title','Rotated CS','title','difference','view#all',2)
    39 print "Error between Cartesian and rotated CS: %g" % (np.max(np.abs(vel0-vel1))/(np.max(np.abs(vel0))+sys.float_info.epsilon))
     39print("Error between Cartesian and rotated CS: %g" % (np.max(np.abs(vel0-vel1))/(np.max(np.abs(vel0))+sys.float_info.epsilon)))
    4040
    4141#Fields and tolerances to track changes
  • issm/trunk-jpl/test/NightlyRun/test234.py

    r23231 r23707  
    33import scipy.io as spio
    44from os import getcwd
     5from IssmConfig import IssmConfig
    56from model import *
    67from socket import gethostname
  • issm/trunk-jpl/test/NightlyRun/test235.py

    r23231 r23707  
    44from os import getcwd
    55from model import *
     6from IssmConfig import IssmConfig
    67from socket import gethostname
    78from triangle import *
  • issm/trunk-jpl/test/NightlyRun/test236.py

    r22864 r23707  
    3232md.smb.temperatures_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    3333md.smb.temperatures_lgm=np.zeros((md.mesh.numberofvertices+1,12))
    34 for imonth in xrange(0,12):
     34for imonth in range(0,12):
    3535    md.smb.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
    3636    md.smb.temperatures_lgm[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]-20.
     
    5151md.smb.precipitations_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    5252md.smb.precipitations_lgm=np.zeros((md.mesh.numberofvertices+1,12))
    53 for imonth in xrange(0,12):
     53for imonth in range(0,12):
    5454        md.smb.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
    5555        md.smb.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
  • issm/trunk-jpl/test/NightlyRun/test237.py

    r22864 r23707  
    3030md.smb.temperatures_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    3131md.smb.temperatures_lgm=np.zeros((md.mesh.numberofvertices+1,12))
    32 for imonth in xrange(0,12):
     32for imonth in range(0,12):
    3333    md.smb.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
    3434    md.smb.temperatures_lgm[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]-20.
     
    4949md.smb.precipitations_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    5050md.smb.precipitations_lgm=np.zeros((md.mesh.numberofvertices+1,12))
    51 for imonth in xrange(0,12):
     51for imonth in range(0,12):
    5252    md.smb.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
    5353    md.smb.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
     
    5959md.smb.Tdiff=np.zeros((2,fsize))
    6060md.smb.sealev=np.zeros((2,fsize))
    61 for iint in xrange(0,fsize):
     61for iint in range(0,fsize):
    6262    # Interpolation factors
    6363         md.smb.Pfac[0,iint]=0.15*(iint+1)
  • issm/trunk-jpl/test/NightlyRun/test238.py

    r21408 r23707  
    2727tmonth=np.ones(12)*(238.15+20.)
    2828md.smb.temperatures_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    29 for imonth in xrange(0,12):
     29for imonth in range(0,12):
    3030    md.smb.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
    3131    # Time for the last line:
     
    4040# creating precipitation
    4141md.smb.precipitations_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    42 for imonth in xrange(0,12):
     42for imonth in range(0,12):
    4343    md.smb.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
    4444    md.smb.precipitations_presentday[md.mesh.numberofvertices,imonth]=(float(imonth)/12.)
  • issm/trunk-jpl/test/NightlyRun/test239.py

    r21408 r23707  
    2727tmonth=np.ones(12)*(238.15+20.)
    2828md.smb.temperatures_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    29 for imonth in xrange(0,12):
     29for imonth in range(0,12):
    3030    md.smb.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
    3131    # Time for the last line:
     
    4040# creating precipitation
    4141md.smb.precipitations_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    42 for imonth in xrange(0,12):
     42for imonth in range(0,12):
    4343    md.smb.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
    4444    md.smb.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
  • issm/trunk-jpl/test/NightlyRun/test240.py

    r21408 r23707  
    2727tmonth=np.ones(12)*(238.15+20.)
    2828md.smb.temperatures_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    29 for imonth in xrange(0,12):
     29for imonth in range(0,12):
    3030    md.smb.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
    3131    # Time for the last line:
     
    4040# creating precipitation
    4141md.smb.precipitations_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    42 for imonth in xrange(0,12):
     42for imonth in range(0,12):
    4343    md.smb.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
    4444    md.smb.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
  • issm/trunk-jpl/test/NightlyRun/test243.py

    r23468 r23707  
    2020md.smb = SMBgemb()
    2121md.smb.setdefaultparameters(md.mesh,md.geometry)
    22 md.smb.dsnowIdx = 0 
     22md.smb.dsnowIdx = 0
    2323
    2424#load hourly surface forcing date from 1979 to 2009:
    25 inputs = np.load('../Data/gemb_input.npy').item()
     25inputs = np.load('../Data/gemb_input.npy',encoding='bytes').item()
    2626
    2727#setup the inputs:
    28 md.smb.Ta = np.append(np.tile(np.conjugate(inputs['Ta0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    29 md.smb.V = np.append(np.tile(np.conjugate(inputs['V0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    30 md.smb.dswrf = np.append(np.tile(np.conjugate(inputs['dsw0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    31 md.smb.dlwrf = np.append(np.tile(np.conjugate(inputs['dlw0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    32 md.smb.P = np.append(np.tile(np.conjugate(inputs['P0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    33 md.smb.eAir = np.append(np.tile(np.conjugate(inputs['eAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    34 md.smb.pAir = np.append(np.tile(np.conjugate(inputs['pAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    35 md.smb.pAir = np.append(np.tile(np.conjugate(inputs['pAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    36 md.smb.Vz = np.tile(np.conjugate(inputs['LP']['Vz']),(md.mesh.numberofelements,1)).flatten()
    37 md.smb.Tz = np.tile(np.conjugate(inputs['LP']['Tz']),(md.mesh.numberofelements,1)).flatten()
    38 md.smb.Tmean = np.tile(np.conjugate(inputs['LP']['Tmean']),(md.mesh.numberofelements,1)).flatten()
    39 md.smb.C = np.tile(np.conjugate(inputs['LP']['C']),(md.mesh.numberofelements,1)).flatten()
     28md.smb.Ta = np.append(np.tile(np.conjugate(inputs[b'Ta0']),(md.mesh.numberofelements,1)),np.conjugate([inputs[b'dateN']]),axis=0)
     29md.smb.V = np.append(np.tile(np.conjugate(inputs[b'V0']),(md.mesh.numberofelements,1)),np.conjugate([inputs[b'dateN']]),axis=0)
     30md.smb.dswrf = np.append(np.tile(np.conjugate(inputs[b'dsw0']),(md.mesh.numberofelements,1)),np.conjugate([inputs[b'dateN']]),axis=0)
     31md.smb.dlwrf = np.append(np.tile(np.conjugate(inputs[b'dlw0']),(md.mesh.numberofelements,1)),np.conjugate([inputs[b'dateN']]),axis=0)
     32md.smb.P = np.append(np.tile(np.conjugate(inputs[b'P0']),(md.mesh.numberofelements,1)),np.conjugate([inputs[b'dateN']]),axis=0)
     33md.smb.eAir = np.append(np.tile(np.conjugate(inputs[b'eAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs[b'dateN']]),axis=0)
     34md.smb.pAir = np.append(np.tile(np.conjugate(inputs[b'pAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs[b'dateN']]),axis=0)
     35md.smb.pAir = np.append(np.tile(np.conjugate(inputs[b'pAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs[b'dateN']]),axis=0)
     36md.smb.Vz = np.tile(np.conjugate(inputs[b'LP']['Vz']),(md.mesh.numberofelements,1)).flatten()
     37md.smb.Tz = np.tile(np.conjugate(inputs[b'LP']['Tz']),(md.mesh.numberofelements,1)).flatten()
     38md.smb.Tmean = np.tile(np.conjugate(inputs[b'LP']['Tmean']),(md.mesh.numberofelements,1)).flatten()
     39md.smb.C = np.tile(np.conjugate(inputs[b'LP']['C']),(md.mesh.numberofelements,1)).flatten()
    4040
    4141#smb settings
  • issm/trunk-jpl/test/NightlyRun/test274.py

    r21411 r23707  
    2424
    2525md.cluster=generic('name',gethostname(),'np',3)
    26 print md.rifts.riftstruct[0]['fill']
     26print(md.rifts.riftstruct[0]['fill'])
    2727md=solve(md,'Stressbalance')
    2828
  • issm/trunk-jpl/test/NightlyRun/test3015.py

    r21925 r23707  
    8888dVdh_ad=md.results.MasstransportSolution.AutodiffJacobian
    8989
    90 print "dV/dh: analytical:  %16.16g\n       using adolc:  %16.16g\n" % (dVdh_an,dVdh_ad)
     90print("dV/dh: analytical:  %16.16g\n       using adolc:  %16.16g\n" % (dVdh_an,dVdh_ad))
    9191
    9292#Fields and tolerances to track changes
  • issm/trunk-jpl/test/NightlyRun/test3020.py

    r21408 r23707  
    9494dMaxVdh_ad=md.results.TransientSolution[0].AutodiffJacobian[1]
    9595
    96 print "dV/dh: analytical:  %16.16g\n       using adolc:  %16.16g\n" % (dVdh_an,dVdh_ad)
    97 print "dMaxV/dh: analytical:  %16.16g\n       using adolc:  %16.16g\n" % (dMaxVdh_an,dMaxVdh_ad)
     96print("dV/dh: analytical:  %16.16g\n       using adolc:  %16.16g\n" % (dVdh_an,dVdh_ad))
     97print("dMaxV/dh: analytical:  %16.16g\n       using adolc:  %16.16g\n" % (dMaxVdh_an,dMaxVdh_ad))
    9898
    9999#Fields and tolerances to track changes
  • issm/trunk-jpl/test/NightlyRun/test333.py

    r22900 r23707  
    1717md.transient=transient.setallnullparameters(md.transient)
    1818md.transient.ishydrology=True
    19 md.transient.issmb=True
     19#md.transient.issmb=True
    2020md=setflowequation(md,'SSA','all')
    2121md.cluster=generic('name',gethostname(),'np',1)
     
    4747md.timestepping.final_time=2.0
    4848
     49#md.debug.valgrind=True
    4950md=solve(md,'Transient')
    5051
  • issm/trunk-jpl/test/NightlyRun/test436.py

    r22883 r23707  
    2525field_values = []
    2626for i in ['LliboutryDuval', 'CuffeyTemperate']:
    27         print ' '
    28         print '====== Testing rheology law: ' + i + ' ====='
     27        print(' ')
     28        print('====== Testing rheology law: ' + i + ' =====')
    2929
    3030        md.materials.rheology_law = i
  • issm/trunk-jpl/test/NightlyRun/test701.py

    r23339 r23707  
    6262#md.initialization.pressure = md.constants.g*md.materials.rho_ice*(md.geometry.surface-md.mesh.y)
    6363for i in ['MINI','MINIcondensed','TaylorHood','LATaylorHood','CrouzeixRaviart','LACrouzeixRaviart']:
    64         print ' '
    65         print '======Testing ' +i+ ' Full-Stokes Finite element====='
     64        print(' ')
     65        print('======Testing ' +i+ ' Full-Stokes Finite element=====')
    6666        md.flowequation.fe_FS = i
    6767        md = solve(md,'Stressbalance')
  • issm/trunk-jpl/test/NightlyRun/test702.py

    r23339 r23707  
    7272field_values = []
    7373for i in ['MINI','MINIcondensed','TaylorHood','XTaylorHood','LATaylorHood']:
    74         print ' '
    75         print '======Testing ' +i+ ' Full-Stokes Finite element====='
     74        print(' ')
     75        print('======Testing ' +i+ ' Full-Stokes Finite element=====')
    7676        md.flowequation.fe_FS = i
    7777        md = solve(md,'Stressbalance')
  • issm/trunk-jpl/test/Par/ISMIPA.py

    r21409 r23707  
    44#Ok, start defining model parameters here
    55
    6 print "      creating thickness"
     6print("      creating thickness")
    77md.geometry.surface=-md.mesh.x*numpy.tan(0.5*numpy.pi/180.)
    88md.geometry.base=md.geometry.surface-1000.+500.*numpy.sin(md.mesh.x*2.*numpy.pi/numpy.max(md.mesh.x))*numpy.sin(md.mesh.y*2.*numpy.pi/numpy.max(md.mesh.x))
    99md.geometry.thickness=md.geometry.surface-md.geometry.base
    1010
    11 print "      creating drag"
     11print("      creating drag")
    1212md.friction.coefficient=200.*numpy.ones((md.mesh.numberofvertices))
    1313md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
     
    1515md.friction.q=numpy.ones((md.mesh.numberofelements))
    1616
    17 print "      creating flow law parameter"
     17print("      creating flow law parameter")
    1818md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices))
    1919md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    2020
    21 print "      boundary conditions for stressbalance model"
     21print("      boundary conditions for stressbalance model")
    2222#Create node on boundary first (because we cannot use mesh)
    2323md=SetIceSheetBC(md)
  • issm/trunk-jpl/test/Par/ISMIPB.py

    r21409 r23707  
    44#Ok, start defining model parameters here
    55
    6 print "      creating thickness"
     6print("      creating thickness")
    77md.geometry.surface=-md.mesh.x*numpy.tan(0.5*numpy.pi/180.)
    88md.geometry.base=md.geometry.surface-1000.+500.*numpy.sin(md.mesh.x*2.*numpy.pi/numpy.max(md.mesh.x))
    99md.geometry.thickness=md.geometry.surface-md.geometry.base
    1010
    11 print "      creating drag"
     11print("      creating drag")
    1212md.friction.coefficient=200.*numpy.ones((md.mesh.numberofvertices))
    1313md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
     
    1515md.friction.q=numpy.ones((md.mesh.numberofelements))
    1616
    17 print "      creating flow law parameter"
     17print("      creating flow law parameter")
    1818md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices))
    1919md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    2020
    21 print "      boundary conditions for stressbalance model"
     21print("      boundary conditions for stressbalance model")
    2222#Create node on boundary first (because we cannot use mesh)
    2323md=SetIceSheetBC(md)
  • issm/trunk-jpl/test/Par/ISMIPC.py

    r21409 r23707  
    44#Ok, start defining model parameters here
    55
    6 print "      creating thickness"
     6print("      creating thickness")
    77md.geometry.surface=2000.-md.mesh.x*numpy.tan(0.1*numpy.pi/180.)    #to have z>0
    88md.geometry.base=md.geometry.surface-1000.
    99md.geometry.thickness=md.geometry.surface-md.geometry.base
    1010
    11 print "      creating drag"
     11print("      creating drag")
    1212#md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x/2.)).*sin(md.mesh.y*2.*pi/max(md.mesh.x/2.)))./(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base)));
    1313md.friction.coefficient=numpy.sqrt(md.constants.yts*(1000.+1000.*numpy.sin(md.mesh.x*2.*numpy.pi/numpy.max(md.mesh.x))*numpy.sin(md.mesh.y*2.*numpy.pi/numpy.max(md.mesh.x))))
     
    1616md.friction.q=numpy.zeros((md.mesh.numberofelements))
    1717
    18 print "      creating flow law parameter"
     18print("      creating flow law parameter")
    1919md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices))
    2020md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    2121
    22 print "      boundary conditions for stressbalance model:"
     22print("      boundary conditions for stressbalance model:")
    2323#Create node on boundary first (because we can not use mesh)
    2424md=SetIceSheetBC(md)
  • issm/trunk-jpl/test/Par/ISMIPD.py

    r21409 r23707  
    44#Ok, start defining model parameters here
    55
    6 print "      creating thickness"
     6print("      creating thickness")
    77md.geometry.surface=2000.-md.mesh.x*numpy.tan(0.1*numpy.pi/180.)    #to have z>0
    88md.geometry.base=md.geometry.surface-1000.
    99md.geometry.thickness=md.geometry.surface-md.geometry.base
    1010
    11 print "      creating drag"
     11print("      creating drag")
    1212md.friction.coefficient=numpy.sqrt(md.constants.yts*(1000.+1000.*numpy.sin(md.mesh.x*2.*numpy.pi/numpy.max(md.mesh.x))))
    1313md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
     
    1515md.friction.q=numpy.zeros((md.mesh.numberofelements))
    1616
    17 print "      creating flow law parameter"
     17print("      creating flow law parameter")
    1818md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices))
    1919md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    2020
    21 print "      boundary conditions for stressbalance model:"
     21print("      boundary conditions for stressbalance model:")
    2222#Create node on boundary first (because we can not use mesh)
    2323md=SetIceSheetBC(md)
  • issm/trunk-jpl/test/Par/ISMIPE.py

    r22267 r23707  
    55#Ok, start defining model parameters here
    66
    7 print "      creating thickness"
     7print("      creating thickness")
    88data = numpy.array(archread('../Data/ISMIPE.arch','data'));
    99md.geometry.surface=numpy.zeros((md.mesh.numberofvertices))
    1010md.geometry.base=numpy.zeros((md.mesh.numberofvertices))
    11 for i in xrange(0,md.mesh.numberofvertices):
     11for i in range(0,md.mesh.numberofvertices):
    1212        y=md.mesh.y[i]
    1313        point1=numpy.floor(y/100.)
     
    2121md.geometry.base=md.geometry.surface-md.geometry.thickness
    2222
    23 print "      creating drag"
     23print("      creating drag")
    2424md.friction.coefficient=numpy.zeros((md.mesh.numberofvertices))
    2525md.friction.p=numpy.ones((md.mesh.numberofelements))
    2626md.friction.q=numpy.ones((md.mesh.numberofelements))
    2727
    28 print "      creating flow law parameter"
     28print("      creating flow law parameter")
    2929md.materials.rheology_B=6.8067*10**7*numpy.ones((md.mesh.numberofvertices))
    3030md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    3131
    32 print "      boundary conditions for stressbalance model:"
     32print("      boundary conditions for stressbalance model:")
    3333#Create node on boundary first (because we can not use mesh)
    3434md=SetIceSheetBC(md)
  • issm/trunk-jpl/test/Par/ISMIPF.py

    r21409 r23707  
    55md.verbose=2
    66
    7 print "      creating thickness"
     7print("      creating thickness")
    88md.geometry.surface=-md.mesh.x*numpy.tan(3.*numpy.pi/180.)
    99#md.geometry.base=md.geometry.surface-1000.
     
    1111md.geometry.thickness=md.geometry.surface-md.geometry.base
    1212
    13 print "      creating drag"
     13print("      creating drag")
    1414md.friction.coefficient=numpy.sqrt(md.constants.yts/(2.140373*10**-7*1000.))*numpy.ones((md.mesh.numberofvertices))
    1515md.friction.p=numpy.ones((md.mesh.numberofelements))
    1616md.friction.q=numpy.zeros((md.mesh.numberofelements))
    1717
    18 print "      creating flow law parameter"
     18print("      creating flow law parameter")
    1919md.materials.rheology_B=1.4734*10**14*numpy.ones((md.mesh.numberofvertices))
    2020md.materials.rheology_n=1.*numpy.ones((md.mesh.numberofelements))
    2121md.materials.rheology_law='None'
    2222
    23 print "      boundary conditions for stressbalance model"
     23print("      boundary conditions for stressbalance model")
    2424#Create node on boundary first (because we cannot use mesh)
    2525md=SetIceSheetBC(md)
  • issm/trunk-jpl/test/Par/RoundSheetEISMINT.py

    r21409 r23707  
    33
    44#Ok, start defining model parameters here
    5 print "      creating thickness"
     5print("      creating thickness")
    66md.geometry.thickness=10.*numpy.ones((md.mesh.numberofvertices))
    77md.geometry.base=numpy.zeros((md.mesh.numberofvertices))
    88md.geometry.surface=md.geometry.base+md.geometry.thickness
    99
    10 print "      creating drag"
     10print("      creating drag")
    1111md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices))
    1212md.friction.p=numpy.ones((md.mesh.numberofelements))
    1313md.friction.q=numpy.ones((md.mesh.numberofelements))
    1414
    15 print "      creating temperatures"
     15print("      creating temperatures")
    1616tmin=238.15    #K
    1717st=1.67*10**-2/1000.    #k/m
     
    2020md.basalforcings.geothermalflux=4.2*10**-2*numpy.ones((md.mesh.numberofvertices))
    2121
    22 print "      creating flow law parameter"
     22print("      creating flow law parameter")
    2323md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices))    #to have the same B as the analytical solution
    2424md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    2525
    26 print "      creating surface mass balance"
     26print("      creating surface mass balance")
    2727smb_max=0.5    #m/yr
    2828sb=10**-2/1000.    #m/yr/m
     
    3030md.smb.mass_balance=numpy.minimum(smb_max*numpy.ones_like(radius),sb*(rel-radius))
    3131
    32 print "      creating velocities"
     32print("      creating velocities")
    3333constant=0.3
    3434md.inversion.vx_obs=constant/2.*md.mesh.x*(md.geometry.thickness)**-1
     
    4141
    4242#Deal with boundary conditions:
    43 print "      boundary conditions for stressbalance model:"
     43print("      boundary conditions for stressbalance model:")
    4444md=SetMarineIceSheetBC(md,'../Exp/RoundFrontEISMINT.exp')
    4545
  • issm/trunk-jpl/test/Par/RoundSheetStaticEISMINT.py

    r21409 r23707  
    22from SetMarineIceSheetBC import SetMarineIceSheetBC
    33
    4 print "      creating thickness"
     4print("      creating thickness")
    55hmin=0.01
    66hmax=2756.7
     
    1212md.geometry.surface=md.geometry.base+md.geometry.thickness
    1313
    14 print "      creating drag"
     14print("      creating drag")
    1515md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices))
    1616md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
     
    1818md.friction.q=numpy.ones((md.mesh.numberofelements))
    1919
    20 print "      creating temperatures"
     20print("      creating temperatures")
    2121tmin=238.15    #K
    2222st=1.67*10**-2/1000.    #k/m
     
    2424md.basalforcings.geothermalflux=4.2*10**-2*numpy.ones((md.mesh.numberofvertices))
    2525
    26 print "      creating flow law parameter"
     26print("      creating flow law parameter")
    2727md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices))    #to have the same B as the analytical solution
    2828md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    2929
    30 print "      creating surface mass balance"
     30print("      creating surface mass balance")
    3131smb_max=0.5    #m/yr
    3232sb=10**-2/1000.    #m/yr/m
     
    3434md.smb.mass_balance=numpy.minimum(smb_max*numpy.ones_like(radius),sb*(rel-radius))
    3535
    36 print "      creating velocities"
     36print("      creating velocities")
    3737constant=0.3
    3838md.inversion.vx_obs=constant/2.*md.mesh.x*(md.geometry.thickness)**-1
     
    4545
    4646#Deal with boundary conditions:
    47 print "      boundary conditions for stressbalance model:"
     47print("      boundary conditions for stressbalance model:")
    4848md=SetMarineIceSheetBC(md,'../Exp/RoundFrontEISMINT.exp')
    4949
  • issm/trunk-jpl/test/Par/SquareEISMINT.py

    r21409 r23707  
    44#Ok, start defining model parameters here
    55
    6 print "      creating thickness"
     6print("      creating thickness")
    77ymin=numpy.min(md.mesh.y)
    88ymax=numpy.max(md.mesh.y)
     
    1111md.geometry.surface=md.geometry.base+md.geometry.thickness
    1212
    13 print "      creating drag"
     13print("      creating drag")
    1414md.friction.coefficient=200.*numpy.ones((md.mesh.numberofvertices))
    1515md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
     
    1717md.friction.q=numpy.ones((md.mesh.numberofelements))
    1818
    19 print "      creating initial values"
     19print("      creating initial values")
    2020md.initialization.temperature=(273.-20.)*numpy.ones((md.mesh.numberofvertices))
    2121md.initialization.vx=numpy.zeros((md.mesh.numberofvertices))
     
    2525md.initialization.pressure=numpy.zeros((md.mesh.numberofvertices))
    2626
    27 print "      creating flow law parameter"
     27print("      creating flow law parameter")
    2828md.materials.rheology_B=1.7687*10**8*numpy.ones((md.mesh.numberofvertices))
    2929md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    3030
    31 print "      creating surface mass balance"
     31print("      creating surface mass balance")
    3232md.smb.mass_balance=0.2*numpy.ones((md.mesh.numberofvertices))    #0m/a
    3333md.basalforcings.floatingice_melting_rate=0.*numpy.ones((md.mesh.numberofvertices))    #0m/a
    3434md.basalforcings.groundedice_melting_rate=0.*numpy.ones((md.mesh.numberofvertices))    #0m/a
    3535
    36 print "      boundary conditions"
     36print("      boundary conditions")
    3737md=SetMarineIceSheetBC(md,'../Exp/SquareFrontEISMINT.exp')
    3838
  • issm/trunk-jpl/test/Par/SquareShelfConstrained.py

    r22575 r23707  
    11import os.path
    2 from arch import *
     2from arch import archread
    33import numpy as np
    44import inspect
     
    2121md.geometry.bed=md.geometry.base-10;
    2222
    23 #Initial velocity
    24 #x         = np.reshape(np.array(archread('../Data/SquareShelfConstrained.arch','x')),(-1))
    25 #y         = np.reshape(np.array(archread('../Data/SquareShelfConstrained.arch','y')),(-1))
     23#Initial velocity
    2624x         = np.array(archread('../Data/SquareShelfConstrained.arch','x'))
    2725y         = np.array(archread('../Data/SquareShelfConstrained.arch','y'))
     
    5250
    5351#Numerical parameters
    54 md.masstransport.stabilization=1.
    55 md.thermal.stabilization=1.
     52md.masstransport.stabilization=1
     53md.thermal.stabilization=1
    5654md.verbose = verbose(0)
    5755md.settings.waitonlock=30
  • issm/trunk-jpl/test/Par/SquareThermal.py

    r22993 r23707  
    88md.groundingline.migration='None'
    99
    10 print "      creating thickness"
     10print("      creating thickness")
    1111h=1000.
    1212md.geometry.thickness=h*numpy.ones((md.mesh.numberofvertices))
     
    1414md.geometry.surface=md.geometry.base+md.geometry.thickness;
    1515
    16 print "      creating velocities"
     16print("      creating velocities")
    1717md.initialization.vx=numpy.zeros((md.mesh.numberofvertices))
    1818md.initialization.vy=numpy.zeros((md.mesh.numberofvertices))
    1919md.initialization.vz=numpy.zeros((md.mesh.numberofvertices))
    2020
    21 print "      creating drag"
     21print("      creating drag")
    2222md.friction.coefficient=200.*numpy.ones((md.mesh.numberofvertices))
    2323md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
     
    2525md.friction.q=numpy.ones((md.mesh.numberofelements))
    2626
    27 print "      creating temperatures"
     27print("      creating temperatures")
    2828md.initialization.temperature=(273.-20.)*numpy.ones((md.mesh.numberofvertices))
    2929md.initialization.pressure=numpy.zeros((md.mesh.numberofvertices,))
     
    3131md.initialization.watercolumn=numpy.zeros((md.mesh.numberofvertices,))
    3232
    33 print "      creating flow law parameter"
     33print("      creating flow law parameter")
    3434md.materials.rheology_B=paterson(md.initialization.temperature)
    3535md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
    3636
    37 print "      creating surface mass balance"
     37print("      creating surface mass balance")
    3838md.smb.mass_balance=numpy.ones((md.mesh.numberofvertices))/md.constants.yts    #1m/a
    3939#md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices))/md.constants.yts    #1m/a
     
    4343#Deal with boundary conditions:
    4444
    45 print "      boundary conditions for stressbalance model"
     45print("      boundary conditions for stressbalance model")
    4646md=SetMarineIceSheetBC(md,'../Exp/SquareFront.exp')
    4747
    48 print "      boundary conditions for thermal model"
     48print("      boundary conditions for thermal model")
    4949md.thermal.spctemperature[:]=md.initialization.temperature
    5050md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices))
Note: See TracChangeset for help on using the changeset viewer.