...
- Download Nutrient Data (Starting with HUC-08 Lower Mississippi River for documenting steps; will combine sites from other HUCs into one document for trend analysis)
HUC08Data<-readWQPdata(huc="08", characteristicType="Nutrient", siteType="Stream")
- Select Parameter of Interest and Harmonize Data
- Nitrate plus Nitrite, the CharacteristicName is "Inorganic nitrogen (nitrate and nitrite)"
- Remove Composite Samples, field observations and quality control samples (the two types we want are "Sample-Routine" and "Sample")
SampleRoutine<-filter(HUC08Data, ActivityTypeCode == "Sample-Routine" | ActivityTypeCode == "Sample")
- Also want to remove preliminary values
- ResultStatusIdentifier = "Preliminary"
- select parameters to harmonize
Inorganic nitrogen (nitrate and nitrite) ; Inorganic nitrogen (nitrate and nitrite) as N ; Nitrate ; Nitrate as N ;
- filter/group by site + date + time
- look to see if "Inorganic nitrogen (nitrate and nitrite)" is available at a particular site.
- If so, is there more than one entry for that date and time at the site?
- If yes, keep the data that indicates filtered in column "ResultSampleFractionText"
- if no, keep the unfiltered or total
- If Inorganic Nitrogen not available, go through the same procedure as above for: Inorganic nitrogen (nitrate and nitrite) as N; Nitrate and Nitrate as N; Nitrate. All can be combined to make a longer record if needed.
- If so, is there more than one entry for that date and time at the site?
- Check to see if there are "ResultDetectionConditionText" qualifiers - (Not detected or below detection Limit. .... Figure out what to do with those)
- Determine if units are as N or NO3, change to "as N" when necessary. Want units to be "mg/l as N" in column "ResultMeasure.MesaureUnitCode"
- Filter if there are paired samples (same site, date, time)
- If there are paired samples
- Filtered / Unfiltered → keep filtered
- at a given site same site, if there are samples with the non-preferred parameter/fraction (unfilitered or total nitrate) then these can be appended to the dataset to make a longer record.
- nitrate can be added to a dataset as well
- Select Parameter of Interest and Harmonize Data
- If there are paired samples
- Remove Composite Samples, field observations and quality control samples (the two types we want are "Sample-Routine" and "Sample")
- Nitrate plus Nitrite, the CharacteristicName is "Inorganic nitrogen (nitrate and nitrite)"