Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Since it is difficult to publish multi-dimensional data through MQTT, some compromises have been made. For example, the measurement of salinity is stored and accessed with regards to both time and depth. I.e to get a value for salinity, depth and time must be provided. Time can be provided through timestamp, but depth has to be set to a static variable. In this case the depth is set to be always 5 meters.

The script called XarrayBuouData.py fetches every .nc file on MET buoy data section of E39 and parses through all variables and stores their keys in an array. A separate function handles connection and publishing through MQTT. Below is a code-snippet
which shows how to select and publish a variable.

json_data = json.dumps(kwargs, indent=2)
if 'adcp' in locationname:
                publishMqtt(json_data,'acdcp')
            elif 'aquadopp' in locationname:
                publishMqtt(json_data,'aquadopp')
            elif 'ctd' in locationname:
                publishMqtt(json_data, 'ctd')
            elif 'raw_wind' in locationname:
                publishMqtt(json_data, 'raw')
            elif 'wave' in locationname:
                publishMqtt(json_data, 'wave')
            elif 'wind' in locationname:
                publishMqtt(json_data, 'wind')

The 'adcp', 'aquadopp' and other tags makes sure the data gets sent to the correct data converter on Thingsboard.