openergy / opyplus

A package to work with EnergyPlus in python
Mozilla Public License 2.0
37 stars 13 forks source link

Problem with epw.set_df #22

Closed RiadZiour closed 4 years ago

RiadZiour commented 6 years ago

I tried to create a new epw through the following steps: open an epw into a df, modify the df and then update the epw with the new df. I guessed this was the role of the function set_df. However nothing happened: the epw was not modified. And reading the function, I don't see how it is supposed to work...

Lefort-Antoine commented 5 years ago

Function "set_df" has not been implemented correctly yet in oplus. It will be done in the next release.

You can use this code : `

Load EPW

epw = op.Epw("USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw")

Get EPW df

raw_epw_df = epw.df()

modify data

raw_epw_df["drybulb"] *= 2

set data to epw

epw._df = raw_epw_df

check

modify_epw_df = epw.df() print(modify_epw_df["drybulb"].sum())`

This code does not imply data check. The create epw can be incorrect for simulation use.

Lefort-Antoine commented 4 years ago

New commands are:

import oplus as op
# get weather
 data from simulation "s"
epw = s.get_in_weather_data()
# get weather data from epw file
epw = op.WeatherData.from_epw("T19_S10.epw")
# get dataframe 
df = epw.get_weather_series()
df["drybulb"] *=2
# create a new weather data and save it:
epw2 = op.WeatherData(df,
                     latitude=48.8534033, 
                     longitude=2.3465896,
                     timezone_offset=1,
                     elevation=0,
                     ) 
epw2.to_epw("test.epw")