Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Commit

Permalink
Implement small fixes to please pylint
Browse files Browse the repository at this point in the history
Currently a bug with assigning to arrays created with `*_like(arr)`
  ref: pylint-dev/pylint#2747
  • Loading branch information
zmoon committed Jul 30, 2019
1 parent 0b53769 commit 50ef292
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pyspctral2.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def correct(self,

#> load raw data from the SPCTRAL2 run
# first row in raw file is NREL SPA computed solar zenith angle
with open(self.raw_ofname, 'r') as f:
sza = f.readline().rstrip()
# with open(self.raw_ofname, 'r') as f:
# sza = f.readline().rstrip()
wl, Idr, Idf = np.loadtxt(self.raw_ofname, delimiter=',', skiprows=1, unpack=True)

#> NaN -> 0
Expand Down Expand Up @@ -306,7 +306,8 @@ def correct(self,
if measured_val:
cf_band = measured_val / I_meas_sp2 # correction factor using measured broadband irradiance value
if total_solar:
cf = np.ones_like(wl)
#cf = np.ones_like(wl)
cf = np.ones(wl.shape) # to please pylint
cf[wl_meas] = cf_band
cf[wl_meas_not] = (total_solar-measured_val) / I_meas_not_sp2
else:
Expand Down Expand Up @@ -386,7 +387,8 @@ def combine(casename='blah', time=[], info=''):

#> build Idr and Idf arrays
Idr = np.zeros((nt, nwl))
Idf = np.zeros_like(Idr)
#Idf = np.zeros_like(Idr)
Idf = np.zeros(Idr.shape) # to please pylint
for i, f in enumerate(files_corrected):
#print i, f
wl, dwl, Idri, Idfi = np.loadtxt(f, delimiter=',', unpack=True)
Expand Down Expand Up @@ -432,7 +434,7 @@ def plot_spectrum(casename='test', ID='001', output_type='raw',
if output_type == 'raw':
wl, Idr, Idf = np.loadtxt(ofpath, delimiter=',', skiprows=1, unpack=True)
elif output_type == 'corrected':
wl, dwl, Idr, Idf = np.loadtxt(ofpath, delimiter=',', skiprows=1, unpack=True)
wl, _, Idr, Idf = np.loadtxt(ofpath, delimiter=',', skiprows=1, unpack=True)
else:
print('invalid output_type selection') # should raise error instead...
return False
Expand Down

0 comments on commit 50ef292

Please sign in to comment.