IzzyFad / NorthropGrumman-HIP

https://izzyfad.github.io/NorthropGrumman-HIP/
2 stars 0 forks source link

Python Scripts to collect data #4

Open zpshank opened 3 years ago

zpshank commented 3 years ago

Given the kind of data needed to collect from issue #3, python scripts will need to be created to collect that information automatically.

Acceptance Criteria:

IzzyFad commented 3 years ago

import requests import json import plotly.express as px import sys from operator import itemgetter startDate = sys.argv[1] endDate = sys.argv[2] r = requests.get ('http://data.chesapeakebay.net/api.JSON/WaterQuality/WaterQuality/{0}/{1}/6/23/Station/1730/123'.format(startDate, endDate)) rows = json.loads (r.text) filteredRows = [] for row in rows: if row ["Depth"] == 8: filteredRows.append(row) sortedlist = sorted(filteredRows, key=itemgetter('SampleDate')) fig = px.line(sortedlist, x = "SampleDate", y = "MeasureValue", title = 'Historic Oxygen Levels') fig.write_image("fig1.png")