Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/sphinx/source/forecasts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ problems.
data = data.join(irrad_data, how='outer')

# keep only the final data
data = data.ix[:, model.output_variables]
data = data[model.output_variables]

print(data.head())

Expand Down
8 changes: 4 additions & 4 deletions docs/sphinx/source/timetimezones.rst
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ print just a few of the rows and columns of the large dataframe.

tmy3_data.index.tz

tmy3_data.ix[0:3, ['GHI', 'DNI', 'AOD']]
tmy3_data.loc[tmy3_data.index[0:3], ['GHI', 'DNI', 'AOD']]

The :py:func:`~pvlib.tmy.readtmy2` function also returns a DataFrame
with a localized DatetimeIndex.
Expand All @@ -309,7 +309,7 @@ DataFrame's index since the index has been localized.
tmy3_metadata['latitude'],
tmy3_metadata['longitude'])

ax = solar_position.ix[0:24, ['apparent_zenith', 'apparent_elevation', 'azimuth']].plot()
ax = solar_position.loc[solar_position.index[0:24], ['apparent_zenith', 'apparent_elevation', 'azimuth']].plot()

ax.legend(loc=1);
ax.axhline(0, color='darkgray'); # add 0 deg line for sunrise/sunset
Expand Down Expand Up @@ -340,7 +340,7 @@ below? The solar position calculator will assume UTC time.
tmy3_metadata['latitude'],
tmy3_metadata['longitude'])

ax = solar_position_notz.ix[0:24, ['apparent_zenith', 'apparent_elevation', 'azimuth']].plot()
ax = solar_position_notz.loc[solar_position_notz.index[0:24], ['apparent_zenith', 'apparent_elevation', 'azimuth']].plot()

ax.legend(loc=1);
ax.axhline(0, color='darkgray'); # add 0 deg line for sunrise/sunset
Expand All @@ -365,7 +365,7 @@ UTC, and then convert it to the desired time zone.

solar_position_hack.index

ax = solar_position_hack.ix[0:24, ['apparent_zenith', 'apparent_elevation', 'azimuth']].plot()
ax = solar_position_hack.loc[solar_position_hack.index[0:24], ['apparent_zenith', 'apparent_elevation', 'azimuth']].plot()

ax.legend(loc=1);
ax.axhline(0, color='darkgray'); # add 0 deg line for sunrise/sunset
Expand Down
2 changes: 2 additions & 0 deletions docs/sphinx/source/whatsnew/v0.4.5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Bug fixes
* Added NREL Bird clear sky model. (:issue:`276`)
* Added lower accuracy formulas for equation of time, declination, hour angle
and solar zenith.
* Remove all instances of .ix (:issue:`322`)


Enhancements
~~~~~~~~~~~~~
Expand Down
458 changes: 185 additions & 273 deletions docs/tutorials/pvsystem.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pvlib/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
data['wind_speed'] = self.uv_to_speed(data)
irrads = self.cloud_cover_to_irradiance(data[cloud_cover], **kwargs)
data = data.join(irrads, how='outer')
return data.ix[:, self.output_variables]
return data[self.output_variables]


class HRRR_ESRL(ForecastModel):
Expand Down Expand Up @@ -790,7 +790,7 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
data['wind_speed'] = self.gust_to_speed(data)
irrads = self.cloud_cover_to_irradiance(data[cloud_cover], **kwargs)
data = data.join(irrads, how='outer')
return data.ix[:, self.output_variables]
return data[self.output_variables]


class NAM(ForecastModel):
Expand Down Expand Up @@ -871,7 +871,7 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
data['wind_speed'] = self.gust_to_speed(data)
irrads = self.cloud_cover_to_irradiance(data[cloud_cover], **kwargs)
data = data.join(irrads, how='outer')
return data.ix[:, self.output_variables]
return data[self.output_variables]


class HRRR(ForecastModel):
Expand Down Expand Up @@ -955,7 +955,7 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
data['wind_speed'] = self.gust_to_speed(data)
irrads = self.cloud_cover_to_irradiance(data[cloud_cover], **kwargs)
data = data.join(irrads, how='outer')
return data.ix[:, self.output_variables]
return data[self.output_variables]


class NDFD(ForecastModel):
Expand Down Expand Up @@ -1024,7 +1024,7 @@ def process_data(self, data, **kwargs):
data['temp_air'] = self.kelvin_to_celsius(data['temp_air'])
irrads = self.cloud_cover_to_irradiance(data[cloud_cover], **kwargs)
data = data.join(irrads, how='outer')
return data.ix[:, self.output_variables]
return data[self.output_variables]


class RAP(ForecastModel):
Expand Down Expand Up @@ -1109,4 +1109,4 @@ def process_data(self, data, cloud_cover='total_clouds', **kwargs):
data['wind_speed'] = self.gust_to_speed(data)
irrads = self.cloud_cover_to_irradiance(data[cloud_cover], **kwargs)
data = data.join(irrads, how='outer')
return data.ix[:, self.output_variables]
return data[self.output_variables]
5 changes: 3 additions & 2 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,9 +1059,10 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
mask = sky_diffuse == 0
if isinstance(sky_diffuse, pd.Series):
diffuse_components = pd.DataFrame(diffuse_components)
diffuse_components.ix[mask] = 0
diffuse_components.loc[mask] = 0
else:
diffuse_components = {k: np.where(mask, 0, v) for k, v in diffuse_components.items()}
diffuse_components = {k: np.where(mask, 0, v) for k, v in
diffuse_components.items()}

return sky_diffuse, diffuse_components

Expand Down
2 changes: 1 addition & 1 deletion pvlib/test/test_clearsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,6 @@ def test_bird():
# XXX: testdata starts at 1am so noon is at index = 11
np.allclose(
[Eb3, Ebh3, Gh3, Dh3],
testdata2.ix[11, ['Direct Beam', 'Direct Hz', 'Global Hz', 'Dif Hz']],
testdata2[['Direct Beam', 'Direct Hz', 'Global Hz', 'Dif Hz']].iloc[11],
rtol=1e-3)
return pd.DataFrame({'Eb': Eb, 'Ebh': Ebh, 'Gh': Gh, 'Dh': Dh}, index=times)
8 changes: 4 additions & 4 deletions pvlib/test/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,16 @@ def test_PVSystem_scale_voltage_current_power():

def test_sapm_celltemp():
default = pvsystem.sapm_celltemp(900, 5, 20)
assert_allclose(43.509, default.ix[0, 'temp_cell'], 3)
assert_allclose(40.809, default.ix[0, 'temp_module'], 3)
assert_allclose(43.509, default['temp_cell'], 3)
assert_allclose(40.809, default['temp_module'], 3)
assert_frame_equal(default, pvsystem.sapm_celltemp(900, 5, 20,
[-3.47, -.0594, 3]))


def test_sapm_celltemp_dict_like():
default = pvsystem.sapm_celltemp(900, 5, 20)
assert_allclose(43.509, default.ix[0, 'temp_cell'], 3)
assert_allclose(40.809, default.ix[0, 'temp_module'], 3)
assert_allclose(43.509, default['temp_cell'], 3)
assert_allclose(40.809, default['temp_module'], 3)
model = {'a':-3.47, 'b':-.0594, 'deltaT':3}
assert_frame_equal(default, pvsystem.sapm_celltemp(900, 5, 20, model))
model = pd.Series(model)
Expand Down