Change request to utilities.py

20 views
Skip to first unread message

Mike Revitt

unread,
Feb 10, 2021, 10:33:19 AM2/10/21
to weewx-development
Again while creating some long term reports I noticed that there is a lot of white space to the right of the values in the graph. This is caused by the following lines of code at line 310

    else :

        # The time scale is between a month and 2 years. A time increment of 12 months is appropriate

        start_dt = tmin_dt.replace(day=1, hour=0, minute=0, second=0, microsecond=0)


        (year , mon, day) = tmax_dt.timetuple()[0:3]

        if day != 1 or mon !=1 :

            day = 1

            mon = 1

            year += 1

        stop_dt = datetime.datetime(year, mon, 1)

        # Average year length

        interval = 365.25 * 24 * 3600


When creating graphs with 5+ years duration I discovered that 3 months is better so can we change it to this

    else :

        # The time scale is greater than 2 years. A time increment of 3 months is appropriate

        start_dt = tmin_dt.replace(day=1, hour=0, minute=0, second=0, microsecond=0)


        (year , mon, day) = tmax_dt.timetuple()[0:3]

        if day != 1 or mon !=1 :

            day = 1

            mon = 1

            year += 1

        stop_dt = datetime.datetime(year, mon, 1)

        # Average year length

        interval = 365.25/4 * 24 * 3600


Thanks
Reply all
Reply to author
Forward
0 new messages