readWQPqw: Raw Data Import for Water Quality Portal

View source: R/readWQPqw.R

readWQPqwR Documentation

Raw Data Import for Water Quality Portal

Description

Imports data from the Water Quality Portal. This function gets the data from here: https://www.waterqualitydata.us. There are four required input arguments: siteNumbers, parameterCd, startDate, and endDate. parameterCd can either be a USGS 5-digit code, or a characteristic name. The sites can be either USGS, or other Water Quality Portal offered sites. It is required to use the 'full' site name, such as 'USGS-01234567'.

Usage

readWQPqw(
  siteNumbers,
  parameterCd,
  startDate = "",
  endDate = "",
  tz = "UTC",
  querySummary = FALSE,
  convertType = TRUE
)

Arguments

siteNumbers

character site number. This needs to include the full agency code prefix.

parameterCd

vector of USGS 5-digit parameter code or characteristicNames. Leaving this blank will return all of the measured values during the specified time period.

startDate

character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates retrieval for the earliest possible record. Date arguments are always specified in local time.

endDate

character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates retrieval for the latest possible record. Date arguments are always specified in local time.

tz

character to set timezone attribute of dateTime. Default is "UTC", and converts the date times to UTC, properly accounting for daylight savings times based on the data provided tz_cd column. Possible values to provide are "America/New_York","America/Chicago", "America/Denver","America/Los_Angeles", "America/Anchorage", as well as the following which do not use daylight savings time: "America/Honolulu", "America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla". See also OlsonNames() for more information on time zones.

querySummary

logical to look at number of records and unique sites that will be returned from this query.

convertType

logical, defaults to TRUE. If TRUE, the function will convert the data to dates, datetimes, numerics based on a standard algorithm. If false, everything is returned as a character.

Value

A data frame with at least the following columns:

Name Type Description
OrganizationIdentifier character A designator used to uniquely identify a unique business establishment within a context.
OrganizationFormalName character The legal designator (i.e. formal name) of an organization.
ActivityIdentifier character Designator that uniquely identifies an activity within an organization.
ActivityTypeCode character The text describing the type of activity.
ActivityMediaName character Name or code indicating the environmental medium where the sample was taken.
ActivityMediaSubdivisionName character Name or code indicating the environmental matrix as a subdivision of the sample media.
ActivityStartDate character The calendar date on which the field activity is started.
ActivityStartTime.Time character The time of day that is reported when the field activity began, based on a 24-hour timescale.
ActivityStartTime.TimeZoneCode character The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.
ActivityEndDate character The calendar date when the field activity is completed.
ActivityEndTime.Time character The time of day that is reported when the field activity ended, based on a 24-hour timescale.
ActivityEndTime.TimeZoneCode character The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.
ActivityDepthHeightMeasure.MeasureValue character A measurement of the vertical location (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityDepthHeightMeasure.MeasureUnitCode.
ActivityDepthHeightMeasure.MeasureUnitCode character The code that represents the unit for measuring the item.
ActivityDepthAltitudeReferencePointText character The reference used to indicate the datum or reference used to establish the depth/altitude of an activity.
ActivityTopDepthHeightMeasure.MeasureValue character A measurement of the upper vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityTopDepthHeightMeasure.MeasureUnitCode.
ActivityTopDepthHeightMeasure.MeasureUnitCode character The code that represents the unit for measuring the item.
ActivityBottomDepthHeightMeasure.MeasureValue character A measurement of the lower vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityBottomDepthHeightMeasure.MeasureUnitCode.
ActivityBottomDepthHeightMeasure.MeasureUnitCode character The code that represents the unit for measuring the item.
ProjectIdentifier character A designator used to uniquely identify a data collection project within a context of an organization.
ActivityConductingOrganizationText character A name of the Organization conducting an activity.
MonitoringLocationIdentifier character A designator used to describe the unique name, number, or code assigned to identify the monitoring location.
ActivityCommentText character General comments concerning the activity.
SampleAquifer * character A code that designates the aquifer associated with groundwater samples.
HydrologicCondition * character Hydrologic condition is the hydrologic condition that is represented by the sample collected (i.e. ? normal, falling, rising, peak stage).
HydrologicEvent * character A hydrologic event that is represented by the sample collected (i.e. - storm, drought, snowmelt).
SampleCollectionMethod.MethodIdentifier character The identification number or code assigned by the method publisher.
SampleCollectionMethod.MethodIdentifierContext character Identifies the source or data system that created or defined the identifier.
SampleCollectionMethod.MethodName character The title that appears on the method from the method publisher.
SampleCollectionEquipmentName character The name for the equipment used in collecting the sample.
ResultDetectionConditionText character The textual descriptor of a result.
CharacteristicName character The object, property, or substance which is evaluated or enumerated by either a direct field measurement, a direct field observation, or by laboratory analysis of material collected in the field.
ResultSampleFractionText character The text name of the portion of the sample associated with results obtained from a physically-partitioned sample.
ResultMeasureValue numeric The reportable measure of the result for the chemical, microbiological or other characteristic being analyzed. Measure value is given in the units stored in ResultMeasure/MeasureUnitCode.
MeasureQualifierCode character A code used to identify any qualifying issues that affect the results.
ResultMeasure.MeasureUnitCode character The code that represents the unit for measuring the item.
ResultStatusIdentifier character Indicates the acceptability of the result with respect to QA/QC criteria.
StatisticalBaseCode character The code for the method used to calculate derived results.
ResultValueTypeName character A name that qualifies the process which was used in the determination of the result value (e.g., actual, estimated, calculated).
ResultWeightBasisText character The name that represents the form of the sample or portion of the sample which is associated with the result value (e.g., wet weight, dry weight, ash-free dry weight).
ResultTimeBasisText character The period of time (in days) over which a measurement was made. For example, BOD can be measured as 5 day or 20 day BOD.
ResultTemperatureBasisText character The name that represents the controlled temperature at which the sample was maintained during analysis, e.g. 25 deg BOD analysis.
ResultParticleSizeBasisText character User defined free text describing the particle size class for which the associated result is defined.
PrecisionValue character A measure of mutual agreement among individual measurements of the same property usually under prescribed similar conditions.
ResultCommentText character Free text with general comments concerning the result.
USGSPCode * character 5-digit number used in the US Geological Survey computerized data system, National Water Information System (NWIS), to uniquely identify a specific constituent.
ResultDepthHeightMeasure.MeasureValue + character A measurement of the vertical location (measured from a reference point) at which a result occurred.
ResultDepthHeightMeasure.MeasureUnitCode + character The code that represents the unit for measuring the item.
ResultDepthAltitudeReferencePointText + character The reference used to indicate the datum or reference used to establish the depth/altitude of a result.
SubjectTaxonomicName character The name of the organism from which a tissue sample was taken.
SampleTissueAnatomyName * character The name of the anatomy from which a tissue sample was taken.
ResultAnalyticalMethod.MethodIdentifier character The identification number or code assigned by the method publisher.
ResultAnalyticalMethod.MethodIdentifierContext character Identifies the source or data system that created or defined the identifier.
ResultAnalyticalMethod/MethodName character The title that appears on the method from the method publisher.
MethodDescriptionText * character A brief summary that provides general information about the method.
LaboratoryName character The name of Lab responsible for the result.
AnalysisStartDate character The calendar date on which the analysis began.
ResultLaboratoryCommentText character Remarks which further describe the laboratory procedures which produced the result.
DetectionQuantitationLimitTypeName character Text describing the type of detection or quantitation level used in the analysis of a characteristic.
DetectionQuantitationLimitMeasure.MeasureValue numeric Constituent concentration that, when processed through the complete method, produces a signal that is statistically different from a blank. Measure value is given in the units stored in DetectionQuantitationLimitMeasure/MeasureUnitCode.
DetectionQuantitationLimitMeasure.MeasureUnitCode character The code that represents the unit for measuring the item.
PreparationStartDate character The calendar date when the preparation/extraction of the sample for analysis began.
ActivityStartDateTime POSIXct Activity start date and time converted to POSIXct UTC.
ActivityEndDateTime POSIXct Activity end date and time converted to POSIXct UTC.

* = elements only in NWIS + = elements only in STORET

There are also several useful attributes attached to the data frame:

Name Type Description
url character The url used to generate the data
siteInfo data.frame A data frame containing information on the requested sites
variableInfo data.frame A data frame containing information on the requested parameters
queryTime POSIXct The time the data was returned

See Also

readWQPdata, whatWQPsites, readNWISqw, and importWQP

Examples



rawPcode <- readWQPqw("USGS-01594440", "01075", "", "")
rawCharacteristicName <- readWQPqw("WIDNR_WQX-10032762", "Specific conductance", "", "")
rawPHsites <- readWQPqw(c("USGS-05406450", "USGS-05427949", "WIDNR_WQX-133040"), "pH", "", "")
nwisEx <- readWQPqw("USGS-04024000", c("34247", "30234", "32104", "34220"), "", "2012-12-20")
nwisEx.summary <- readWQPqw("USGS-04024000", c("34247", "30234", "32104", "34220"),
  "", "2012-12-20",
  querySummary = TRUE
)

SC <- readWQPqw(siteNumbers = "USGS-05288705", parameterCd = "00300", convertType = FALSE)



dataRetrieval documentation built on Oct. 5, 2023, 5:09 p.m.