Closed annasong20 closed 6 years ago
@annasong20 ,
Thank you for finding all of these issues and you are right that they are all bugs. The first 3 are typos and the last one isn't quite so serious that it causes EPWs constantly above the thresholdTemp to fail but it is still bad practice on my part. The first month of such a warm EPW would usually trigger the first conditional statement:
if t > thresholdTemp and vegStartSet == False:
and this would set the vegStart. However, there is a case that would cause it to fail, which is an EPW where every month is right at the thresholdTemp. While this case is unlikely, it is something that we should catch and so I've added your suggestion in.
All of the fixes have been pushed: https://github.com/chriswmackey/Dragonfly/commit/220e5c11de084b9963cb28d0fe278b74e68e59a1 And I updated the example files just in case: https://github.com/chriswmackey/hydra_2/commit/a898f9abaaace3aaa50cf11e8bdc21ccc96811c2
Also, if you find any other issues, you should feel free to send a pull request and I would be happy to merge it in. Opening issues like this also works but the former one gets you credited on this github as a contributor :)
Thanks again!
@chriswmackey,
Thanks for your explanation!
Hi,
I’ve been looking through the code for various Dragonfly components, and I’ve run into a few lines of code that I think might have been meant to be written differently. Apologies if I am mistaken.
The first occurs in the code behind the DF Dragonfly component, in the Vegetation class’s init method. Line 1880 initializes self._s_trees = is_trees, but there are no getter and setter methods for the property _s_trees, only for is_trees. I’m wondering if self._s_trees was meant to be self.is_trees?
https://github.com/chriswmackey/Dragonfly/blob/182da9a6c18315e2f35465b0bd403109f3e6f6a5/src/DF%20Dragonfly.py#L1877-L1880 https://github.com/chriswmackey/Dragonfly/blob/182da9a6c18315e2f35465b0bd403109f3e6f6a5/src/DF%20Dragonfly.py#L1911-L1919
The second is also in the DF Dragonfly code, in the VegetationPar class’s setter method for self.vegetation_start_month. On line 2115, self._vegetation_start_month is always set to 0 regardless of whether or not the user entered a valid vegetation start month. Should there be an else before line 2115 like there is for the vegetation_end_month setter?
https://github.com/chriswmackey/Dragonfly/blob/182da9a6c18315e2f35465b0bd403109f3e6f6a5/src/DF%20Dragonfly.py#L2110-L2115
The third is in the code supporting the DF Run UWG component, in the set_uwg_input method. On line 170, if DFCity.vegetation_parameters.vegetation_start_month == 0, uwg.vegEnd = vegEnd, but according to the logic used in lines 166-167, shouldn’t uwg.vegEnd be initialized to the epw default value only if the user entered a 0 for DFCity.vegetation_parameters.vegetation_end_month (check for end month instead of start month)?
https://github.com/chriswmackey/Dragonfly/blob/182da9a6c18315e2f35465b0bd403109f3e6f6a5/src/DF%20Run%20Urban%20Weather%20Generator.py#L164-L173
Lastly, I just had a quick question. I noticed that in the code for the DF Run UWG component, in the autocalcStartEndVegetation method, on line 94, vegEnd is initialized to 12. However, vegStart is not initialized to any value. This means that if we’re looking at weather data for an area for which no month’s average hourly temperature is above 10 degrees Celsius, returning an uninitialized vegStart value would raise an error? I ask this because I’m unsure whether or not we can trust that every location for which epw files exist definitely have average hourly temperature greater than 10 for at least one month.
https://github.com/chriswmackey/Dragonfly/blob/182da9a6c18315e2f35465b0bd403109f3e6f6a5/src/DF%20Run%20Urban%20Weather%20Generator.py#L93-L104
Thanks so much!