UMEP-dev / SuPy

SUEWS that speaks Python
https://supy.readthedocs.io/
GNU General Public License v3.0
13 stars 7 forks source link

29 Feb should be removed from the generated TMY #12

Closed ghost closed 1 year ago

ghost commented 3 years ago

@sunt05 commented on Mar 9, 2020, 8:48 PM UTC:

Describe the Issue

If 29 Feb exists in TMY, EnergyPlus would complain and stop running.

This issue was moved by sunt05 from sunt05/SuPy#131.

ghost commented 3 years ago

@tyhzxc commented on Mar 11, 2020, 2:51 AM UTC:

modified gen_TMY

def gen_TMY(df_output):
    """generate TMY (typical meteorological year) from SuPy output.

    Parameters
    ----------
    df_output : pandas.DataFrame
        Output from `run_supy`: longterm (e.g., >10 years) simulation results, otherwise not very useful.

    """

    # calculate weighted score
    df_output_x=df_output.assign(
            Year=lambda df: df.index.year,
            Month=lambda df: df.index.month,
            Day=lambda df: df.index.day,
            Hour=lambda df: df.index.hour,
            Minute=lambda df: df.index.minute,
        )
    ws = gen_WS_DF(df_output_x)

    # select year
    year_sel = pick_year(ws, df_output_x, n=5)

    # convert `0h` to `24h` and take care of `day`: to follow EPW convention
    df_output_x=conv_0to24(df_output_x)

    # generate TMY data
    df_TMY = pd.concat(
        [
            df_output_x.groupby(["Month", "Year"]).get_group(grp)
            for grp in year_sel.items()
        ]
    )
    mask=(df_TMY ['Month']==2)&(df_TMY ['Day']==29)
    index=df_TMY [mask].index
    df_TMY =df_TMY .drop(df_TMY [mask].index)
    return df_TMY
mask=(df_TMY ['Month']==2)&(df_TMY ['Day']==29)
index=df_TMY [mask].index
df_TMY =df_TMY .drop(df_TMY [mask].index)
github-actions[bot] commented 1 year ago

Stale issue message