Skip to content

Commit

Permalink
python 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
bqpd committed Feb 28, 2020
1 parent 985ae43 commit 90c91cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions gassolar/environment/solar_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_Eirr(latitude, day, N=50.0):
0.002697*cos(3*beta) + 0.00148*sin(3*beta))
tstart = 12/np.pi*arccos(-tan(delta)*tan(lat))
tend = -tstart
t = np.linspace(tstart, tend, N)
t = np.linspace(tstart, tend, int(N))
costhsun = sin(delta)*sin(lat) + cos(delta)*cos(lat)*cos(2*np.pi*t/24)

r0 = 149.597e6 # avg distance from earth to sun km
Expand Down Expand Up @@ -65,7 +65,7 @@ def twi_fits(latitude, day, gen=False):
y = np.log(2*C[:-14])
cn, err = fit(x, y, 1, "MA")
rm = err
print "RMS error: %.4f" % rm
print("RMS error: %.4f" % rm)
dftw = cn.get_fitdata()
if not gen:
fig1, ax1 = plt.subplots()
Expand All @@ -87,7 +87,7 @@ def twi_fits(latitude, day, gen=False):
y = np.log(2*B[:-14])
cn, err = fit(x, y, 1, "MA")
rm = err
print "RMS error: %.4f" % rm
print("RMS error: %.4f" % rm)
dfday = cn.get_fitdata()
if not gen:
yfit = cn.evaluate(x)
Expand Down Expand Up @@ -188,4 +188,3 @@ def twi_fits(latitude, day, gen=False):
df.to_csv("solar_dayfit.csv")
else:
_, _ = twi_fits([30], 355, gen=True)

2 changes: 1 addition & 1 deletion gassolar/environment/wind_speeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_windspeed(latitude, perc, altitude, day, NS="NS", path=PATH):
path += month + os.sep

# pressure ranges for which there is data
pressures = [5, 10, 30] + range(50, 1050, 50)
pressures = [5, 10, 30] + list(range(50, 1050, 50))
pressures = np.array(pressures)
filename = None

Expand Down
2 changes: 1 addition & 1 deletion runtests.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python -c "from gpkit.tests.from_paths import run; run()"
python -c "from gpkit.tests.from_paths import run; run(skipsolvers='look around')"

0 comments on commit 90c91cc

Please sign in to comment.