MPCPy icon indicating copy to clipboard operation
MPCPy copied to clipboard

EPW radiation data final timestep timeseries value changes in next timestep.

Open TStesco opened this issue 6 years ago • 4 comments

WeatherFromEPW._read_timeseries_from_epw gives changing values for final hour radiation variables. This is because after resampling the values, interpolating, and shifting 30 minutes backwards (as mentioned in Buildings.BoundaryConditions.WeatherData.ReaderTMY3) the original unshifted uninterpolated value is appended as the final value in the timeseries (see exodata.py line 956).

This value for the hourly radiation will then change if it is not the final hour in the timeseries (see reproducing code). There is a simple fix to read one timestep further for radiation data then do the resampling, interpolation, and time shift - without appending the original value at the end. I would happily send a pull request implementing this if it is sufficient. Although, perhaps there are already some rewrites to EPW time interval handling already in the works (https://github.com/lbl-srg/MPCPy/issues/143)? Please let me know - thanks!

minimal reproducing code (have to add local .epw file path):

from mpcpy import exodata
import datetime
weather = exodata.WeatherFromEPW(
    '/root/data/CHE_Geneva.067000_IWEC.epw',
    standard_time=True
)
start_time = datetime.datetime.strptime('4/2/2017 01:00:00', '%m/%d/%Y %H:%M:%S')
final_time = datetime.datetime.strptime('4/2/2017 07:00:00', '%m/%d/%Y %H:%M:%S')
weather.collect_data(start_time, final_time)
weather.data['weaHGloHor'].display_data()

start_time += datetime.timedelta(hours=1)
final_time += datetime.timedelta(hours=1)
weather.collect_data(start_time, final_time)
weather.data['weaHGloHor'].display_data()

TStesco avatar Jul 20 '18 10:07 TStesco

Hey Tom, thanks for reporting the issue. I will have a look at it in the coming days.

dhblum avatar Jul 23 '18 22:07 dhblum

Great thanks, I implemented the fix mentioned locally and it appears to give the expected behaviour.

TStesco avatar Jul 24 '18 15:07 TStesco

Hey Tom, thanks for implementing a suggested fix. Can you please send the pull request?

dhblum avatar Jul 26 '18 16:07 dhblum

Sure, adding the pull request for information - it's nothing fancy but gets around having to append an uninterpolated final value in the timeseries.

TStesco avatar Jul 26 '18 18:07 TStesco