I have been trying to convert an hourlycontinouscollection to ip unit using both convert_to_ip() and to_ip() functions but it doesnt work per below which is because it seems the datacollection is not returned as numbers.
_wea_data = global_epw.import_data_by_field(fields[hourly_selected])
a = _wea_data.convert_to_ip()
a
its DBT - but that shouldn’t be the case based on the GH component which seems to be working for all the fields -
global_epw = EPW(epw_file)
def get_fields() -> dict:
# A dictionary of EPW variable name to its corresponding field number
return {EPWFields._fields[i]['name'].name: i for i in range(6, 34)}
hourly_selected = st.selectbox('Which variable to plot?',options=fields.keys())
_wea_data = global_epw.import_data_by_field(fields[hourly_selected])
a = _wea_data.convert_to_ip()
a
That function should basically do the same in GH but it comes with an error when using the same function.
import streamlit as st
from ladybug.epw import EPW, EPWFields
epw_file = r"C:\Program Files\ladybug_tools\resources\weather\AUS_NSW_Sydney.Intl.AP.947670_TMYx.2004-2018\AUS_NSW_Sydney.Intl.AP.947670_TMYx.2004-2018.epw"
global_epw = EPW(epw_file)
fields = {EPWFields._fields[i]['name'].name: i for i in range(6, 34)}
hourly_selected = st.selectbox(
'Which variable to plot?', options=fields.keys())
_wea_data = global_epw.import_data_by_field(fields[hourly_selected])
_wea_data.convert_to_ip()
st.write(_wea_data)
Something must be happening with the input weather file.
That is weird - it runs ok when I test the code on Jupyter Notebook - but it still shows me the same error for IP conversion when I run the code on Streamlit - do you have any clues what might be the issue? I downgraded Numpy version but still didnt work -
I can retrieve the field name correctly and even I can get the hourly data collection in the right format per below but I just cant convert to IP units through that function. The code works with no issues when using SI units with any epw files.
Thinking if thats a versioning issue of any of the libraries which might be incompatible -
Hi @amirtabadkani, we currently use Python 3.10 for all the Ladybug Tools and Pollination development. We still test against 3.7 to ensure the libraries are compatible with 3.7 too.
Sorry @mostapha, can you also let me know which is your Streamlit version? It works when I do the coding inside Jupiter Notebook - I think there might be sth wrong with Streamlit