Time Series
Returns data for a station or set of stations based on a time span
Request Format
A Time Series request is an HTTP URL with the following form:
https://api.synopticdata.com/v2/stations/timeseries
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.At least one station selection parameter (required):
Either
startandend, orrecent(one is required but not both)start&end, Defines thestartandendtime 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. Thestartparameter must be used with theendparameter. 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
obtimezoneparameter.recent, Indicates the number of minutes to return, previous to the current time. For example:recent=120will return the last two hours of observations.
Optional Parameters
complete(1, 0 [default]), A value of 1 or 0. When set to 1 an extended list of metadata attributes for each returned station is provided. This result is useful for exploring the zones and regions in which a station resides. Example:complete=1.fields(string), Case-insensitive comma-separated list of metadata attributes to include in the output response. Default is to include all attributes. Only works with attributes defined in the default metadata set (e.g. attributes shown viacomplete=1cannot be selected). Example:fields=stid,name.obtimezone(UTC [default], local), Indicates if the time zone of the response is in UTC or the local time zone of the station. Sets the time zone applied to the observation output (input times associated withstartandendare always UTC). Example:obtimezone=localshowemptystations(0 [default], 1), Indicates if stations with no observations will be returned. Setting to1will return any station meeting the defined time period, variables, and geographic or network parameters, even if there are no observation data available.showemptyvars(0 [default], 1), Indicates if variables with no observations for the requested time period will be returned. Default behavior is to remove any variables from theOBSERVATIONSelement if no data is present. Setting to 1 will return keys in theOBSERVATIONSelement for any requested variables. This guarantees that all keys in theSENSOR_VARIABLESelement will be present in theOBSERVATIONSelement. For the timeseries service, if other non-requested variables have reported for the requested time period, empty variables will be shown withnullarrays. However if no station reports are present for the period empty variables will show empty lists ([]). Note that if all requested variables are empty you will also need to passshowemptystations=1to retain the station and variables in the response.units(metric [default], english, [custom format]), Defines the unit of measure for returned data. For standard measurements used by many in the United Statesenglishwill fill most needs. There is also the ability to support custom unit configurations. This is achieved by accessing the variable group such as “temp” and setting the desired unit using a pipe (|) character. The following list describes the available units for each variable group.temp(C, F, K), Temperature: Celsius, Fahrenheit and Kelvin.speed(mps, mph, kph, kts), Speed/Velocity: Meters per second, miles per hour, kilometers per hour, knots.pres(pa, mb, inhg), Pressure: Pascals, millibars, inches mercury.height(m, ft), Height: Meters, feet.precip(mm, cm, in), Precipitation: Millimeters, centimeters, inches.alti(pa, inhg), Altimeter: Pascals, inches mercury.fuel_moisture(gm, %), Fuel Moisture: Grams, %.
Furthermore, it is possible to modify one of the preset settings (metric/english). This is achieved by appending a variable group and unit to the parameter string with a comma. For example, to use “english” units with any speed variables in mph (instead of default knots) the parameter would be
&units=english,speed|mph.precip(0 [default], 1), Enable derived precip (Basic Precipitation Service). All raw precip variables will be replaced with two new variables namedprecip_intervals_set_1dandprecip_accumulated_set_1d.precip_intervals_set_1drepresents precip received in the intervals between consecutive observations. For ASOS stations, the intervals span between official 1-hr and special METAR reports.precip_accumulated_set_1dis a cumulative sum of the interval values for the requested time period. Note that precip values will only be reported for complete intervals contained within the requestedstartandend. If you are using this service to sum precip for consecutive requests, it is possible that intervals spanning the edges of your request window will not be counted (the Advanced Precipitation Service may be better suited for this request pattern). Passingvars=precipalong withprecip=1enables return of derived precip without needing to specify an individual precip variable withvars=, or needing to return all reported variables for a station (omittingvars). Example:precip=1orvars=precip&precip=1all_reports(0 [default], 1), Indicates if reports from all available precipitation variables should be returned. Some networks (such as ASOS/AWOS) can report precipitation in multiple forms (e.g.precip_accum_one_hourandprecip_accum_six_hour). By default, the derived precip returned withprecip=1will be calculated using the single most representative and consistently reporting variable. (requiresprecip=1to be enabled)hfmetars(0, 1 [default]) Disable use of High Frequency NOAA METAR data. This is a variant of the hourly NWS/FAA airport data where observations are recorded approximately every 5 minutes. A value of0will exclude these data from data returns.sensorvars(0 [default], 1) Indicates if sensor specific metadata for each variable in theSENSOR_VARIABLESelement will be returned. Each sensor element contains the following: apositionvalue indicating the height of the sensor, aPERIOD_OF_RECORDvalue that describes the period of the sensor being active, and aderived_fromlist of source observations (derived variables only). By default (0), empty objects will be returned within theSENSOR_VARIABLESelement, with the exception derived variables which will always showderived_fromkeys.sitinghistory(0 [default], 1), Will return all historical siting metadata for each station, as a list within theSITINGkey (requirescomplete=1to be enabled). Example:sitinghistory=1.
The following example will request all the stations in Utah with an observation within the last two hours:
https://api.synopticdata.com/v2/stations/timeseries?state=ut&recent=120&token=YOUR_TOKEN_HERE
The following example will request only the air temperature for KSLC (Salt Lake City Airport) on January 3, 2015:
https://api.synopticdata.com/v2/stations/timeseries?stid=kslc&start=201501030000&end=201501032359&vars=air_temp&token=YOUR_TOKEN_HERE
Response Format Parameters
timeformat, Defines a time format that all time stamps in the data response to be formatted to. By default the API will return time values in ISO 8601 format. This behavior can be changed by passing a string with a valid strftime expression. Below are some common examples.timeformat=%m/%d/%Y at %H:%Mwould yield “06/22/2017 at 17:06”timeformat=%b%20%d%20%Y%20-%20%H:%Mwould yield “Jun 22 2017 - 17:06”timeformat=%sreturns Unix/POSIX time in terms of seconds (this parameter cannot be used withobtimezone). This is a special function in addition to the supported strftime arguments.
output(json [default], csv, 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.csvonly works when requesting a single station. i.e using thestidparameter.geojsonwill only return the best guess sensor if the station has multiple sensors of the same type.
Data Checks and Quality Control
By default, the API does not return data that has been flagged as non-plausible by the Synoptic Range Check, e.g. a temperature value of 200°C.
If the qc parameter is omitted then the API will return data while assuming the following: qc=on, qc_remove_data=on, qc_flags=off and qc_checks=sl_range_check. Note that if the range check removes all values for all requested stations and variables, a response message of “No stations found for this request” will be returned. If the range check removes all values only for certain variables, those variables will not be present in the OBSERVATIONS object.
Note: The existence of a data check flag for an observation is not necessarily an indication of invalid or inaccurate data. For a detailed explanation of data checks, please click here to read more.
qc(on [default], off), Indicates the application behavior of the QC attributes on the data requested. If set tooffthen all data will be returned without data checks and quality control (not recommended). If set toon, aQC_SUMMARYobject is returned, aQC_FLAGGED: [bool]key will be inside theSTATIONobject, and individual data checks will be in theqcresponse key for each variable within theOBSERVATIONSobject.qc_remove_data(on, off, mark), Indicates the response behavior for an observation that fails a user specified data check. (defaultonifqcparameter omitted, elseoffifqc=on)offreturns the data values even if a data check failure is present for that data.onremoves failed data values, returningnull. If all values for all requested stations and variables are set tonull, a response message of “No stations found for this request” will be returned. If all values for an individual variable are set tonull, the variable will not be present in theOBSERVATIONSobject.markreplaces failed data with a value offalse.
qc_flags(on, off), Indicates whether the data checks are returned alongside any data that failed a requested check. Ifonthen the data checks will be returned in theqcresponse key for each variable within theOBSERVATIONSblock. (defaultoffifqcparameter omitted, elseonifqc=on)qc_checks([flag name], [flag source], keyword), defines a list of applied data checks. (defaults tosl_range_checkifqcparameter omitted, elsesynopticlabsifqc=on)“flag name” allows targeting one or more specific data checks in a comma separated list (e.g.
sl_range_check,sl_rate_check)“flag source” allows targeting one or more data check providers (
synopticlabs,mesowestormadis).“keyword” can be one of the following:
basic,advanced,all. Click here to read more about the basic and advanced groups of checks).allwill apply all data checks in our system. Caution: This argument will enable all flag sources, some of which can aggressively flag data, and may remove significant amounts of data ifqc_remove_data=on.
Some examples of modifying the default QC checks are:
qc_checks=synopticlabs,ma_range_check, Applies the Synoptic QC suite and MADIS range checkqc_checks=synopticlabs,madis, Applies the Synoptic and MADIS QC suites.
Request Response
JSON Format
The Time Series 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. Please refer to JSON Output format for an in-depth description of each element.
An example of the OBSERVATIONS element returned by the Time Series service:
{
...
"STATION": [
{
"OBSERVATIONS": {
"date_time": [
"2015-01-03T00:00:00Z",
"2015-01-03T00:05:00Z",
"2015-01-03T00:10:00Z",
"2015-01-03T00:15:00Z",
"2015-01-03T00:20:00Z"
],
"air_temp_set_1": [
-5.6,
-5.6,
-6.1,
-6.1,
-6.7
]
}
...
}
The OBSERVATIONS element will contain the array date_time, these timestamps will map to the values of the same index for every variable. The key of the array for each variable will consist of their variable name, “_set_” and the number of the sensor which the observations came from (sensor specific metadata is available in SENSOR_VARAIABLES). For example, air temperature from sensor 1 will have the key air_temp_set_1.