Giter VIP home page Giter VIP logo

Comments (6)

wholmgren avatar wholmgren commented on June 12, 2024

I'm inclined to say that we should fix it, but I'm ok with removing it too. If I remember right, @Calama-Consulting is in favor of keeping it. A PR (with tests) is welcome.

from pvlib-python.

wholmgren avatar wholmgren commented on June 12, 2024

We'll keep using this issue to solve the timezone problem in this function.

The pyephem and NREL spa functions use UTC, so as long as Python, pandas, pytz, and dateutils can get the conversion right, DST should be ok there. test_solarposition.py has several tests that use a Golden, CO Location with a DST-allowing America/Denver timezone.

See #41 for a summary of the tz issue.

from pvlib-python.

wholmgren avatar wholmgren commented on June 12, 2024

This code block causes problems.

    # this code is needed to handle the new location.tz format string
    try:
        utc_offset = pytz.timezone(location.tz).utcoffset(
            time[0]).total_seconds() / 3600.
    except ValueError:
        utc_offset = time.tzinfo.utcoffset(time[0]).total_seconds() / 3600.
    pvl_logger.debug('utc_offset={}'.format(utc_offset))

It creates a fixed utc_offset based the first element of the DatetimeIndex. utc_offset should instead be an array so that it can handle a change from DST to non-DST. I wrote this so you can blame me!

To fix it, I suggest using pvlib.tools.localize, and the hours attribute of the returned object in place of UnivHr = DecHours + utc_offset - .5.

I think this also removes the need for

    Hour = time.hour
    Minute = time.minute
    Second = time.second
...
    DecHours = Hour + Minute / float(60) + Second / float(3600)

from pvlib-python.

wholmgren avatar wholmgren commented on June 12, 2024

cc @uvchik.

from pvlib-python.

uvchik avatar uvchik commented on June 12, 2024

The Problem is, that I don't really understand the function and it is not well commented. I tried some thing but I didn't succeeded.

I think I won't be able to repair and test this function in an acceptable period. First I have to learn more about Pandas timestamps and how to work with pandas and time zones.

Shall we add another warning, that using this function is on one owns risk. Or does anyone have an idea how to fix an test it?

from pvlib-python.

wholmgren avatar wholmgren commented on June 12, 2024

Thanks for looking. I'll see if I can implement my thoughts above.

from pvlib-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.