Open Sustainable Technology

A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Browse accepted projects | Review proposed projects | Propose new project | Open Issues

Ocean-Data-Map-Project

A Data Visualization tool that enables users to discover and view 3D ocean model output quickly and easily.
https://github.com/dfo-ocean-navigator/ocean-data-map-project

data-visualization gis javascript netcdf ocean-model ocean-navigator oceanography python science

Last synced: about 10 hours ago
JSON representation

Repository metadata

The Ocean Navigator is an online tool that is used to help visualise scientific research data. a users guide is available at https://dfo-ocean-navigator.github.io/Ocean-Navigator-Manual/ and the tool is live at

README

        

# Ocean Navigator

[![CodeFactor](https://www.codefactor.io/repository/github/dfo-ocean-navigator/ocean-data-map-project/badge)](https://www.codefactor.io/repository/github/dfo-ocean-navigator/ocean-data-map-project)
[![Lint Python](https://github.com/DFO-Ocean-Navigator/Ocean-Data-Map-Project/actions/workflows/lint_python.yml/badge.svg)](https://github.com/DFO-Ocean-Navigator/Ocean-Data-Map-Project/actions/workflows/lint_python.yml)
[![Python tests](https://github.com/DFO-Ocean-Navigator/Ocean-Data-Map-Project/actions/workflows/python-tests.yml/badge.svg)](https://github.com/DFO-Ocean-Navigator/Ocean-Data-Map-Project/actions/workflows/python-tests.yml)

## Contents
* Overview
* Development
* Automate CLASS4 pickle generation

---

## Overview

Ocean Navigator is a Data Visualization tool that enables users to discover and view 3D ocean model output quickly and easily.

The model outputs are stored as [NetCDF4](https://en.wikipedia.org/wiki/NetCDF) files. Our file management is now handled by an SQLite3 process that incrementally scans the files for a dataset, and updates a corresponding table so that the Python layer can only open the exact files required to perform computations; as opposed to the THREDDS aggregation approach which serves all the files in a dataset as a single netcdf file. The THREDDS approach was unable to scale to the sheer size of the datasets we deal with.

The server-side component of the Ocean Navigator is written in Python 3, using the Flask web API. Conceptually, it is broken down into three components:

- Query Server

This portion returns metadata about the selected dataset in JSON format. These queries include things like the list of variables in the dataset, the times covered, the list of depths for that dataset, etc.

The other queries include things such as predefined areas (NAFO divisions, EBSAs, etc), and ocean drifter paths. The drifter paths are loaded from NetCDF files, but all the other queries are loaded from KML files.

- Plotting

This portion generates an image plot, which could be a map with surface fields (or fields at a particular depth), a transect through a defined part of the ocean, depth profiles of one or more points, etc. We use the matplotlib python module to generate the plots.

Because the model grid rarely lines up with the map projection, and profiles and transects don't necessarily fall on model grid points, we employ some regridding and interpolation to generate these plots. For example, for a map plot, we select all the model points that fall within the area, plus some extra around the edges and regrid to a 500x500 grid that is evenly spaced over the projection area. An added benefit of this regridding is that we can directly compare across models with different grids. This allows us to calculate anomalies on the fly by comparing the model to a climatology. In theory, this would also allow for computing derived outputs from variables in different datasets with different native grids.

- Tile Server

This portion is really a special case of the plotting component. The tile server serves 256x256 pixel tiles at different resolutions and projections that can be used by the OpenLayers web mapping API. This portion doesn't use matplotlib, as the tiles don't have axis labels, titles, legends, etc. The same style of interpolation/regridding is done to generate the data for the images.

The generated tiles are cached to disk after they are generated the first time, this allows the user request to bypass accessing the NetCDF files entirely on subsequent requests.

The user interface is written in Javascript using the React framework. This allows for a single-page, responsive application that offloads as much processing from the server onto the user's browser as possible. For example, if the user chooses to load points from a CSV file, the file is parsed in the browser and only necessary parts of the result are sent back to the server for plotting.

The main display uses the OpenLayers mapping API to allow the user to pan around the globe to find the area of interest. It also allows the user to pick an individual point to get more information about, draw a transect on the map, or draw a polygon to extract a map or statistics for an area.

---

## Development

### Local Installation
The instructions for performing a local installation of the Ocean Data Map Project are available at:
[https://github.com/DFO-Ocean-Navigator/Navigator-Installer/blob/master/README.md](https://github.com/DFO-Ocean-Navigator/Navigator-Installer/blob/master/README.md)

* While altering Javascript code, it can be actively transpiled using:
* `cd oceannavigator/frontend`
* `yarn run dev`
* There's also a linter available: `yarn run lint`.
* For production use the command:
* `rm -r oceannavigator/frontend`
* `cd oceannavigator/frontend`
* `yarn run build`

### SQLite3 backend
Since we're now using a home-grown indexing solution, as such there is now no "server" to host the files through a URL (at the moment). You also need to install the dependencies for the [netcdf indexing tool](https://github.com/DFO-Ocean-Navigator/netcdf-timestamp-mapper). Then, download a released binary for Linux systems [here](https://github.com/DFO-Ocean-Navigator/netcdf-timestamp-mapper/releases). You should go through the README for basic setup and usage details.

The workflow to import new datasets into the Navigator has also changed:
1. Run the indexing tool linked above.
2. Modify `datasetconfig.json` so that the `url` attribute points to the absolute path of the generated `.sqlite3` database.
3. Restart web server.

### Running the webserver for development
Assuming the above installation script succeeded, your PATH should be set to point towards `${HOME}/miniconda/3/amd64/bin`, and the `navigator` conda environment has been activated.
* Debug server (single-threaded):
* `python ./bin/runserver.py`
* Multi-threaded (via gUnicorn):
* `./bin/runserver.sh`

### Running the webserver for production
Using the launch-web-service.sh script will automatically determine how many processors are available, determine the platform's IP address, what port above 5000 can be used, print out the IP and port information. The IP:PORT information can then be copied to a web browser to access the Ocean Navigator web service either locally or shared with others. This script will also copy all information bring written to stdout and place the information in the ${HOME}/launch-on-web-service.log file.
* Multi-threaded (via gUnicorn):
* `./bin/launch-web-service.sh`

### Coding Style (Javascript)
Javascript is a dynamically-typed language so it's super important to have clear and concise code, that demonstrates it's exact purpose.

* Comment any code whose intention may not be self-evident (safer to have more comments than none at all).
* Use `var`, `let`, and `const` when identifying variables appropriately:
* `var`: scoped to the nearest function block. Modern ES6/Javascript doesn't really use this anymore because it usually leads to scoping conflicts. However, `var` allows re-declaration of a variable.
* `let`: new keyword introduced to ES6 standard which is scoped to the *nearest block*. It's very useful when using `for()` loops (and similar), so don't predefine loop variable:

* Bad:
```
myfunc() {
var i;
...
// Some code
...
for (i = 0; i < something; ++i) {

}
}
```
* Good:
```
myFunc() {
...
// Some code
...
for (let i = 0; i < something; ++i) {

}
}
```

Keep in mind that `let` *does not* allow re-declaration of a variable.

* `const`: functionally identical to the `let` keyword, however disallows variable re-assignment. Just like const-correctness in C++, `const` is a great candidate for most variable declarations, as it immediately states that "I am not being changed". This leads to the next rule.
* Use `const` when declaring l-values with `require()`. Example:
```
const LOADING_IMAGE = require("../images/bar_loader.gif");
```
* Unless using `for` loops, *DO NOT* use single-letter variables! It's an extreme nuisance for other programmers to understand the intention of the code if functions are littered with variables like: `s`, `t`, etc. Slightly more verbose code that is extremely clear will result in a much lower risk for bugs.
* Bad:
```
$.when(var_promise, time_promise).done(function(v, t) {
// Some code
...
}
```
* Good:
```
$.when(var_promise, time_promise).done(function(variable, time) {
// Some code
...
}

```
* Try to avoid massive `if` chains. Obviously the most important thing is to get a feature/bugfix working. However if it results in a whole bunch of nested `if` statements, or `if`-`for`-`if`-`else`, etc., try to take that working result and incorporate perhaps a `switch`, or hashtable to make your solution cleaner, and more performant. If it's unavoidable, a well-placed comment would reduce the likelihood of a fellow developer trying to optimize it.

### Coding Style (Python)
Coming soon...

## Automate CLASS4 pickle generation

In order to generate the class4.pickle file daily. You should create a crontab entry for the user account hosting the Ocean Navigator instance. Use the command `crontab -e` to add the string `@daily ${HOME}/Ocean-Data-Map-Project/bin/launch-pickle.sh`. Then once a day at midnight the script launch-pickle.sh will index all the CLASS4 files.

## Proper handling of the datasetconfig.json and oceannavigator.cfg configuration files

In order to provide a production ready and off-site configuration files. We have implemented a new configurations repository. When people clone the Ocean-Data-Map-Project repository they will need to perform an additional step of updating any defined submodules. The following command changes your working directory to your local Ocean-Data-Map-Project directory and then updates the submodules recursively.

* cd ${HOME}/Ocean-Data-Map-Project ; git submodule update --init --recursive


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 2 days ago

Total Commits: 1,190
Total Committers: 22
Avg Commits per committer: 54.091
Development Distribution Score (DDS): 0.639

Commits in past year: 48
Committers in past year: 4
Avg Commits per committer in past year: 12.0
Development Distribution Score (DDS) in past year: 0.542

Name Email Commits
Nabil M n****7@g****m 429
Geoff Holden g****f@g****m 297
JustinElms 7****s 86
Noah Gallant n****t@m****a 77
Dwayne Hart 4****t 53
Jeffrey Dawson j****9@g****m 50
James Rayner j****r@g****m 35
Doug Latornell d****l@4****a 27
dependabot[bot] 4****] 25
James Rayner 3****r 21
Nancy Soontiens n****s@d****a 20
Prodyut Kumer Roy 8****8 19
bbbrandyn 1****n 13
Clyde Clements c****s@g****m 11
Sourav Barua s****6@g****m 7
Neha-Thakare1995 1****5 6
James Munroe j****e@m****a 4
Lavan Thaya 4****3 3
Dwayne Hart d****t@d****a 3
halehkh65 h****i@g****m 2
Ocean-Navigator o****p@g****m 1
Clyde Clements C****s@d****a 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 545
Total pull requests: 612
Average time to close issues: 11 months
Average time to close pull requests: 20 days
Total issue authors: 21
Total pull request authors: 19
Average comments per issue: 1.72
Average comments per pull request: 0.98
Merged pull request: 538
Bot issues: 6
Bot pull requests: 38

Past year issues: 19
Past year pull requests: 49
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 14 days
Past year issue authors: 3
Past year pull request authors: 4
Past year average comments per issue: 0.16
Past year average comments per pull request: 0.51
Past year merged pull request: 43
Past year bot issues: 0
Past year bot pull requests: 9

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/dfo-ocean-navigator/ocean-data-map-project

Top Issue Authors

  • Jeffreydaw (147)
  • htmlboss (143)
  • NoahGallant-MUN (62)
  • nsoontie (43)
  • JustinElms (39)
  • dwayne-hart (32)
  • VanessaSutton-Pande (21)
  • jmunroe (16)
  • jamesprayner (8)
  • douglatornell (8)
  • sentry-io[bot] (6)
  • Aroweeri (4)
  • forbea8 (3)
  • clydeclements (3)
  • halehkh65 (2)

Top Pull Request Authors

  • htmlboss (196)
  • JustinElms (89)
  • NoahGallant-MUN (83)
  • dwayne-hart (47)
  • dependabot[bot] (38)
  • jamesprayner (30)
  • douglatornell (28)
  • prodyut1978 (25)
  • Jeffreydaw (14)
  • bbbrandyn (14)
  • geoffholden (9)
  • halehkh65 (8)
  • BaruaSourav (8)
  • Neha-Thakare1995 (7)
  • jmunroe (5)

Top Issue Labels

  • Bug (179)
  • Python (129)
  • Javascript (106)
  • enhancement (103)
  • Priority: Low (86)
  • technical (59)
  • New Feature (58)
  • Discussion (55)
  • Priority: Medium (54)
  • User Requested (47)
  • Infrastructure (47)
  • Priority: High (42)
  • Erica Wishlist (27)
  • Data/Pipelines (26)
  • Wonfix (18)
  • good first issue (16)
  • Performance (15)
  • Bugfix (10)
  • question (8)
  • Code Quality (6)
  • observations (6)
  • Documentation (5)
  • Blocked (5)
  • needs-more-info (4)
  • Infrastructure - LXC (2)
  • dependencies (2)
  • On Hold (1)

Top Pull Request Labels

  • Python (221)
  • Bugfix (182)
  • Javascript (129)
  • enhancement (93)
  • technical (64)
  • dependencies (60)
  • Code Quality (51)
  • New Feature (49)
  • User Requested (36)
  • Priority: High (27)
  • Data/Pipelines (24)
  • Performance (23)
  • Infrastructure (20)
  • Priority: Medium (19)
  • Erica Wishlist (14)
  • Bug (12)
  • Documentation (6)
  • Security (5)
  • observations (3)
  • Infrastructure - LXC (3)
  • Wonfix (3)
  • Discussion (2)
  • Priority: Low (2)
  • css (2)
  • needs-more-info (1)
  • Blocked (1)

Package metadata

proxy.golang.org: github.com/DFO-Ocean-Navigator/Ocean-Data-Map-Project

proxy.golang.org: github.com/dfo-ocean-navigator/ocean-data-map-project


Dependencies

.github/workflows/codeql-analysis.yml actions
  • actions/checkout v2 composite
  • github/codeql-action/analyze v1 composite
  • github/codeql-action/autobuild v1 composite
  • github/codeql-action/init v1 composite
.github/workflows/dependency-review.yml actions
  • actions/checkout v3 composite
  • actions/dependency-review-action v1 composite
.github/workflows/lint_python.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/python-tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • conda-incubator/setup-miniconda v2 composite
oceannavigator/frontend/package.json npm
  • css-loader ^4.3.0 development
  • eslint ^7.3.1 development
  • eslint-plugin-react ^7.24.0 development
  • file-loader ^6.2.0 development
  • html-webpack-plugin ^4.5.2 development
  • i18next-conv ^3.0.3 development
  • mini-css-extract-plugin ^1.6.2 development
  • node-sass ^4.13.1 development
  • sass-loader ^6.0.6 development
  • ts-loader ^8.2.0 development
  • typescript ^4.3.5 development
  • webpack ^4.46.0 development
  • webpack-cli ^4.7.2 development
  • axios ^0.21.2
  • axios-extensions ^3.1.3
  • bootstrap ^3.3.7
  • bower ^1.8.8
  • dateformat ^2.0.0
  • deep-equal ^2.0.1
  • detect-browser ^1.7.0
  • detect-mobile-browser ^5.0.0
  • fast-deep-equal ^3.1.3
  • fast-stable-stringify 1.0.0
  • font-awesome ^4.7.0
  • glob-parent ^5.1.2
  • i18next ^20.3.5
  • i18next-browser-languagedetector ^6.1.2
  • jquery ~3.5.0
  • jquery-ui ^1.12.1
  • jquery-ui-month-picker kidsysco/jquery-ui-month-picker
  • ol ^6.6.1
  • papaparse ^5.2.0
  • proj4 ^2.7.5
  • prop-types ^15.5.10
  • rc-slider ^9.2.2
  • react ^16.8.6
  • react-autosuggest ^9.4.3
  • react-bootstrap ^0.33.1
  • react-bootstrap-toggle ^2.3.2
  • react-datepicker ^2.13.0
  • react-dom ^16.8.6
  • react-fontawesome ^1.6.1
  • react-ga ^2.5.3
  • react-i18next ^11.11.4
  • react-iframe 1.0.7
  • react-numeric-input ^2.2.3
  • tar ^4.4.18
  • webfontloader ^1.6.28
oceannavigator/frontend/package-lock.json npm
  • 633 dependencies
pyproject.toml pypi
config/conda/environment.yml pypi
  • visvalingamwyatt ==0.2.0

Score: -Infinity