Quality Control Segments
Returns data for a station or set of stations for a time span
Request Format
A QC Segments request is an HTTP URL with the following form:
https://api.synopticdata.com/v2/stations/qcsegments
Acquiring data from this web service requires certain parameters. When encoding URLs, all parameters are separated using the ampersand (&) character and their value is indicated by an equal sign (=). Below is a list of accepted parameters.
token
(required), Your application’s API token. This is used to identify who is requesting API data. You are never required to use multiple tokens, but you can use as many as you need. Learn more in our tokens overview.Any number of station selection parameters (optional). Including no station selections will return results for all stations. This can result in extremely large results for services that support it.
Either
start
andend
, orrecent
(one is required but not both)start
&end
, Defines thestart
andend
time of the request with the form of YYYYmmddHHMM. Where YYYY is year, mm is month, dd is day, HH is hour, and MM is minutes. Thestart
parameter must be used with theend
parameter. For example:start=201306011800&end=201306021215
.All times are requested in UTC, but may be returned in either UTC or local time format for each station. See the
obtimezone
parameter.recent
, Indicates the number of minutes to return, previous to the current time. For example:recent=120
will return the last two hours of observations.
Optional Parameters
inside
(1, 0 [default]), Requires the QC segment start within the requested time span. Example:inside=1
.obtimezone
(UTC [default], local), Indicates if the time zone of the response is in UTC or the local timezone of the station. Sets the timezone applied to the observation output (input times associated with start and end are always UTC). Example:obtimezone=local
showemptystations
(0 [default], 1), Indicates if stations with no observations will be returned. Setting to1
will return any station meeting the defined time period, variables, and geographic or network parameters, even if there are no observation data available.qc_checks
([flag name], [flag source], all) defines a list of data checks applied to data values. The settings of other QC parameters determines how the data and data checks are returned.all
will return any data check in our system.“flag name” allows the targeting of a flag by name or a list (comma separated) of flags.
“flag source” allows targeting a data check provider i.e.
synopticlabs
for SynopticLabs.
The following example will request all the stations in Utah with an open QC segment within the last two hours:
https://api.synopticdata.com/v2/stations/qcsegments?state=ut&recent=120&token=YOUR_TOKEN_HERE
The following example will request only the QC segments for air temperature at KSLC (Salt Lake City Airport) on January 3, 2015:
https://api.synopticdata.com/v2/stations/qcsegments?stid=kslc&start=201501030000&end=201501032359&vars=air_temp&token=YOUR_TOKEN_HERE
Response Format Parameters
output
(json [default], xml, geojson), Indicates the response format of the request. It’s recommended to use the JSON format which there are well supported parsing libraries in all major languages.GeoJSON will only return the best guess sensor if the station has multiple sensors of the same type.
Request Response
JSON Format
The QC Segments service will return its results in a single organized and self describing JSON object. At a minimum, every request will return a JSON object with a "SUMMARY"
field.
An example JSON response would be:
{
QC_SHORTNAMES: {
18: "ma_stat_cons_check"
},
QC_SOURCENAMES: {
18: "MADIS"
},
SUMMARY: {
DATA_QUERY_TIME: "110.540151596 ms",
RESPONSE_CODE: 1,
RESPONSE_MESSAGE: "OK",
METADATA_RESPONSE_TIME: "127.150058746 ms",
DATA_PARSING_TIME: "1.11985206604 ms",
VERSION: "v2.21.0",
TOTAL_DATA_TIME: "111.660003662 ms",
NUMBER_OF_OBJECTS: 1,
FUNCTION_USED: "qc_segment_parser"
},
STATION: [
{
STATUS: "ACTIVE",
MNET_ID: "195",
PERIOD_OF_RECORD: {
start: "2016-12-14T16:52:00Z",
end: "2023-08-01T22:57:00Z"
},
ELEVATION: "3885",
NAME: "ARNOLD CA",
QC: [
{
start: "2018-01-21T17:00:00Z",
qc_flag: 18,
sensor: "air_temp_qc_1",
end: "2018-01-21T17:00:00Z",
is_open: false
}
],
STID: "ARLC1",
SENSOR_VARIABLES: {
air_temp: {
air_temp_qc_1: { }
}
},
ELEV_DEM: "3818.9",
LONGITUDE: "-120.36000",
UNITS: {
position: "m",
elevation: "ft"
},
STATE: "CA",
RESTRICTED: false,
LATITUDE: "38.23000",
TIMEZONE: "America/Los_Angeles",
ID: "42541"
}
],
QC_NAMES: {
18: "MADIS Spatial Consistency Check"
}
}
SUMMARY{}
NUMBER_OF_OBJECTS
, (always returned) is a integer value of the number of stations returned.RESPONSE_CODE
, (always returned) is a numerical code indicating the status of the request.“1” = “OK”
“2” = “Zero Results”
“200” = “Authentication failure”
“400” = “Violates a rule of the API”
RESPONSE_MESSAGE
, (always returned) is a string explaining theRESPONSE_CODE
.RESPONSE_TIME
, (always returned) server time to process the request.
STATION[]
SENSOR_VARIABLES[]
, summary of variables in the OBSERVATIONS element.QC[]
, contains the QC segments.start
, start of segment.end
: end time of segment. If the segment is open, the end time will be time of query.qc_flag
, QC check ID (see QC Types).sensor
, sensor name and instance.is_open
, is the segment open or closed.
QC_SHORTNAMES{}
, key/value pairs of QC flag IDs to short names.QC_NAMES{}
, key/value pair of QC flag IDs to flag’s formal name.QC_SOURCENAMES{}
, key/value pairs of QC flag IDs to provider name.
Note: The data in this example is simulated.