Displaying differences for changeset
 
display as  

examples/wqLookup303d.py

@@ -31,7 +31,7 @@
 "Fe-D": { "name": "Iron (Dissolved)", "expectedUnits": "ug/L", "usgsUnits": "ug/L", "cdpheDownloadName": "IronDissolvedug/L" },
 "Fe-T": { "name": "Iron (Total Recoverable)", "expectedUnits": "ug/L", "usgsUnits": "ug/L", "cdpheDownloadName": "IronTotalug/L" },#aka Fe-Trec
 "Fluoride-T": { "name": "Fluoride", "expectedUnits": "mg/L", "usgsUnits": "mg/L", "cdpheDownloadName": "FluorideTotalmg/L" },
-"Hardness": { "name": "Hardness", "expectedUnits": "mg/L", "usgsUnits": "mg/L", "cdpheDownloadName": "Hardness" },
+"Hardness": { "name": "Hardness", "expectedUnits": "mg/L", "usgsUnits": "mg/L", "cdpheDownloadName": ["HardnessTotalmg/L", "Hardness"] },
 "Hg-D": { "name": "Mercury (Dissolved)", "expectedUnits": "ug/L", "usgsUnits": "ug/L", "cdpheDownloadName": "MercuryDissolvedug/L" },
 "Hg-T": { "name": "Mercury (Total Recoverable)", "expectedUnits": "ug/L", "usgsUnits": "ug/L", "cdpheDownloadName": "MercuryTotalug/L" },
 "Mn-D": { "name": "Manganese (Dissolved)", "expectedUnits": "ug/L", "usgsUnits": "ug/L", "cdpheDownloadName": "ManganeseDissolvedug/L" },
@@ -63,7 +63,7 @@
 "TKN-T": { "name": "Total Kjeldahl Nitrogen", "expectedUnits": "mg/L", "usgsUnits": "mg/L", "cdpheDownloadName": "KjeldahlNitrogenTotalmg/L" },#aka TKN
 # "TIN-T": { "name": "Total Inorganic Nitrogen", "expectedUnits": "mg/L", "usgsUnits": "mg/L", "cdpheDownloadName": "InorganicNitrogenTotalmg/L" },#aka TIN
 "TN-T": { "name": "Total Nitrogen", "expectedUnits": "mg/L", "usgsUnits": "mg/L", "cdpheDownloadName": "NitrogenTotalmg/L" },#aka TN
-"TP-T": { "name": "Total Phosphorus", "expectedUnits": "mg/L", "usgsUnits": "mg/L", "cdpheDownloadName": "PhosphorusTotal/mg/L" },#aka TP
+"TP-T": { "name": "Total Phosphorus", "expectedUnits": "mg/L", "usgsUnits": "mg/L", "cdpheDownloadName": ["PhosphorusTotalmg/L", "PhosphorusTotal/mg/L"] },#aka TP
 "U-D": { "name": "Uranium (Dissolved)", "expectedUnits": "ug/L", "usgsUnits": "ug/L", "cdpheDownloadName": "UraniumDissolvedug/L" },
 "U-T": { "name": "Uranium (Total Recoverable)", "expectedUnits": "ug/L", "usgsUnits": "ug/L", "cdpheDownloadName": "UraniumTotalug/L" },
 "Zn-D": { "name": "Zinc (Dissolved)", "expectedUnits": "ug/L", "usgsUnits": "ug/L", "cdpheDownloadName": "ZincDissolvedug/L" },

services.py

@@ -617,7 +617,15 @@
                         parm_cd_303d = None
                         currentUnits = None
                         for key, parmDict in wq_303d.items():
-                            if parmDict["cdpheDownloadName"] == line["ana"]:
+                            checkName = parmDict["cdpheDownloadName"] # either a single string, or a list of strings
+                            if isinstance(checkName, list):
+                                # if this is a list, lowercase each element in the list so the 'in' operation still works to compare
+                                checkName = []
+                                for item in parmDict["cdpheDownloadName"]:
+                                    checkName.append(item.lower())
+                            else:
+                                checkName = checkName.lower()
+                            if line["ana"].lower() in checkName: # either a single string, or a list of strings
                                 parm_cd_303d = key
                                 currentUnits = parmDict["expectedUnits"]
                                 break

views.py

@@ -124,11 +124,15 @@
                     data = station_result[date]
                     for ana, ana_data in data.items():
                         if wq_303d[ana]["cdpheDownloadName"]:
+                            downloadName = wq_303d[ana]["cdpheDownloadName"] # either a single string, or a list of strings
+                            if isinstance(downloadName, list):
+                                # Keep the first download name as the 'right' one
+                                downloadName = downloadName[0]
                             row = [station[h] for h in header_keys]
                             row += [
                                 date,
                                 ana_data["sampleTime"],
-                                wq_303d[ana]["cdpheDownloadName"],
+                                downloadName,
                                 ana_data["flag"],
                                 ana_data["value"],
                             ]