Commit b5e89be
coerce and rotate pvgis TMY data to desired tz and year (#2138)
* coerce and rotate pvgis TMY data to desired tz and year
- add private function `_coerce_and_rotate_pvgis()`
- add `utc_offset` and `coerce_year` params to docstring for `get_pvgis_tmy`
- call private function if `utc_offset` is not zero
* test get_pvgis_tmy_coerce_year
check if utc_offset and coerce_year work as expected
* fix flake8 in test_pvgis_coerce_year
- remove whitespace
- shorter lines
* remove iloc for index in test pvgis coerce
- incorrect syntax for indices
* deal with leap year in pvgis when coercing
- if february is a leap year, when shifting tz, causes issues
- so replace february year with non-leap year
* fix space around operator in coerce pvgis
- also fix use ts for timestamp when fixing feb leap year
* fix pd.Timestamp in pvgis coerce year
- lower case "s" not TimeStamp
* Update v0.11.1 what's new for coerce pvgis tmy
- add description and links to issue/pr
* replace year and tzinfo in pvgis_tmy coerce year
- also use np.roll
- also make new index and dataframe instead of altering original
- removes need to sanitize original index February for leap year
- remove calendar import but add numpy and pytz
- code much simpler shorter, easier to read
* remove unused imports from pvgis.py for flake8
* change private function name to _coerce_and_roll_pvgis_tmy
* spot check rolled pvgis TMY values after converting tz
- fix Turin is actually CET which is UTC+1
- be DRY so use variables for test year and tz constants, versus WET and hardcoded
- check tz unchanged if default zero utc_offset
- use _ output args instead of indexing data[0]
- add comments
* Update utc_offset description
- explain setting utc_offset will roll data to start at Jan 1 midnight
* change coerce_year and utc_offset defaults to None in pvgis TMY
- update arg docstrings
- allow user to coerce year even if utc_offset is None or zero
- use 1990 as default if utc_offset is not None or zero, but coerce_year was unspecified
- add warning comment to be explicit and test identity to avoid unexpected implicit booleaness
* rename roll_utc_offset in get_pvgis_tmy
- refactor utc_offset everywhere including comments and docstring
- add additional test to coerce year even if utc offset is zero or none
- change tzname to 'UTC' (versus Etc/GMT or Etc/GMT+0) if replacing with zero utc offset
* Update pvlib/iotools/pvgis.py with suggestions
use "optional" vs. "default None" per #1574
Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com>
* Update docs/sphinx/source/whatsnew/v0.11.1.rst
rename argument "roll_utc_offset" in whatsnew
Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com>
* rename _coerce_and_roll_tmy, remove 'pvgis'
* rename index with new tz in coerce pvgis tmy
* allow tz of None in _coerce_and_roll_tmy
- treat tz=None as UTC
- allows get_pvgis_tmy to be simpler
- remove unnecessary comments
* clarify input tmy_data is UTC...
- ... in docstring of private function pvgis._coerce_and_roll_tmy()
- rename tmy_data
- name new_index explicitly using pd.DatetimeIndex()
* fix flake8 in _coerce_and_roll_tmy
---------
Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com>
Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com>1 parent 0428fbe commit b5e89be
File tree
3 files changed
+91
-3
lines changed- docs/sphinx/source/whatsnew
- pvlib
- iotools
- tests/iotools
3 files changed
+91
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | | - | |
24 | | - | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
393 | 416 | | |
394 | 417 | | |
395 | | - | |
| 418 | + | |
| 419 | + | |
396 | 420 | | |
397 | 421 | | |
398 | 422 | | |
| |||
424 | 448 | | |
425 | 449 | | |
426 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
427 | 458 | | |
428 | 459 | | |
429 | 460 | | |
| |||
510 | 541 | | |
511 | 542 | | |
512 | 543 | | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
513 | 549 | | |
514 | 550 | | |
515 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
438 | 485 | | |
439 | 486 | | |
440 | 487 | | |
| |||
0 commit comments