Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vturpin authored Feb 22, 2024
0 parents commit 54fa832
Show file tree
Hide file tree
Showing 13 changed files with 816 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/build_book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: deploy-site

# Only run this when the main branch changes
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
release:

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'OceanGlidersCommunity/Oxygen_SOP'
defaults:
run:
shell: bash -l {0}
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3

# Install dependencies
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install dependencies
run: |
pip install -r requirements.txt
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Zip the site (so it can be handed to the preview action)
- name: Zip the site
run: |
set -x
set -e
if [ -f site.zip ]; then
rm -rf site.zip
fi
zip -r site.zip ./_build/html
- uses: actions/upload-artifact@v3
with:
name: site-zip
path: ./site.zip

# Push the site's HTML to github-pages (only if on main, previews are sent to netlify)
- name: Deploy to GitHub pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
enable_jekyll: false
build_pdf:
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: build
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Install Tex
run: |
sudo apt-get install texlive-latex-recommended texlive-latex-extra \
texlive-fonts-recommended texlive-fonts-extra \
texlive-xetex latexmk
- name: Build the book as pdf #This needs to happen after the site is zipped, since this builds different html that we dont want on the website
run: |
jupyter-book build . --builder pdflatex
- uses: actions/upload-artifact@v3
with:
name: book-pdf
path: _build/latex/python.pdf
129 changes: 129 additions & 0 deletions .github/workflows/preview-book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: preview-site
on:
workflow_run:
workflows:
- deploy-site
types:
- requested
- completed
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- name: Set message value
run: |
echo "comment_message=This pull request is being automatically built with [GitHub Actions](https://github.com/features/actions) and [Netlify](https://www.netlify.com/). To see the status of your deployment, click below." >> $GITHUB_ENV
- name: Find Pull Request
uses: actions/github-script@v4
id: find-pull-request
with:
script: |
let pullRequestNumber = ''
let pullRequestHeadSHA = ''
core.info('Finding pull request...')
const pullRequests = await github.pulls.list({owner: context.repo.owner, repo: context.repo.repo})
for (let pullRequest of pullRequests.data) {
if(pullRequest.head.sha === context.payload.workflow_run.head_commit.id) {
pullRequestHeadSHA = pullRequest.head.sha
pullRequestNumber = pullRequest.number
break
}
}
core.setOutput('number', pullRequestNumber)
core.setOutput('sha', pullRequestHeadSHA)
if(pullRequestNumber === '') {
core.info(
`No pull request associated with git commit SHA: ${context.payload.workflow_run.head_commit.id}`
)
}
else{
core.info(`Found pull request ${pullRequestNumber}, with head sha: ${pullRequestHeadSHA}`)
}
- name: Find Comment
uses: peter-evans/find-comment@v1
if: steps.find-pull-request.outputs.number != ''
id: fc
with:
issue-number: '${{ steps.find-pull-request.outputs.number }}'
comment-author: 'github-actions[bot]'
body-includes: '${{ env.comment_message }}'
- name: Create comment
if: |
github.event.workflow_run.conclusion != 'success'
&& steps.find-pull-request.outputs.number != ''
&& steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ steps.find-pull-request.outputs.number }}
body: |
${{ env.comment_message }}
🚧 Deployment in progress for git commit SHA: ${{ steps.find-pull-request.outputs.sha }}
- name: Update comment
if: |
github.event.workflow_run.conclusion != 'success'
&& steps.find-pull-request.outputs.number != ''
&& steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
${{ env.comment_message }}
🚧 Deployment in progress for git commit SHA: ${{ steps.find-pull-request.outputs.sha }}
- name: Download Artifact site
if: |
github.event.workflow_run.conclusion == 'success'
&& steps.find-pull-request.outputs.number != ''
&& steps.fc.outputs.comment-id != ''
uses: dawidd6/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: deploy.yaml
run_id: ${{ github.event.workflow_run.id }}
name: site-zip
- name: Unzip site
if: |
github.event.workflow_run.conclusion == 'success'
&& steps.find-pull-request.outputs.number != ''
&& steps.fc.outputs.comment-id != ''
run: |
rm -rf _build/html
unzip site.zip
rm -f site.zip
# Push the site's HTML to Netlify and get the preview URL
- name: Deploy to Netlify
if: |
github.event.workflow_run.conclusion == 'success'
&& steps.find-pull-request.outputs.number != ''
&& steps.fc.outputs.comment-id != ''
id: netlify
uses: nwtgck/[email protected]
with:
publish-dir: _build/html
production-deploy: false
github-token: ${{ secrets.GITHUB_TOKEN }}
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5
- name: Update site Preview comment
if: |
github.event.workflow_run.conclusion == 'success'
&& steps.find-pull-request.outputs.number != ''
&& steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
${{ env.comment_message }}
🔍 Git commit SHA: ${{ steps.find-pull-request.outputs.sha }}
✅ Deployment Preview URL: ${{ steps.netlify.outputs.deploy-url }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_build
__pycache__
71 changes: 71 additions & 0 deletions BOON Guidelines for “Network” and “Site” Metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# BOON Guidelines for “Network” and “Site” Metadata

* This document describes the metadata fields that will be used by OceanOPS to populate the “Network” field in their system.
* The goal is to have BOON assets identified and easy to find within OceanOPS. Granularity is needed both in **network** attribution and **site** attribution.
* These metadata fileds will allow a better tracking of the BOON Task Team activity, and assessement of the status of the task team toward its target.
* Values for the metadata fields can be flexible but will be managed in a vocabulary on GitHub to make it easier for data providers to best populate the fields and allow for cohesion.

---

## Network Metadata Field Background
A format for BOON Network metadata values was chosen in 2022 (based on a meeting 12/09/2022 and follow-up correspondence). Network values were selected for the California Underwater Glider Network (CUGN) and Gulf Stream programs and this documentation was drafted.
These values have been tested and integrated into the near-real-time data streams for these gliders through to the OceanGliders data system.
With this format the data provider chooses an NCEI Sea Name to provide an indicator of the region for their glider operations. Multiple network attributions are allowed. To implement this use a comma to separate each network entry.

**Example BOON network identifiers**
* OceanGliders > BOON > Northeast Pacific Ocean > California Underwater Glider Network
* OceanGliders > BOON > Northwest Atlantic Ocean > Gliders in the Gulf Stream



---


## How this looks in metadata
The use of the metadata scheme below can be used with any NetCDF format currently used to store glider data. This includes the EGO, IOOS glider DAC and IMOS glider formats.

The [OG-1.0 format](https://github.com/OceanGlidersCommunity/OG-format-user-manual) has also been designed to handle this information.

The two concepts described below, **network** and **site** should be included in the NetCDF global attributes with a string data type.


## Definition
### Network
A **network** is a regroupment of platforms, crossing the boundaries of the program. It is usually virtual and represents a common effort or way to measure data. It can represent a mutualized scientific/geographical goal (array), or logistical/fundings/etc. approach.
BOON networks refers to a regional array (multiple sites, e.g *California Underwater Glider Network*) or an area of repeated glider operation (e.g. *glider in the gulf stream*)

Find the appropriate network name from the [BOON network list](https://github.com/OceanGlidersCommunity/BOON/blob/main/VocabularyCollection/BOON%20networks.md#boon-networks-collection) and [BOON site list](https://github.com/OceanGlidersCommunity/BOON/blob/main/VocabularyCollection/BOON%20networks.md#boon-site-collection) and use it as the value in the **network** global attribute. If you would like to list more than one network you can use a comma to separate each network entry. This format requires that the network names themselves do not include commas. If your network is not in the list, request that it be added. See instructions in the 'request a new entry' section below.

The global attribute **network** follows this format:
OceanGliders > BOON > [NCEI Sea Name](https://www.ncei.noaa.gov/data/oceans/ncei/vocabulary/seanames.xml) > *Your BOON Network Name*. (e.g *OceanGliders > BOON > Northwest Atlantic Ocean > Gliders in the Gulf Stream*)
Where ">" is mandatory.

**Example BOON network metadata:**
| NetCDF global attribute | Data Type | Value |
|:-------|:-------|:-------|
| network | string | OceanGliders > BOON > Northwest Atlantic Ocean > Gliders in the Gulf Stream |

**Example with multiple networks:**
| NetCDF global attribute | Data Type | Value |
|:-------|:-------|:-------|
| network | string | OceanGliders > BOON > Northeast Pacific Ocean > California Underwater Glider Network, IOOS > SCCOOS, IOOS > CeNCOOS |


## Site
A **site** refers to the specific lines regularly monitored by gliders (e.g. *Balearic - Canales C1, CUGN Line 66*)

**Example site metadata:**
NetCDF global attribute | Data Type | Value |
|:-------|:-------|:-------|
| network | string | CUGN Line 66|

**Example with multiple networks:**
| NetCDF global attribute | Data Type | Value |
|:-------|:-------|:-------|
| network | string | CUGN Line 66, CUGN Alongshore|

# Request a new entry
To request a new entry in the BOON Networks vocabulary and BOON Site vocabulary submit an issue in the [BOON repository](https://github.com/OceanGlidersCommunity/BOON) with the entry you would like to add to the vocabulary collection.

In the case of **network**, you must provide the full value i.e. "OceanGliders > BOON > [NCEI Sea Name](https://www.ncei.noaa.gov/data/oceans/ncei/vocabulary/seanames.xml) > *Your BOON Network Name*."

Loading

0 comments on commit 54fa832

Please sign in to comment.