Skip to content

Add NSRDB GOES v4 to iotools #2378

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 55 commits into from
Apr 23, 2025
Merged

Conversation

williamhobbs
Copy link
Contributor

@williamhobbs williamhobbs commented Feb 6, 2025

  • Closes Add NSRDB GOES V4 #2326
  • 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.

@williamhobbs
Copy link
Contributor Author

What's the best practice for lines like this one that end up too long? Do I simply add # noqa or # noqa: F401? (I don't know what F401 is for, but I've seen it used here...)

GOES_URL = NSRDB_API_BASE + "/api/nsrdb/v2/solar/nsrdb-GOES-aggregated-v4-0-0-download.csv"

https://github.com/williamhobbs/pvlib-python/blob/4af81a76b4d8bb86b992b5a87ca81dbec6ecb8d5/pvlib/iotools/goes4.py#L15

@mikofski
Copy link
Member

mikofski commented Feb 6, 2025

You could use parentheses

GOES_URL = NSRDB_API_BASE + ("/api/nsrdb/v2/solar/"
"nsrdb-GOES-aggregated-v4-0-0-download.csv")

or just break the string smaller and add them

API_STUB = "/api/nsrdb/v2/solar/"
ENDPOINT = "nsrdb-GOES-aggregated-v4-0-0-download.csv"
GOES_URL = (NSRDB_API_BASE
    + API_STUB + ENDPOINT)

imo avoid ignoring pep8 warnings or else they become pointless.

@williamhobbs
Copy link
Contributor Author

Thanks, @mikofski!

@williamhobbs
Copy link
Contributor Author

I'm not 100% sure that I set up the tests in test_goes4.py correctly. I copied what was done in test_psm3.py and manually downloaded and reformatted as needed the test data csv files.

See test_read_goes4_map_variables() in particular. columns_mapped includes variables like 'Ozone' that are part of a manual download but are not addressed in pvlib.

I think it's correct, but I could be misunderstanding the goals of some of the tests.

@williamhobbs williamhobbs mentioned this pull request Feb 7, 2025
@williamhobbs
Copy link
Contributor Author

Ok, made the switch from "goes4" to "psm4".

I haven't done anything with @kandersolar's suggestion for different get_ functions for different endpoints (e.g., get_nsrdb_goes4_aggregated, get_nsrdb_goes4_conus, and get_nsrdb_goes4_tmy). I'll wait for some consensus on that one.

@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Apr 21, 2025
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Apr 21, 2025
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Apr 21, 2025
@kandersolar
Copy link
Member

Thanks @williamhobbs for iterating with the tests :) Many of the remaining code coverage issues are for API error handling conditions that we might not be able to easily induce, so I'd say let's ignore those. However, it does look like get_nsrdb_psm4_full_disc isn't currently tested. Can you add another test function for that?

@williamhobbs
Copy link
Contributor Author

williamhobbs commented Apr 21, 2025

@kandersolar, I think I finally addressed all the tests. Not sure about the failing codecov checks, though [edit: I see you just commented on this...].

One note/question: I manually removed the Alpha and Asymmetry columns from the test psm4 csv files (after removing them from the variable map based on #2378). Was simply deleting those columns from the csv files the right thing to do? I honestly can't remember how I created those files originally.

@williamhobbs
Copy link
Contributor Author

...it does look like get_nsrdb_psm4_full_disc isn't currently tested. Can you add another test function for that?

@kandersolar, yes, I'll work on that.

@kandersolar
Copy link
Member

One note/question: I manually removed the Alpha and Asymmetry columns from the test psm4 csv files (after removing them from the variable map based on #2378). Was simply deleting those columns from the csv files the right thing to do?

It looks like no tests make use of those columns (in the PSM3 tests either). So maybe ideally it would be good to include them, but since there's no special functionality related to those columns that we need to test, I think it's okay to leave them out.

@williamhobbs
Copy link
Contributor Author

One note/question: I manually removed the Alpha and Asymmetry columns from the test psm4 csv files (after removing them from the variable map based on #2378). Was simply deleting those columns from the csv files the right thing to do?

It looks like no tests make use of those columns (in the PSM3 tests either). So maybe ideally it would be good to include them, but since there's no special functionality related to those columns that we need to test, I think it's okay to leave them out.

I think leaving Alpha and Asymmetry columns in was causing test_read_nsrdb_psm4_map_variables to fail, which is why I removed them.

@kandersolar
Copy link
Member

Ok I see. In that case I think the better solution would have been to add the relevant strings to the list of expected keys, rather than remove the columns from the data file.

@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Apr 21, 2025
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Apr 21, 2025
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Apr 21, 2025
@williamhobbs
Copy link
Contributor Author

@kandersolar I think it's ready now.

Copy link
Member

@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.

LGTM. Thanks @williamhobbs for this contribution! It's rare to get as many as six functions added in one PR...

I'll open issues for the follow-up items identified in review.

@kandersolar kandersolar merged commit 1428b6b into pvlib:main Apr 23, 2025
33 of 36 checks passed
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.

Add NSRDB GOES V4
7 participants