Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions SLcode_py/SL_equation_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def love_lm(num, group='m'):
"""
num = num[:maxdeg]
h = np.hstack(( 0, num.squeeze() ))
h_lm = [];
print group
h_lm = []
print (group)
if group == 'l':
# This is the standard for Jerry's code
for l in range(maxdeg+1):
Expand Down Expand Up @@ -295,13 +295,13 @@ def calc_rot(L_in, _k, _k_tide, group='l'):
L20 = L_in[3]
L21 = L_in[4]
L22 = L_in[5]
print L22
print (L22)
elif group == 'm':
print "WARN: hard-coded max l,m; will break!"
print ("WARN: hard-coded max l,m; will break!")
L20 = L_in[2]
L21 = L_in[maxdeg+2]
L22 = L_in[2*maxdeg + 1]
print L22
print (L22)
k_L = _k[1] # This has 256 values
k_T = _k_tide[1] # This has 256 values

Expand Down Expand Up @@ -355,7 +355,7 @@ def calc_rot(L_in, _k, _k_tide, group='l'):
# Iteration criterion epsilon
while (k < k_max) and (chi >= epsilon):

#print chi
#print (chi)

# expand ocean function into spherical harmonics
# in m-first ordering
Expand Down Expand Up @@ -467,14 +467,14 @@ def calc_rot(L_in, _k, _k_tide, group='l'):
k += 1

if chi < epsilon:
print 'Converged after iteration', k, 'Chi was', chi
print ('Converged after iteration', k, 'Chi was', chi)
else:
print 'Did not yet converge.'
print 'Finished iteration', k, '; Chi was', chi
print ('Did not yet converge.')
print ('Finished iteration', k, '; Chi was', chi)

end_time = time.time()

print "Time elapsed in k loop", end_time - start_time
print ("Time elapsed in k loop", end_time - start_time)

# calculate the scaling to normalize the fingerprint (it's normalized to be
# one on average, when averaged over the final ocean basin).
Expand Down
6 changes: 3 additions & 3 deletions SLcode_py/pyspharm.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def specdata(self):
vrtg = x.spectogrd(vrtspec)
ug,vg = x.getuv(vrtspec,divspec)
phig = x.spectogrd(phispec)
print 't=%6.2f hours: min/max %6.2f, %6.2f' % (t/3600.,vg.min(), vg.max())
print ('t=%6.2f hours: min/max %6.2f, %6.2f' % (t/3600.,vg.min(), vg.max()))
# compute tendencies.
tmpg1 = ug*(vrtg+f); tmpg2 = vg*(vrtg+f)
ddivdtspec[:,nnew], dvrtdtspec[:,nnew] = x.getvrtdivspec(tmpg1,tmpg2)
Expand Down Expand Up @@ -233,13 +233,13 @@ def specdata(self):
nnew = nold; nnow = nsav1; nold = nsav2

time2 = time.clock()
print 'CPU time = ',time2-time1
print ('CPU time = ',time2-time1)

# make a orthographic plot of potential vorticity.
m = Basemap(projection='ortho',lat_0=45,lon_0=0)
# dimensionless PV
pvg = (0.5*hbar*grav/omega)*(vrtg+f)/phig
print 'max/min PV',pvg.min(), pvg.max()
print ('max/min PV',pvg.min(), pvg.max())
lons1d = (180./np.pi)*x.lons; lats1d = (180./np.pi)*x.lats
pvg,lons1d = addcyclic(pvg,lons1d)
lons, lats = np.meshgrid(lons1d,lats1d)
Expand Down