Skip to content

Instantly share code, notes, and snippets.

@n-a-t-e
Last active February 18, 2022 16:32
Show Gist options
  • Save n-a-t-e/f4f17b6290a64d01fc3059cbc1739f6f to your computer and use it in GitHub Desktop.
Save n-a-t-e/f4f17b6290a64d01fc3059cbc1739f6f to your computer and use it in GitHub Desktop.
Baynes sound data from ONC ERDDAP

Update Bayne Sound Database

This python tool is use to query the ONC ERDDAP server matching the terms below for a given time range:

  • Baynes Sound Carbon Dioxide Sensor
  • Baynes Sound Conductivity Temperature Depth

And the region

  • Latitude: [49.45, 49.70]
  • Longitude: [-124.966, -124.7]

Methodology

The tool use the erddapy package and the ERDDAP Advance Search_for method to retrieve the data sets which are matching the expressions:

  • Baynes Sound Carbon Dioxide Sensor
  • Baynes Sound Conductivity Temperature Depth

and consider only the variables matching the following list:

'time', 'depth', 'latitude', 'longitude','partial_pressure', 'salinity', 'temperature'

If no data is available within the CIOOS database, the last 60 days of data available is retrieved. Otherwise, any data collected since the latest record available within the CIOOS datasbase is retrieved.

Each data sets available on ONC's ERDDAP servers matching the requirement above are then retrieved and amalgamated together based on the variable name and units.

Once all the data retrieved, the following steps are applied:

  1. Group each datasets within three depth layers, and assign a fix depth:
    1. Near surface (0m < depth < 10m) = 5m
    2. Mid layer (10m < depth < 30m) = 20m
    3. Deep layer (depth < 30m) = 40m
  2. Group data by depth, and bin average to a 5 minutes interval.
  3. Convert Temperature from Kelvin to Celsius
  4. Derive sea pressure from depth and latitude with the TEOS-10 GSW package.
  5. Derive Alkalinity (59.88 * df_total['salinity'] + 278.9)
  6. Derive the pH Total and Calcite Saturation with pyCO2SYS package.

Once all the steps applied the resulting data is uploaded to the CIOOS database.

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