Conversation
This is nearly complete, but I want to back this branch and the work done to GitHub
| if not os.path.exists(self.output_path): | ||
| os.mkdir(self.output_path) | ||
|
|
||
| def _update_output_units(self): |
There was a problem hiding this comment.
parameter = self.parameter.lower()
if parameter == 'ph':
...
if parameter == 'waterlevels'
...
There was a problem hiding this comment.
I'm only keeping if self.parameter.lower() == "ph" here because all analytes use mg/L and water levels uses ft (both of which are already defined).
Many of the functionalities and processes for obtaining water levels and analytes are the same. To consolidate code and make it more streamlined I'll combine them (in refactoring). When that happens I'll have more if statements here, but for the time being I'll just check for ph and update config.analyte_output_units accordingly.
backend/transformer.py
Outdated
| https://aqua-chem.com/water-chemistry-caco3-equivalents/ | ||
| https://industrialh2osolutions.com/conversions-and-guides-water-chemistry-caco3-equivalents/ | ||
| """ | ||
| if ( |
There was a problem hiding this comment.
you should consolidate your conditionals. You should also use if/else and elif statements. they way its written all the top level conditionals are tested even tho if one of the conditionals is true its logically impossible for any of the other conditionals to be true (i.e. why execute another if statement when you know already know the conversion_factor is set)
if (input_units.lower() in ('mg/l caco3', 'mg/l caco3**') and output_units == mgl:
if die_parameter_name == 'bicarbonate':
conversion_factor = 1.22
elif die_parameter_name =='calcium':
conversion_factor = 0.4
...
There was a problem hiding this comment.
Conditionals have been consolidated based firstly based off of output_units, then input_units, die_parameter_name, and source_parameter_name where applicable (with the exception of ph since it has no units. For the sake of clarity I'm checking die_parameter_name but can check if output_units == "").
Unit conversions are now blocked by output_units where possible (unless the analyte is pH, in which case the die_parameter_name is used). All conversions for output units are now assessed in if/elif statements for clarity and ease. Furthermore, no else statements are used so that if the conversion is not accounted for it will be reported to the user
With these changes the following occurs:
None