Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information