CenterForTheBuiltEnvironment / clima

The CBE Clima Tool is a web-based application built to support the need of architects and engineers interested in climate-adapted design. It allows users to analyze the climate data of more than 27,500 locations worldwide using the data contained in EPW files.
https://clima.cbe.berkeley.edu
MIT License
61 stars 21 forks source link

[DO NOT MERGE] #119 global filter and #159 code sanitisation #192

Open phuongdoan13 opened 1 year ago

phuongdoan13 commented 1 year ago

DO NOT MERGE

159: I created a file that contains all the columns's name as variables. This file has no effect on the current work, because it doesn't get called anywhere. To make this file effective, you will use Find and Replace, and change the raw strings to variables wherever you find them. We will not proceed any futher on this issue, because we have other issues to focus on. If you find it useful, we will leave it here for future developers.

119:

1) I made a global filter file (my_project/callbackMonthHourFilter.py), containing global callbacks. There is an issue with this file that I have to comment out the callbacks. The callback will throw error because it listens to all the ID, including those that are not currently rendered on the tab. Would you have any coding pattern to solve this?

2) I set the initial values for all the month/time filters based on the global values. However, the charts on the tab when initally loaded are not based on the filter, they used the default values of [1,12], [1,24], no invert. The reason for this is because of this if time_filter: . When first initally loaded, time_filter is 0, thus this if-else is not executed => the dataframe is not filtered.

phuongdoan13 commented 1 year ago

@FedericoTartarini Hi Federico, can I hear your comments on this?

FedericoTartarini commented 1 year ago

I really like the idea of having a file with the column names.

Regarding the global filter issue, point 2 should work. We could keep the code as it is, each page has its own Store, but then when the Store which contains information about the time and months selected is changed then a callback is triggered and the information is saved in a Global Store. The data in the global store are used to populate the filter on each page each time the page is loaded up. Does this make sense? I will need to try to code it to check if the above logic would work.