Dry-bulb temperature mis-match between API and VistaPro
Posted: Thu Feb 24, 2022 5:07 pm
I've noticed a discrepancy between the dry-bulb temperature obtained from VistaPro and the dry-bulb temperature obtained through the Python API.
From vista, the first few values are (in list format):
whereas, from the API, we obtain this:
The first noticeable difference is that the dry-bulb temperature (1) from vista starts with 16.
Now, the next thing I noticed is that (1) and (2) are just one element out-of-sync, so if I removed the 16 value from (1) then all would be good, however, from the 2160th index, they are one element out-of-sync again:
From vista:
From API:
To re-create the problem:
1. Obtain the dry-bulb temperature using the python script below. This needs to be run in VEScript in IES. It will save the numpy array obtaining the dry-bulb temperatures hourly.
2. Then in VistaPro, open dry-bulb temperature in a table and then save it as a text file e.g. "dry_bulb_temperature_from_vista.txt".
Note: Make sure to have "dry_bulb.npy" and "dry_bulb_temperature_from_vista.txt" in the same location the python script is being run from.
3. Run the below python script (in jupyter or VEscript) to input data into a csv file which can then be opened in excel.
Any help with why these two dry-bulbs temps are different would be great!
Thank you
From vista, the first few values are (in list format):
Code: Select all
[16. , -1.6, -2. , -3.2, -3.2, -2.6, -2. , -1.9, -1.8, -2. , -1.4, -0.5, 0.1, 0.4, 0.6, ...] (1)
Code: Select all
[-1.6, -2. , -3.2, -3.2, -2.6, -2. , -1.9, -1.8, -2. , -1.4, -0.5, 0.1, 0.4, 0.6, 0.8, ...] (2)
Now, the next thing I noticed is that (1) and (2) are just one element out-of-sync, so if I removed the 16 value from (1) then all would be good, however, from the 2160th index, they are one element out-of-sync again:
From vista:
Code: Select all
[ ..., 6.4, 6.4, 6.5, 6.2, 6. , 6.5, 6.4, 6.4, 6.6, 7.3, 7.9, 8.5, 9.4, 10.1, 10. , ...]
Code: Select all
[ ..., 6.4, 6.5, 6.2, 6. , 6.5, 6.4, 6.4, 6.6, 7.3, 7.9, 8.5, 9.4, 10.1, 10. , 10.6, ...]
1. Obtain the dry-bulb temperature using the python script below. This needs to be run in VEScript in IES. It will save the numpy array obtaining the dry-bulb temperatures hourly.
Code: Select all
import numpy as np
import pandas as pd
import iesve
from ies_file_picker import IesFilePicker
file_name = IesFilePicker.pick_aps_file()
results_file_reader = iesve.ResultsReader.open(file_name)
weather_file_name = results_file_reader.weather_file
weather_file = iesve.WeatherFileReader()
open_weather_file = weather_file.open_weather_file(weather_file_name)
arr = weather_file.get_results(
3, # this is the dry-bulb temperature ID
1, # start day
365 # end day
)
print(arr)
np.save("dry_bulb.npy", arr)
Note: Make sure to have "dry_bulb.npy" and "dry_bulb_temperature_from_vista.txt" in the same location the python script is being run from.
3. Run the below python script (in jupyter or VEscript) to input data into a csv file which can then be opened in excel.
Code: Select all
import pandas as pd
import numpy as np
# Load dry-bulb from API and VistaPro
arr_from_api = np.load("arr_dry_bulb_temp.npy")
df = pd.read_csv("dry_bulb_temperature_from_vista.txt", delimiter="\t", encoding='latin1', header=2)
arr_from_vista = np.array(df.iloc[:, 2])
di = {
"Dry-bulb Temp. Vista": arr_from_vista,
"Dry-bulb Temp. API": arr_from_api
}
df = pd.DataFrame.from_dict(di)
df.to_csv('dry_bulb_test.csv') # Save as csv
Thank you