Skip to content

Commit

Permalink
delete zeros before first non-zero value in OPSD capacity data
Browse files Browse the repository at this point in the history
  • Loading branch information
jgmill committed May 16, 2019
1 parent a46bb02 commit 7958fa4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions timeseries_scripts/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,13 @@ def read_opsd(filepath, param_dict, headers):
keep = ['wind', 'wind_onshore', 'wind_offshore', 'solar']
df = df.loc[:, (slice(None), keep)]

# delete zeros before first non-zero value in each column
for col_name, col in df.iteritems():
nan_for_zero = col.replace(0, np.nan)
slicer = ((col.index <= nan_for_zero.first_valid_index()) |
(col.index >= nan_for_zero.last_valid_index()))
col.loc[slicer] = np.nan

# The capacities data only has one entry per day, which pandas
# interprets as 00:00h. We will broadcast the dayly data for
# all quarter-hours of the day until the next given data point.
Expand Down

0 comments on commit 7958fa4

Please sign in to comment.