Skip to content
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

Add retrieval functions for daily precip, snow, and temperature data from NOAA RCC ACIS #1767

Merged
merged 19 commits into from Jun 29, 2023

Conversation

kandersolar
Copy link
Member

@kandersolar kandersolar commented Jun 10, 2023

  • Closes get PRISM rainfall data #1293
  • I am familiar with the contributing guidelines
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/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.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

ACIS provides precipitation estimates from PRISM, plus three other gridded datasets. No registration needed.

ACIS has another API endpoint for station-recorded (not gridded) data that supplies snowfall, among other variables. Possible future PR for that. now included in this PR

@kandersolar kandersolar added enhancement io remote-data triggers --remote-data pytests labels Jun 10, 2023
@kandersolar kandersolar added this to the 0.10.0 milestone Jun 10, 2023
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Jun 10, 2023
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Jun 10, 2023
@kandersolar
Copy link
Member Author

Test failures are something to do with forecasts which I'm not excited about debugging given #1766.

Copy link
Member

@AdamRJensen AdamRJensen left a comment

Choose a reason for hiding this comment

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

Awesome contribution!

pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
@kandersolar
Copy link
Member Author

After further consideration, I think there are enough differences between datasets that it makes sense to rewrite this PR so that there is a 1:1 correspondence between get_ functions here and datasets in the API. Otherwise the code becomes a mess trying to handle all the datasets in a single function. Marking this PR back to draft for now.

@kandersolar kandersolar marked this pull request as draft June 15, 2023 18:51
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Jun 16, 2023
@kandersolar kandersolar changed the title Add retrieval function for gridded precipitation data from NOAA RCC ACIS Add retrieval functions for precip, snow, temperaturedata from NOAA RCC ACIS Jun 16, 2023
@kandersolar kandersolar removed the remote-data triggers --remote-data pytests label Jun 16, 2023
@kandersolar kandersolar added the remote-data triggers --remote-data pytests label Jun 16, 2023
@kandersolar kandersolar marked this pull request as ready for review June 16, 2023 16:56
@kandersolar
Copy link
Member Author

@AdamRJensen this is ready for another look. In addition to splitting up the function as mentioned above, I also added functions for the weather station dataset.

A discussion point: currently, get_acis_station_data returns precipitation in mm but snow in cm, for consistency with relevant PV models (pvlib.soiling takes rainfall in mm; pvlib.snow takes snowfall in cm). Is that the right choice?

Test failures are pvlib.forecast and can be ignored here.

@kandersolar kandersolar changed the title Add retrieval functions for precip, snow, temperaturedata from NOAA RCC ACIS Add retrieval functions for daily precip, snow, and temperature data from NOAA RCC ACIS Jun 17, 2023
Copy link
Member

@AdamRJensen AdamRJensen left a comment

Choose a reason for hiding this comment

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

I'll play more around with the functions in the next couple of days.

My main concern is that it is a lot of functions (clutter) compared to the previous state of the PR which had it combined into one function. But it looks solid!

pvlib/iotools/acis.py Outdated Show resolved Hide resolved
# time series names
'pcpn': 'precipitation',
'maxt': 'temp_air_max',
'avgt': 'temp_air_average',
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps remove _average if this is almost always the temperature of interest for PV applications? For example, the bsrn function doesn't append _average but does append _min and _max.

Copy link
Member Author

Choose a reason for hiding this comment

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

I lean towards keeping the _average suffix here. Daily values seem different enough from the higher-resolution values that we call temp_air that consistency with the other names in this dict seems more important to me. It doesn't make sense to feed these values into ModelChain.run_model, for example.

pvlib/iotools/acis.py Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
kandersolar and others added 2 commits June 27, 2023 09:49
Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com>
Copy link
Member Author

@kandersolar kandersolar left a comment

Choose a reason for hiding this comment

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

Thanks @AdamRJensen!

My main concern is that it is a lot of functions (clutter) compared to the previous state of the PR which had it combined into one function.

Yes, it does add a bit of clutter to the API listing. But there are enough differences between the datasets that I thought splitting it up would make it easier to use and more straightforward to maintain, which seemed more important.

Any thoughts on this question from #1767 (comment)?

A discussion point: currently, get_acis_station_data returns precipitation in mm but snow in cm, for consistency with relevant PV models (pvlib.soiling takes rainfall in mm; pvlib.snow takes snowfall in cm). Is that the right choice?

# time series names
'pcpn': 'precipitation',
'maxt': 'temp_air_max',
'avgt': 'temp_air_average',
Copy link
Member Author

Choose a reason for hiding this comment

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

I lean towards keeping the _average suffix here. Daily values seem different enough from the higher-resolution values that we call temp_air that consistency with the other names in this dict seems more important to me. It doesn't make sense to feed these values into ModelChain.run_model, for example.

pvlib/iotools/acis.py Show resolved Hide resolved
pvlib/iotools/acis.py Show resolved Hide resolved
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.

thanks @kandersolar - looking forward to using this!

As for snow units, I think I'd rather keep them in mm here and make other functions consistent with that. But ask me again tomorrow and I might have a different opinion.

pvlib/tests/iotools/test_acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
pvlib/iotools/acis.py Outdated Show resolved Hide resolved
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Jun 27, 2023
@AdamRJensen
Copy link
Member

As for snow units, I think I'd rather keep them in mm here and make other functions consistent with that. But ask me again tomorrow and I might have a different opinion.

I think I agree with Will - we should avoid having too many different units.

@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Jun 29, 2023
@kandersolar
Copy link
Member Author

See a bit of discussion in #1792 about snow units. Keeping them as cm seems like the best option to me, at least for now. I think that was the last open item here, so in it goes!

@kandersolar kandersolar merged commit 9be4487 into pvlib:main Jun 29, 2023
33 of 35 checks passed
@kandersolar kandersolar deleted the prism branch June 29, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement io remote-data triggers --remote-data pytests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get PRISM rainfall data
4 participants