Skip to main content
Skip table of contents

Latency

Returns transmission latency for a station or set of stations based on a start and end date/time.

Request Format

A Latency request is an HTTP URL with the following form:

NONE
https://api.synopticdata.com/v2/stations/latency

This service reports the delay time (in minutes) of an observation received at our ingest servers relative to the observation’s timestamp. Due to the nature of computer clock drift and time synchronization, some observations can be received “before they occur”. This results in a negative latency value. This can occur from in incorrect time stamp as provided by the station, or (more often than not) natural clock drift.

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.

Station Selection Parameters

These selectors individually or combined to target the desired stations.

Exclusion Operator

Selectors noted as (excludable) may be specified with a ! preceding a value to remove/exclude from the selection from a result set. So stid=!KSLC would prevent KSLC from returning in a query. This should be used in combination with different selectors. Remember to only include any given selector once.

stid

(string, excludable), Single or comma separated list of SynopticLabs station IDs. Use a ! before any value to exclude matching stations. Example: stid=mtmet,kslc,fps. Try it Now

state

(string, excludable), Single or comma separated list of abbreviated 2 character states. If country is not included, default is United States (US). Use a ! before any value to exclude matching stations. Example: state=ut,wy,dc.

country

(string, excludable), Single or comma separated list of abbreviated 2 or 3 character countries. Use a ! before any value to exclude matching stations. Example: country=us,ca,mx.

nwszone

(string, excludable), Single or comma separated list of National Weather Service Zones. Use a ! before any value to exclude matching stations. Example: nwszone=UT003,CA041.

nwsfirezone

(string, excludable), Single or comma separated list of National Weather Service Fire Zones. Use a ! before any value to exclude matching stations. Example: nwsfirezone=LOX241

cwa

(string, excludable), Single or comma separated list of National Weather Service County Warning Areas. Use a ! before any value to exclude matching stations. Example: cwa=LOX.

gacc

(string, excludable), Single or comma separated list of Geographic Area Coordination Centers. Use a ! before any value to exclude matching stations. Example: gacc=GB.

subgacc

(string, excludable), Single or comma separated list of Sub Geographic Area Coordination Centers. Use a ! before any value to exclude matching stations. Example: subgacc=EB07.

county

(string, excludable), Single or comma separated list of counties. Use the state parameter to filter by state in the case of duplicate county names (i.e. “King”). Use a ! before any value to exclude matching stations. Example: county=king&state=wa.

vars

(string), Single or comma separated list of sensor variables found here. The request will return all stations matching at least one of the variables provided. This is useful for filtering all stations that sense only certain variables, such as wind speed, or pressure. Do not specify vars twice in a query string. Some web services use this argument to adjust what information is delivered. Example: vars=wind_speed,pressure. Try it Now

varsoperator

(string), Define how &vars is understood. or (the default) means any station with any variable in the list is used. and means a station must report every variable to be included. Example: varsoperator=and.

network

(number, string, excludable), Single or comma separated list of network IDs or short names. The ID can be found be using the Networks service and are also listed here. Use a ! before any value to exclude specific networks from a result set. Example: network=153 or network=uunet,raws.

radius

(string), A comma separated list of three values of the type [latitude,longitude,miles] or [stn_id,miles]. Coordinates are in decimal degrees. Returns all stations within radius of the point (or station, given by the station ID) and provides the DISTANCE of the station from given location with units of miles. Adding limit=n to the query will limit the number of returned stations to n stations, and will order the stations by DISTANCE. Some examples are: radius=41.5,-120.25,20, radius=wbb,10, radius=41.5,-120.25,20&limit=10.

bbox

(string), A bounding box defined by the lower left and upper right corners in decimal degrees latitude and longitude coordinates, in the form of [lonmin,latmin,lonmax,latmax]. Recall that for regions involving the western and southern hemispheres that the coordinates are negative values (e.g., 120 W is -120, 20 S is -20). Example: bbox=-120,40,-119,41.

Bounding Box Thinning

A new feature allows you to use the API to thin the returned station set within a bounding box by providing some additional arguments. These arguments only take effect when the bbox parameter is used:

height

(number) the height of the map viewport in pixels

width

(number) the width of the map viewport in pixels

spacing

(number) the preferred number of pixels a station on the map should consume

networkimportance

(numbers, comma-separated) a list of comma separated network IDs that will be considered in the order provided. When there is a collision of stations within the defined “spacing” area, any station matching the list of preferred networks will be shown over any other.

status

(string), A value of either active or inactive returns only stations that are currently set as active in the archive. By default, omitting this parameter will return all stations. Example: status=active.

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 via complete=1 cannot be selected). Example: fields=stid,name.

  • start and end

    • start & end, Defines the start and end 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. The start parameter must be used with the end 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.

Optional Parameters

  • obtimezone (UTC [default], local), Indicates if the time zone of the response is in UTC or the local timezone of the station where the data was observed. 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 for the requested time span will be returned. Indicates if stations with no observations will be returned. Setting to 1 will return any station meeting the defined time period, variables, and geographic or network parameters, even if there are no observation data available.

  • stats (min, max, mean, median, count, stdev, all), Indicates what statistical values to return. Values can not be combined.

    • stats=min returns the minimum value and time stamp.

    • stats=max returns the maximum value and time stamp.

    • stats=mean returns the mean (average) value and start and end time stamps.

    • stats=median returns the median value and start and end time stamps.

    • stats=count returns the number of mins in time span.

    • stats=stdev returns the standard deviation value and start and end time stamps.

    • stats=all returns all statistics.

The following example returns the latency and statistics for stid=wbb in for January 1, 2018:

NONE
https://api.synopticdata.com/v2/stations/latency?stid=wbb&start=201801010000&end=201801012359&stats=all&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:%M would yield “06/22/2017 at 17:06”

    • timeformat=%b%20%d%20%Y%20-%20%H:%M would yield “Jun 22 2017 - 17:06”

    • timeformat=%s returns Unix/POSIX time in terms of seconds (this parameter cannot be used with obtimezone). This is a special function in addition to the supported strftime arguments.

  • output (json [default], xml), 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.

Request Response

JSON Format

The Latency 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:

JSON
{
  STATION: [
    {
      STATUS: "ACTIVE",
      MNET_ID: "153",
      PERIOD_OF_RECORD: {
        start: "1997-01-01T00:00:00Z",
        end: "2023-07-31T17:55:00Z"
      },
      ELEVATION: "4806",
      NAME: "U of U William Browning Building",
      LATENCY: {
        date_time: ["2018-01-01T00:00:00Z","2018-01-01T00:01:00Z",...],
        values: [-3,5,...]
      },
      RESTRICTED_DATA: "0",
      STID: "WBB",
      LONGITUDE: "-111.84755",
      UNITS: {
        position: "m",
        elevation: "ft"
      },
      STATE: "UT",
      STATISTICS: {
        count: 1440,
        start: "201801010000",
        minimum: -3,
        end: "201801012359",
        mintime: "2018-01-01T00:00:00Z",
        standard_deviation: 2.766415596008301,
        maxtime: "2018-01-01T00:01:00Z",
        median: 3,
        average: 2.2166666984558105,
        maximum: 5
      },
      LATITUDE: "40.76623",
      TIMEZONE: "America/Denver",
      ID: "1"
    }
  ],
  SUMMARY: {
    DATA_QUERY_TIME: "116.713047028 ms",
    RESPONSE_CODE: 1,
    RESPONSE_MESSAGE: "OK",
    METADATA_RESPONSE_TIME: "17.0068740845 ms",
    DATA_PARSING_TIME: "5.17821311951 ms",
    VERSION: "v2.21.0",
    TOTAL_DATA_TIME: "121.893167496 ms",
    NUMBER_OF_OBJECTS: 1
  }
}
  • 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 the RESPONSE_CODE.

    • RESPONSE_TIME, (always returned) server time to process the request.

  • STATION{}

    • LATENCY[], contains a timestamps and latency values in (in minutes)

    • STATISTICS[], contains statistics.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.