Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data from Sofar buoy in FGBNMS #49

Open
dotis opened this issue Jun 29, 2023 · 6 comments
Open

Data from Sofar buoy in FGBNMS #49

dotis opened this issue Jun 29, 2023 · 6 comments
Assignees

Comments

@dotis
Copy link
Collaborator

dotis commented Jun 29, 2023

The new Sofar buoy at FGBNMS is collecting data at two depths. The data can be found here:

https://spotters.sofarocean.com/historical/SPOT-30987C?spotter-filter=SPOT-30987C

I can click on the download link and get a .csv file with the data, but I can't see the URL. I'm not sure if it's hidden, but to add the data to the FGB dash, I assume we will need a link. Once we have the link, I would like to push the .csv to GH and display the temperature data on the grafana dash.

@dotis dotis assigned 7yl4r and dotis Jun 29, 2023
@7yl4r
Copy link
Member

7yl4r commented Jun 30, 2023

curl command that grabs the data:

curl 'https://api.sofarocean.com/fetch/download-sensor-data/?spotterId=SPOT-30987C&startDate=2023-06-29T04:00:00Z&endDate=2023-07-01T04:00:00Z&processingSources=all' \
  -X GET \
  -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Accept-Language: en-US,en;q=0.5' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'view_token: 1bc9848d3e524c34a1eb220e121d9a9e' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-site' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'referrer: https://spotters.sofarocean.com/' \
  -H 'credentials: omit' \
  -H 'mode: cors'

This can be implemented as an airflow job similar to the ts_ingest DAG.
The DAG can be set to run daily and only grab the last day's data.
There are two (easy) ways to do this:

  1. allow the DAG to backfill back to the start of the bouy (2023-06-20)
    • if this is done, a dashboard reset will hit the server with a lot of requests all at once, possibly leading to us being blacklisted.
  2. set the DAG to only_latest, so that only the latest week of data is grabbed by airflow
    • this means that a manual step will need to be added to grab+upload older historical data every time the database is reset.

The more computationally-efficient but harder to implement way would be to execute the query based on the dates in the InfluxDB.

@dotis
Copy link
Collaborator Author

dotis commented Jul 10, 2023

From Duncan at Sofar:

The API allows you to request historical data or latest data from the system. Be sure to click the ">" arrows to expand the documentation.

https://docs.sofarocean.com/spotter-and-smart-mooring

https://docs.sofarocean.com/spotter-and-smart-mooring/smart-mooring-sensor-data

Also there is the option of using the POST forwarding feature in order to forward all data generated by the system to an endpoint/server of your choice.

https://docs.sofarocean.com/spotter-and-smart-mooring/post-forwarding

@7yl4r
Copy link
Member

7yl4r commented Oct 20, 2023

@7yl4r
Copy link
Member

7yl4r commented Oct 29, 2023

I think the DAG is now working but is getting no data because the source has no data for {today}T00:00 through {yesterday}T00:00. I am going to let it run a day or two; if it still isn't working I will need to:

  1. guess what the data publication lag time is & use execution_date.strftime.
  2. expect the first run to fail and use DAG retries

7yl4r added a commit that referenced this issue Oct 29, 2023
@7yl4r
Copy link
Member

7yl4r commented Oct 29, 2023

f4555cb

@7yl4r 7yl4r closed this as completed Oct 29, 2023
@dotis
Copy link
Collaborator Author

dotis commented Oct 31, 2023

Is there a way to include data from both surface and depth on the same plot? I don't think we need a dropdown to select the buoy, but can put them on the same plot.

@dotis dotis reopened this Oct 31, 2023
7yl4r added a commit that referenced this issue Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants