Skip to content

How to query status and valid data ranges of a particular spotter? #33

Open

Description

@sspagnol

Hi, can some more detailed examples be added to show how to accomplish

from pysofar.sofar import SofarApi
api = SofarApi()
spotter_grid = api.get_spotters()
for spt in spotter_grid:
    print(f"ID: {spt.id}, NAME: {spt.name}, MODE: {spt.mode}, LAT: {spt.lat}, LON: {spt.lon}, TIMESTAMP: {spt.timestamp}")
    # how to get the status of spt? If mode == 'sensorData' does that mean it is inactive?
    # how to get the valid data time ranges for spt?
    # how to get capabilities of spt (eg,has surfaceTemp, barometerData, frequencyData, microphoneData, smartMooringData)

Activity

  1. self-assigned this
    on Dec 14, 2022
  2. tcj commented on Dec 15, 2022

    @tcj
    Collaborator

    Hi @sspagnol — thank you for your insightful questions and sample code.

    how to get the status of spt?

    Currently, your sample code is making full use of what is available via the Spotter object in this API client code.

    If you would like to elaborate on which kind(s) of status data you would like returned, I'll see what's possible.

    If mode == 'sensorData' does that mean it is inactive?

    mode here is equivalent to the payloadType as seen in the API docs. (Note that one must click through the > links twice to see the example response in the API docs.)

    This indicates which sampling mode the Spotter was in when it produced the data sample seen in this latest data packet. sensorData would mean that the latest data received from this Spotter was a Smart Mooring sensor data packet. Other possible values include waves_spectrum, waves_standard, and tracking. These would indicate that the last data packet we received from the Spotter was made while the Spotter was performing sampling in that mode.

    how to get the valid data time ranges for spt?

    Currently, I am not aware of a technique that will directly communicate the valid time ranges. One can infer starting & ending dates, if one knows the deployment time(s) for the Spotter. Alternatively, a quick algorithm could also be devised that would request data for short time periods until some is received.

    I have an idea for how this could be made possible, and will be sure to let you know if/when that idea is implemented.

    how to get capabilities of spt (eg,has surfaceTemp, barometerData, frequencyData, microphoneData, smartMooringData)

    These are also currently dependent on the user knowing the sensors their Spotter is equipped with, and which mode the Spotter is in. For instance, a Spotter in Waves:Standard mode may not be producing frequencyData. Also, a legacy Spotter without barometer will not produce barometerData.

    One can infer these capabilities by making small requests for this data using the API during time periods of known deployment, to see if any is returned.

    I also have an idea for how this could be made easier, and will submit a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions