Ignore:
Timestamp:
03/13/19 03:17:46 (6 years ago)
Author:
bdef
Message:

pep8 compliance of NTs

File:
1 edited

Legend:

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

    r23707 r23793  
    1 #Test Name: SquareShelfTranIspddIsdeltaO18pdInterpSSA2d 
     1#Test Name: SquareShelfTranIspddIsdeltaO18pdInterpSSA2d
    22import numpy as np
    33from model import *
     
    1010
    1111
    12 md=triangle(model(),'../Exp/Square.exp',150000.)
    13 md=setmask(md,'all','')
    14 md=parameterize(md,'../Par/SquareShelf.py')
     12md = triangle(model(), '../Exp/Square.exp', 150000.)
     13md = setmask(md, 'all', '')
     14md = parameterize(md, '../Par/SquareShelf.py')
    1515
    1616# Use of ispdd and isdelta18o methods
    1717md.smb = SMBd18opdd()
    18 md.smb.isd18opd=1
     18md.smb.isd18opd = 1
    1919
    2020# Add temperature, precipitation and delta18o needed to measure the surface mass balance
    2121# creating delta18o
    22 delta18o=np.loadtxt('../Data/delta18o.data')
    23 md.smb.delta18o=delta18o
     22delta18o = np.loadtxt('../Data/delta18o.data')
     23md.smb.delta18o = delta18o
    2424
    2525# creating Present day temperatures
    2626# Same temperature over the all region:
    27 tmonth=np.ones(12)*(238.15+20.)
    28 md.smb.temperatures_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    29 for imonth in range(0,12):
    30     md.smb.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
     27tmonth = np.ones(12) * (238.15 + 20.)
     28md.smb.temperatures_presentday = np.zeros((md.mesh.numberofvertices + 1, 12))
     29for imonth in range(0, 12):
     30    md.smb.temperatures_presentday[0:md.mesh.numberofvertices, imonth] = tmonth[imonth]
    3131    # Time for the last line:
    32     md.smb.temperatures_presentday[md.mesh.numberofvertices,imonth]=(float(imonth)/12.)
     32    md.smb.temperatures_presentday[md.mesh.numberofvertices, imonth] = (float(imonth) / 12.)
    3333
    3434# creating initialization and spc temperatures initialization and spc
    35 md.thermal.spctemperature=np.mean(md.smb.temperatures_presentday[0:md.mesh.numberofvertices,:],axis=1).reshape(-1,1)
    36 md.thermal.spctemperature=md.thermal.spctemperature-10
    37 md.initialization.temperature=md.thermal.spctemperature
     35md.thermal.spctemperature = np.mean(md.smb.temperatures_presentday[0:md.mesh.numberofvertices, :], axis=1).reshape(-1, 1)
     36md.thermal.spctemperature = md.thermal.spctemperature - 10
     37md.initialization.temperature = md.thermal.spctemperature
    3838md.smb.initialize(md)
    3939
    4040# creating precipitation
    41 md.smb.precipitations_presentday=np.zeros((md.mesh.numberofvertices+1,12))
    42 for imonth in range(0,12):
    43     md.smb.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
    44     md.smb.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
     41md.smb.precipitations_presentday = np.zeros((md.mesh.numberofvertices + 1, 12))
     42for imonth in range(0, 12):
     43    md.smb.precipitations_presentday[0:md.mesh.numberofvertices, imonth] = -0.4 * 10**(-6) * md.mesh.y + 0.5
     44    md.smb.precipitations_presentday[md.mesh.numberofvertices, imonth] = ((float(imonth) + 1.) / 12.)
    4545
    4646# time steps and resolution
    47 md.timestepping.time_step=0.5
    48 md.settings.output_frequency=1
    49 md.timestepping.final_time=2
     47md.timestepping.time_step = 0.5
     48md.settings.output_frequency = 1
     49md.timestepping.final_time = 2
    5050
    51 # 
    52 md.transient.requested_outputs=['default','SmbMonthlytemperatures']
    53 md=setflowequation(md,'SSA','all')
    54 md.cluster=generic('name',gethostname(),'np',3)
    55 md=solve(md,'Transient')
     51#
     52md.transient.requested_outputs = ['default', 'SmbMonthlytemperatures']
     53md = setflowequation(md, 'SSA', 'all')
     54md.cluster = generic('name', gethostname(), 'np', 3)
     55md = solve(md, 'Transient')
    5656
    5757#Fields and tolerances to track changes
    58 field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMonthlytemperatures1','SmbMassBalance1',\
    59                             'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMonthlytemperatures2','SmbMassBalance2',\
    60                                       'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMonthlytemperatures3','SmbMassBalance3']
    61 field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
    62                             1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
    63                                  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
    64 field_values=[\
    65         md.results.TransientSolution[0].Vx,\
    66         md.results.TransientSolution[0].Vy,\
    67         md.results.TransientSolution[0].Vel,\
    68         md.results.TransientSolution[0].Pressure,\
    69         md.results.TransientSolution[0].Base,\
    70         md.results.TransientSolution[0].Surface,\
    71         md.results.TransientSolution[0].Thickness,\
    72         md.results.TransientSolution[0].SmbMonthlytemperatures,\
    73         md.results.TransientSolution[0].SmbMassBalance,\
    74         md.results.TransientSolution[1].Vx,\
    75         md.results.TransientSolution[1].Vy,\
    76         md.results.TransientSolution[1].Vel,\
    77         md.results.TransientSolution[1].Pressure,\
    78         md.results.TransientSolution[1].Base,\
    79         md.results.TransientSolution[1].Surface,\
    80         md.results.TransientSolution[1].Thickness,\
    81         md.results.TransientSolution[1].SmbMonthlytemperatures,\
    82         md.results.TransientSolution[1].SmbMassBalance,\
    83         md.results.TransientSolution[2].Vx,\
    84         md.results.TransientSolution[2].Vy,\
    85         md.results.TransientSolution[2].Vel,\
    86         md.results.TransientSolution[2].Pressure,\
    87         md.results.TransientSolution[2].Base,\
    88         md.results.TransientSolution[2].Surface,\
    89         md.results.TransientSolution[2].Thickness,\
    90         md.results.TransientSolution[2].SmbMonthlytemperatures,\
    91         md.results.TransientSolution[2].SmbMassBalance,\
    92         ]
     58field_names = ['Vx1', 'Vy1', 'Vel1', 'Pressure1', 'Bed1', 'Surface1', 'Thickness1', 'SmbMonthlytemperatures1', 'SmbMassBalance1',
     59               'Vx2', 'Vy2', 'Vel2', 'Pressure2', 'Bed2', 'Surface2', 'Thickness2', 'SmbMonthlytemperatures2', 'SmbMassBalance2',
     60               'Vx3', 'Vy3', 'Vel3', 'Pressure3', 'Bed3', 'Surface3', 'Thickness3', 'SmbMonthlytemperatures3', 'SmbMassBalance3']
     61field_tolerances = [1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13,
     62                    1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13,
     63                    1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13]
     64field_values = [md.results.TransientSolution[0].Vx,
     65                md.results.TransientSolution[0].Vy,
     66                md.results.TransientSolution[0].Vel,
     67                md.results.TransientSolution[0].Pressure,
     68                md.results.TransientSolution[0].Base,
     69                md.results.TransientSolution[0].Surface,
     70                md.results.TransientSolution[0].Thickness,
     71                md.results.TransientSolution[0].SmbMonthlytemperatures,
     72                md.results.TransientSolution[0].SmbMassBalance,
     73                md.results.TransientSolution[1].Vx,
     74                md.results.TransientSolution[1].Vy,
     75                md.results.TransientSolution[1].Vel,
     76                md.results.TransientSolution[1].Pressure,
     77                md.results.TransientSolution[1].Base,
     78                md.results.TransientSolution[1].Surface,
     79                md.results.TransientSolution[1].Thickness,
     80                md.results.TransientSolution[1].SmbMonthlytemperatures,
     81                md.results.TransientSolution[1].SmbMassBalance,
     82                md.results.TransientSolution[2].Vx,
     83                md.results.TransientSolution[2].Vy,
     84                md.results.TransientSolution[2].Vel,
     85                md.results.TransientSolution[2].Pressure,
     86                md.results.TransientSolution[2].Base,
     87                md.results.TransientSolution[2].Surface,
     88                md.results.TransientSolution[2].Thickness,
     89                md.results.TransientSolution[2].SmbMonthlytemperatures,
     90                md.results.TransientSolution[2].SmbMassBalance]
Note: See TracChangeset for help on using the changeset viewer.