Skip to content

Add parsing for non 1-minute data to UO SRML parser #711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 8, 2019

Conversation

lboeman
Copy link
Contributor

@lboeman lboeman commented May 6, 2019

pvlib python pull request guidelines

Thank you for your contribution to pvlib python! You may delete all of these instructions except for the list below.

You may submit a pull request with your code at any stage of completion.

The following items must be addressed before the code can be merged. Please don't hesitate to ask for help if you're unsure of how to accomplish any of the items below:

  • Closes Erroneous timestamp parsing in UO SRML reader #709
  • I am familiar with the contributing guidelines.
  • Fully tested. Added and/or modified tests to ensure correct behavior for all reasonable inputs. Tests (usually) must pass on the TravisCI and Appveyor testing services.
  • Updates entries to docs/sphinx/source/api.rst for API changes.
  • Adds description and name entries in the appropriate docs/sphinx/source/whatsnew file for all changes.
  • Code quality and style is sufficient. Passes LGTM and SticklerCI checks.
  • New code is fully documented. Includes sphinx/numpydoc compliant docstrings and comments in the code where necessary.
  • Pull request is nearly complete and ready for detailed review.

with pandas' default labeling behavior.
The time index is shifted back by one interval to account for the
daily endtime of 2400, and to avoid time parsing errors on leap
years. The returned data values should be understood to occur
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are labeled by the left endpoint of interval, and should be understood...

# subracting the length of one interval and then correcting the times
# at each former hour. interval_length is determined by taking the
# difference of the first two rows of the time column.
interval_length = int(df[df.columns[1]][:2].diff()[1])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line would be easier to read as, e.g., interval_length = df[df.columns[0]][1] - df[df.columns[0]][0]

fifty_nines = df_time % 100 == 99
times = df_time.where(~fifty_nines, df_time - 40)

# subracting the length of one interval and then correcting the times
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment like "e.g. the first two rows of hourly data are 100, 200, so interval length = 100"

# Hourly files do not require fixing the former hour timestamps.
times = df_time
else:
old_hours = df_time % 100 == (100 - interval_length)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs a few comments

@lboeman
Copy link
Contributor Author

lboeman commented May 7, 2019

I updated the logic for fixing the hour times. I didn't think of checking value % 100 < 60 to locate the indices that were previously aligned with hours, but that logic seems easier to comprehend and slightly cheaper to perform.

@wholmgren wholmgren added bug solarfx2 DOE SETO Solar Forecasting 2 / Solar Forecast Arbiter labels May 7, 2019
@wholmgren wholmgren added this to the 0.6.2 milestone May 7, 2019
Copy link
Member

@wholmgren wholmgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@wholmgren wholmgren merged commit 8fe314c into pvlib:master May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug solarfx2 DOE SETO Solar Forecasting 2 / Solar Forecast Arbiter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Erroneous timestamp parsing in UO SRML reader
3 participants