예제 #1
0
def goes_data():
    begin = request.args["begin"]
    end = request.args["end"]
    try:
        tr = TimeRange(begin, end)
    except ValueError:
        return jsonify({"message": "Date error"}), 400

    results = Fido.search(attrs.Time(tr), attrs.Instrument("XRS"))
    files = Fido.fetch(results)
    goes = TimeSeries(files)
    # Transforms XRSTimeSeries object to a Dataframe to ease manipulation.
    goes = goes.to_dataframe()

    begin, end = get_correct_goes_index(goes.index, begin, end)
    goes = goes[begin:end]
    # Transforms all the index to strings.
    goes.index = goes.index.map(lambda x: str(x))
    return Response(goes.to_json(), mimetype='application/json')
예제 #2
0
def read_solar_data():
    noaa = TimeSeries('./../data/RecentIndices.txt', source='NOAAIndices')
    df = noaa.to_dataframe()
    return df