bash python

Introduction

API Endpoint

https://waterdatafortexas.org/coastal/api

A RESTful API is provided to access the data in this site. By default, responses are returned as JSON. Some routes do provide comma separated value (CSV) output as well. Tools such as curl and wget can be used to accesss the data, as well as direct calls in the browser.

In Situ Monitoring

Get Sites

Example

curl -g -L "https://waterdatafortexas.org/coastal/api/stations?bbox=[[-97.56,27.60],[-97.14,27.90]]"
import requests
payload = {"bbox": [[-97.56,27.60],[-97.14,27.90]]}
r = requests.get("https://waterdatafortexas.org/coastal/api/stations", params=payload)
data = r.json()

Example Response

[
  {
    "name": null, 
    "estuary": "Colorado-Lavaca Estuary", 
    "bay": "Matagorda Bay",
    "station_code": "6977", 
    "agency": 
      {
        "abbreviation": "LCRA", "id": 4, "name": "Lower Colorado River Authority"}, 
    "id": 134, 
    "coordinates": [-95.998506, 28.640239], 
    "description": "Matagorda 4SSW"
  }, 
  {
    "name": null,
    "estuary": "Colorado-Lavaca Estuary",
    "bay": "East Matagorda Bay",
    "station_code": "6980", 
    "agency": {
        "abbreviation": "LCRA", "id": 4, "name": "Lower Colorado River Authority"},
    "id": 136, 
    "coordinates": [-95.933, 28.672],
    "description": "East Bay @ Tripod"
  }, 
  ....
  {
    "name": "Upper Sabine Lake",
    "estuary": "Sabine-Neches Estuary", 
    "bay": "Sabine Lake",
    "station_code": "USAB",
    "agency": {
      "abbreviation": "TWDB", "id": 6, "name": "Texas Water Development Board"}, 
    "id": 2,
    "coordinates": [-93.82861111, 29.94444444],
    "description": "Upper Sabine Lake at  Platform A"
  }
]

Resource URL

Request Parameters

name type format Description
bbox array [[min_lon, min_lat], [max_lon, max_lat]] bounding box
all_stations boolean true or false get stations regardless of data availability

Get Site Parameters

Example

curl -L "https://waterdatafortexas.org/coastal/api/stations/6990/parameters" 
import requests
r = requests.get("https://waterdatafortexas.org/coastal/api/stations/6990/parameters")
data = r.json()

Example Response

[
  {
    "units_name": "Practical Salinity Unit", 
    "description": null,
    "abbreviation": "Salinity", 
    "code": "seawater_salinity", 
    "units_abbreviation": "PSU", 
    "id": 3, 
    "name": "Salinity"
  }, 
  {
    "units_name": "Milligrams Per Liter", 
    "description": null,
    "abbreviation": "Dissolved Oxygen Concentration",
    "code": "water_dissolved_oxygen_concentration", 
    "units_abbreviation": "mg/L", 
    "id": 18,
    "name": "Dissolved Oxygen Concentration"
  }, 
  {
    "units_name": "Degrees Celsius",
    "description": null,
    "abbreviation": "Water Temperature",
    "code": "water_temperature",
    "units_abbreviation": "degC",
    "id": 21,
    "name": "Water Temperature"
  },
]

Resource URL

Request Parameters

Get Site Parameter Data

Example

curl -L "https://waterdatafortexas.org/coastal/api/stations/MIDG/data/seawater_salinity?start_date=2010-01-01&end_date=2010-12-31&binning=hour"
import requests
payload = {"start_date": "2010-01-01", "end_date": "2010-12-31", "binning": "hour"}
r = requests.get("https://waterdatafortexas.org/coastal/api/stations/MIDG/data/seawater_salinity", params=payload)
data = r.json()

Example Response

[ 
  {
    "value":17.911,
    "datetime_utc":"2010-01-01T06:00:00.000Z"
  },
  {
    "value":17.567,
    "datetime_utc":"2010-01-01T07:00:00.000Z"
  },
.....
  {
    "value":26.958,
    "datetime_utc":"2010-12-31T04:00:00.000Z"
  },
  {
    "value":27.058,
    "datetime_utc":"2010-12-31T05:00:00.000Z"
  }
]

Resource URL

Request Parameters

name type format Description
start_date string YYYY-MM-DD get data after this date
end_date string YYYY-MM-DD get data before this date
binning string mon/day(default)/hour data averaging period
output_format string csv or json specify output format

Point Measurements

Get Parameter Data

Example

curl -L "https://waterdatafortexas.org/coastal/api/point-measurements/water_dissolved_oxygen_concentration?start_date=2014-01-01&end_date=2014-01-31&geo_id=374" 
import requests
payload = {"start_date": "2014-01-01", "end_date":"2014-01-30", "geo_id": 374}
r = requests.get("https://waterdatafortexas.org/coastal/api/point-measurements/dissolved_oxygen_concentration", params=payload)
data = r.json()

Example Response

[
  {
    "datetime_utc": "2014-01-07T16:18:00+00:00",
    "parameter_code": "water_dissolved_oxygen_concentration",
    "coordinates": [-94.9158333333, 29.4797222222], 
    "value": 20.6
  }, 
  {
    "datetime_utc": "2014-01-07T16:35:00+00:00",
    "parameter_code": "water_dissolved_oxygen_concentration", 
    "coordinates": [-94.9213888889, 29.4727777778], 
    "value": 9.4
  },
  ....
  {
    "datetime_utc": "2014-01-30T18:20:00+00:00",
    "parameter_code": "water_dissolved_oxygen_concentration", 
    "coordinates": [-95.1633333333, 29.09],
    "value": 9.9
  }, 
  {
    "datetime_utc": "2014-01-30T18:49:00+00:00",
    "parameter_code": "water_dissolved_oxygen_concentration", 
    "coordinates": [-95.1744444444, 29.085], 
    "value": 10.2
  }
]

Resource URL

Request Parameters

name type format Description
bbox array [[min_lon, min_lat], [max_lon, max_lat]] bounding box to get data points within
start_date string YYYY-MM-DD get data after this date
end_date string YYYY-MM-DD get data before this date
geo_id integer 12 geo_id of estuary to get data points within
output_format string csv or json (default) specify output format

Get Summary Statistics

Example

curl -L https://waterdatafortexas.org/coastal/api/point-measurements/water_temperature/summary-statistics?geo_id=369
import requests
payload = {"geo_id": 369}
r = requests.get("https://waterdatafortexas.org/coastal/api/point-measurements/water_temperature/summary-statistics", params=payload)
data = r.json()

Example Response

[
  {
    "count": 4,
    "mean": 22.25,
    "mon": 10.0,
    "year": 1976.0
  }, 
  {
    "count": 4,
    "mean": 16.5,
    "mon": 11.0,
    "year": 1976.0
  },
....
  {
    "count": 69,
    "mean": 15.8,
    "mon": 11.0,
    "year": 2014.0
  },
  {
    "count": 64,
    "mean": 17.4,
    "mon": 12.0,
    "year": 2014.0
  }
]

Resource URL

Request Parameters

name type format Description
bbox array [[min_lon, min_lat], [max_lon, max_lat]] bounding box to filter data points within
geo_id integer 12 geo_id of estuary to filter data points within

Coastal Hydrology

Example

curl -L "https://waterdatafortexas.org/coastal/api/hydrology/700/timeseries?resample=month"
import requests
payload = {"resample": "month"}
r = requests.get("https://waterdatafortexas.org/coastal/api/hydrology/700/timeseries", params=payload)
data = r.json()

Example Response

[
  {
    "date":"1941-01-01T00:00:00.000Z",
    "gauge":3525880.0,
    "model":133731.0,
    "preersion":3000.0,
    "return":12000.0,
    "fresh_in":3668611.0
  },
  {
    "date":"1941-02-01T00:00:00.000Z",
    "gauge":1567360.0,
    "model":69357.0,
    "preersion":3000.0,
    "return":11000.0,
    "fresh_in":1644717.0
    },
....
  {
    "date":"2014-12-01T00:00:00.000Z",
    "gauge":343264.0,
    "model":173239.0,
    "preersion":10691.74999999,
    "return":129595.03023003,
    "fresh_in":635406.28022908
  }
]

Resource URL

Request Parameters

name type format Description
output_format string csv or json (default) specify output format
resample string month or year specify period to calculate sums

GIS Data

Example

curl -L "https://waterdatafortexas.org/coastal/api/geometries/watershed"
import requests
r = requests.get("https://waterdatafortexas.org/coastal/api/geometries/watershed")
data = r.json()

Example Response

{
  "type": "FeatureCollection", 
  "features": [
    {
      "name": "Sabine-Neches Estuary", 
      "geometry": {
        "type": "MultiPolygon", 
        "coordinates": [[[[-94.10138, 30.13913], [-94.10284, 30.13834],... [-94.10445, 30.13787], [-94.10661, 30.13779]]]]
      },
      "extradata": {
        "Acres": 71971.08675, 
        "Area_m": 291256654.653, 
        "MJRBY": "Sabine-Neches Estuary", 
        "MJRcd": "1", 
        "Hectares": 29125.6654653
      }
      "type": "Feature",
      "id": 368
    },
    ...
    {
      "name": "Colorado-Lavaca Estuary", 
      "geometry": {
        "type": "MultiPolygon", 
        "coordinates": [[[[-95.79419, 28.82235], ...., [-95.7928, 28.82099], [-95.79214, 28.8205], [-95.7911, 28.82012]]]]
      },
      "extradata": {
        "Acres": 285268.29345,
        "Area_m": 1154439825.45, 
        "MJRBY": "Colorado-Lavaca Estuary", 
        "MJRcd": "3",
        "Hectares": 115443.982545
      }, 
      "id": 369,
      "type": "Feature"
    }
  ]
}

Resource URL

Request Parameters