Skip to content

Conversation

@lboeman
Copy link
Member

@lboeman lboeman commented May 13, 2020

  • Closes Fix SRML sites #436 .
  • I am familiar with the contributing guidelines.
  • Tests added.
  • Updates entries to docs/source/api.rst for API changes.
  • Adds descriptions to appropriate "what's new" file in docs/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Maintainer: Appropriate GitHub Labels and Milestone are assigned to the Pull Request and linked Issue.

This PR does a few things:

  • Removes SRML sites that haven't reported data for a while.
  • When initializing SRML sites, use a data file from 30 days ago to ensure there's actually a file. Due to the delay, some of the current SRML sites in prod don't have observations.
  • Add power observations for Ashland OR, Kalapuya HS, Bend OR, and Portland OR PV. I've added a PV suffix to the end of each of their names. I've used the json format that was introduced in add pvdaq reference sites, fetch, config #438, for the PV sites.
  • Adds a top level "reference observations" page to the documents as suggested in Add reference event observations and forecasts #429. I've tried to update the explanation from that PR. I think it still needs work.

@lboeman lboeman changed the title Adjust srml Adjust srml, Add reference obs documentation May 13, 2020
@lboeman lboeman force-pushed the adjust-srml branch 2 times, most recently from 2dc1f9c to 6f63ce5 Compare May 14, 2020 17:41
@lboeman lboeman requested a review from wholmgren May 14, 2020 17:48
@wholmgren wholmgren added this to the 1.0 release candidate milestone May 14, 2020
@wholmgren wholmgren added enhancement New feature or request IO Issue pertains to data IO bug Something isn't working labels May 14, 2020
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. minor comments...

logger = logging.getLogger('reference_data')


def adjust_site_parameters(site):
Copy link
Member

Choose a reason for hiding this comment

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

looks like nearly a copy of the pvdaq function. should we refactor into common?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. Minimal changes would be to move the meat to common with a sitefile kwarg then just call that from pvdaq/srml with the right sitefile

@wholmgren
Copy link
Member

There were a handful of warnings related to the new files when building the docs. Check the readthedocs build log or build locally (make -C docs html)

Comment on lines 157 to 179
def request_data_test(mocker, exception, test_site, test_data):
get_func = mocker.patch(
'solarforecastarbiter.io.reference_observations.srml.iotools.'
'read_srml_month_from_solardat')
get_func.return_value = test_data
data = srml.request_data(test_site, 1, 1)
assert_frame_equal(data, test_data)


@pytest.mark.parametrize('exception', [
pd.errors.EmptyDataError,
error.URLError,
])
def request_data_test_warnings(mocker, exception, test_site):
logger = mocker.patch(
'solarforecastarbiter.io.reference_observations.srml.iotools.'
'logger.warning')
get_func = mocker.patch(
'solarforecastarbiter.io.reference_observations.srml.iotools.'
'read_srml_month_from_solardat')
get_func.side_effect = exception()
data = srml.request_data(test_site, 1, 1)
assert logger.call_count == 5
assert data is None
Copy link
Member

Choose a reason for hiding this comment

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

Are these tests actually run? They don't start with test_ so I would assume not. Also codecov says no.

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.

@alorenzo175 probably worthwhile for you to give this a quick review

@lboeman
Copy link
Member Author

lboeman commented May 27, 2020

I factored out the modelling parameter adjustment code into common.py, but I can't figure out what's causing the FileNotFound error in the tests. I've copied the behavior used for the tests in io.fetch that have their own test data. @alorenzo175 any ideas on what's wrong here?

@alorenzo175
Copy link
Contributor

I'm not seeing the test file at all. Did it git ignored and not committed?

site_out = site.copy()
site_out['modeling_parameters'] = site_metadata[
'modeling_parameters']
site_out['extra_parameters'].update(site_extra_params)
Copy link
Contributor

Choose a reason for hiding this comment

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

missing from the combined function

test_json_site_file,
{'extra_parameters': params},
)
assert 'modeling_parameters' in new_site
Copy link
Contributor

Choose a reason for hiding this comment

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

make sure extra_parameters are updated

@alorenzo175 alorenzo175 merged commit fb643db into SolarArbiter:master May 27, 2020
@lboeman lboeman deleted the adjust-srml branch August 16, 2021 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request IO Issue pertains to data IO

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix SRML sites

3 participants