Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Suppose I have 100 variables calculated using Energyplus and I want to print the 100 in 10 CSV files, how may I achieve it ?

asked 2018-07-13 23:31:10 -0600

Siv's avatar

updated 2018-08-25 18:26:14 -0600

Suppose I have 100 variables calculated using Energyplus and I want to print the 100 in 10 CSV files in such a way that each CSV file contains only 10 variables, how may I achieve it ?

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2018-07-20 06:41:56 -0600

You can use rvi input files to filter and order the variables from the eso output when ReadVarsESO produces the csv output. You can write a batch script to run ReadVarsESO multiple times on the same eso output, each with a different rvi input. There are many example rvi files in the EnergyPlus ExampleFiles folder, e.g. 1ZoneUncontrolled.rvi. See "Using ReadVarsESO" in the Input Output Reference for more information.

edit flag offensive delete link more

answered 2018-07-16 02:58:40 -0600

updated 2018-07-16 03:11:24 -0600

Python and pandas would do that quite easily. This code will output as many csv files as needed regardless of your actual number of variables, each file with 10 variables (except the latest which could have between 1 and 10). Each will be named like eplusout_0.csv, eplusout_1.csv, etc.

import pandas as pd
import numpy as np

df = pd.read_csv('eplusout.csv', index_col=0)
# Chunck size
n = 10
for i in range(0, df.shape[1], n):
    df_chunck = df.iloc[:, i:i+n]

Note: If you wanted, you do a bit better to properly parse the Date/Time CSV column as a valid DateTimeIndex.

I'll allow myself to go into a small rant here: the time conventions used by E+ as a MAJOR pain. The Date/Time index doesn't include the year, but more importantly it uses end of timestep conventions AND labels midnight as "24:00". Try to parse that in Python, you'll see.

In [1]
def dateparse(x):          
    return pd.datetime.strptime("2005/{}".format(x.strip()), '%Y/%m/%d %H:%M:%S')

df = pd.read_csv('eplusout.csv', index_col=0, parse_dates=True, date_parser=dateparse)

ValueError: time data '2005/01/01  24:00:00' does not match format '%Y/%m/%d %H:%M:%S'

This is because datetime logically expects 0-23 for hour.

In [2]: import datetime
        datetime.datetime(2005, 1, 1, 24, 0, 0)

Out[2]: ValueError: hour must be in 0..23
edit flag offensive delete link more



FYI: (should probably be tagged 'NewFeatureRequest')

Eric Ringold's avatar Eric Ringold  ( 2018-07-16 10:11:40 -0600 )edit

Go upvote this issue please!

Julien Marrec's avatar Julien Marrec  ( 2018-07-17 02:25:58 -0600 )edit

The utility that is responsible for converting the ESO (which has dates and times that make sense internally to E+) into CSV is ReadVarsESO. Yes, it is in F90, but it is open source and we are happy to take contributions (even in other programming languages). The contribution policy is right here.

Jason DeGraw's avatar Jason DeGraw  ( 2018-07-17 09:57:09 -0600 )edit

Jason, I'll answer on the Github Issue here

Julien Marrec's avatar Julien Marrec  ( 2018-07-18 02:46:48 -0600 )edit

answered 2018-07-14 12:23:48 -0600

Avi's avatar

updated 2018-07-14 12:24:55 -0600

I would import the csv file into Excel and then separate whatever I need into different worksheets.

That should be quiet easy to do. You could write simple macro script to automate that.

You could also run simulation 10 times each time with different output list but that is inefficient.

edit flag offensive delete link more

answered 2021-07-20 09:03:20 -0600

psymo87's avatar

Re Julien's rant above, regarding the poor E+ time conventions. Here is a snippet of python code that might be useful:

def read_eplusout(datafile, year=2018):

if os.path.exists(datafile):
    with open(datafile,mode='r') as inf:
        hline=inf.readline()             ##Reads the line of headers

        for hhead in hline.split(','):
            ##Make sure that we read a variable that we want

        ##Creates a huge data structure
        for i, lline in enumerate(inf):
            for hhead,dd in zip(hline.split(','),lline.split(',')):
                if hhead=='Date/Time':
                    if hh=='24':


                if dd=="":


    data_frame = pd.DataFrame(ep_datas)
    data_frame = data_frame.set_index(pd.DatetimeIndex(ep_datas['Date/Time']))

    return data_frame
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Question Tools



Asked: 2018-07-13 23:31:10 -0600

Seen: 684 times

Last updated: Jul 20 '21