swagger: "2.0"
schemes:
  - https
host: daymet.ornl.gov
basePath: /single-pixel
info:
  contact:
    x-twitter: NASAEarthData
  description: |-
    Welcome to the Daymet Single Pixel Extraction Tool API. You can use this API to download daily surface data within the Daymet database in a `csv` or `json` format for a single point. This API allows users to query a single geographic point by latitude and longitude in decimal degrees. A routine is executed that translates the (lon, lat) coordinates into projected Daymet (x,y) Lambert Conformal Coordinates. These coordinates are used to access the Daymet database of daily interpolated surface weather variables. Daily data from the nearest 1 km x 1 km Daymet grid cell are extracted from the database.

    If you would like to learn how to automate the download of multiple locations for the Daymet Single Pixel Extraction Tool, click [here](https://github.com/ornldaac/daymet-single-pixel-batch).
  title: Daymet Single Pixel Extraction Tool API
  version: 1.0.2
  x-apisguru-categories:
    - location
  x-logo:
    url: https://twitter.com/NASAEarthData/profile_image?size=original
  x-origin:
    - format: swagger
      url: https://daymet.ornl.gov/single-pixel/static/swagger.json
      version: "2.0"
  x-providerName: ornl.gov
  x-serviceName: daymet
paths:
  /api/data:
    get:
      description: Returns a csv or json of the requested data to local machine
      parameters:
        - description: Latitude component of location.
          format: double
          in: query
          name: lat
          required: true
          type: number
        - description: Longitude component of location.
          format: double
          in: query
          name: lon
          required: true
          type: number
        - description: Daymet Daily weather estimates.
          in: query
          items:
            type: string
          name: vars
          type: array
        - description: Subset on years [1980..2019].
          in: query
          items:
            type: string
          name: years
          type: array
        - description: Subset on dates (start date).
          format: date
          in: query
          name: start
          type: string
        - description: Subset on dates (end date).
          format: date
          in: query
          name: end
          type: string
        - description: Specify a format for data retrieval.
          enum:
            - csv
            - json
          in: query
          name: format
          required: true
          type: string
      produces:
        - application/json
        - text/csv
      responses:
        "200":
          description: Successful Execution
        default:
          description: Unexpected Error
      summary: Download Daymet Data
  /preview:
    get:
      description: Returns a table to the browser displaying requested data
      parameters:
        - description: Latitude component of location
          format: double
          in: query
          name: lat
          required: true
          type: number
        - description: Longitude component of location.
          format: double
          in: query
          name: lon
          required: true
          type: number
        - description: Daymet Daily weather estimates.
          in: query
          items:
            type: string
          name: vars
          type: array
        - description: Subset on years [1980..2019].
          in: query
          items:
            type: string
          name: years
          type: array
        - description: Subset on dates (start date).
          format: date
          in: query
          name: start
          type: string
        - description: Subset on dates (end date).
          format: date
          in: query
          name: end
          type: string
        - description: Specify a format for data retrieval.
          enum:
            - csv
            - json
          in: query
          name: format
          required: true
          type: string
      produces:
        - application/html
      responses:
        "200":
          description: Successful Execution
        default:
          description: Unexpected Error
      summary: Preview Daymet Data in a web browser
  /send/saveData:
    get:
      description: Returns a csv or json of the requested data to local machine
      parameters:
        - description: Latitude component of location.
          format: double
          in: query
          name: lat
          required: true
          type: number
        - description: Longitude component of location.
          format: double
          in: query
          name: lon
          required: true
          type: number
        - description: Daymet Daily weather estimates.
          in: query
          items:
            type: string
          name: vars
          type: array
        - description: Subset on years [1980..2019].
          in: query
          items:
            type: string
          name: years
          type: array
        - description: Subset on dates (start date).
          format: date
          in: query
          name: start
          type: string
        - description: Subset on dates (end date).
          format: date
          in: query
          name: end
          type: string
        - description: Specify a format for data retrieval.
          enum:
            - csv
            - json
          in: query
          name: format
          required: true
          type: string
      produces:
        - application/json
        - text/csv
      responses:
        "200":
          description: Successful Execution
        default:
          description: Unexpected Error
      summary: Download Daymet Data
  /visualize:
    get:
      description: Returns plots to a web browser of requested data using Plotly
      parameters:
        - description: Latitude component of location.
          format: double
          in: query
          name: lat
          required: true
          type: number
        - description: Longitude component of location.
          format: double
          in: query
          name: lon
          required: true
          type: number
        - description: Daymet Daily weather estimates.
          in: query
          items:
            type: string
          name: vars
          type: array
        - description: Subset on years [1980..2019].
          in: query
          items:
            type: string
          name: years
          type: array
        - description: Subset on dates (start date).
          format: date
          in: query
          name: start
          type: string
        - description: Subset on dates (end date).
          format: date
          in: query
          name: end
          type: string
        - description: Specify a format for data retrieval.
          enum:
            - csv
            - json
          in: query
          name: format
          required: true
          type: string
      produces:
        - application/html
      responses:
        "200":
          description: Successful Execution
        default:
          description: Unexpected Error
      summary: Visualize Daymet Data in a web browser
