All Projects → cheminfo → Netcdfjs

cheminfo / Netcdfjs

Licence: mit
Read and explore NetCDF files

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Netcdfjs

aospy
Python package for automated analysis and management of gridded climate data
Stars: ✭ 80 (-6.98%)
Mutual labels:  netcdf
mo netcdf
Modern fortran netcdf wrapper
Stars: ✭ 15 (-82.56%)
Mutual labels:  netcdf
Pnetcdf
Source code repository of PnetCDF library and utilities
Stars: ✭ 49 (-43.02%)
Mutual labels:  netcdf
netcdf4
NodeJS addon to read and write NetCDF4 files
Stars: ✭ 35 (-59.3%)
Mutual labels:  netcdf
netcdf-java
The Unidata netcdf-java library
Stars: ✭ 84 (-2.33%)
Mutual labels:  netcdf
Netcdf C
Official GitHub repository for netCDF-C libraries and utilities.
Stars: ✭ 336 (+290.7%)
Mutual labels:  netcdf
flowtorch
flowTorch - a Python library for analysis and reduced-order modeling of fluid flows
Stars: ✭ 47 (-45.35%)
Mutual labels:  netcdf
Pysat
Generalized satellite and space science data processing and file management.
Stars: ✭ 72 (-16.28%)
Mutual labels:  netcdf
mooda
Module for Ocean Observatory Data Analysis - Python package
Stars: ✭ 17 (-80.23%)
Mutual labels:  netcdf
Netcdf2littler
An application to convert NetCDF files to the Little-R format. The Little-R format is the accepted input format for the WRF data assimilation system (WRFDA) preprocessor (obsproc). Currently only the conversion of synoptical weather stations are supported by this application.
Stars: ✭ 5 (-94.19%)
Mutual labels:  netcdf
cftime
Time-handling functionality from netcdf4-python.
Stars: ✭ 53 (-38.37%)
Mutual labels:  netcdf
spacegrids
Analyze spatial Netcdf data: "Numpy on grids" (Python module)
Stars: ✭ 14 (-83.72%)
Mutual labels:  netcdf
Iris
A powerful, format-agnostic, and community-driven Python package for analysing and visualising Earth science data
Stars: ✭ 418 (+386.05%)
Mutual labels:  netcdf
woss-ns3
WOSS is a multi-threaded C++ framework that permits the integration of any existing underwater channel simulator that expects environmental data as input and provides as output a channel realization. Currently, WOSS integrates the Bellhop ray-tracing program. Thanks to its automation the user only has to specify the location in the world and the…
Stars: ✭ 20 (-76.74%)
Mutual labels:  netcdf
Cdo Bindings
Ruby/Python bindings for CDO
Stars: ✭ 56 (-34.88%)
Mutual labels:  netcdf
ncdump-json
Modified ncdump to output data in json format
Stars: ✭ 72 (-16.28%)
Mutual labels:  netcdf
Datacube Core
Open Data Cube analyses continental scale Earth Observation data through time
Stars: ✭ 285 (+231.4%)
Mutual labels:  netcdf
H5netcdf
Pythonic interface to netCDF4 via h5py
Stars: ✭ 85 (-1.16%)
Mutual labels:  netcdf
Ocgis
OpenClimateGIS is a set of geoprocessing and calculation tools for CF-compliant climate datasets.
Stars: ✭ 60 (-30.23%)
Mutual labels:  netcdf
Netcdf4 Python
netcdf4-python: python/numpy interface to the netCDF C library
Stars: ✭ 510 (+493.02%)
Mutual labels:  netcdf

netcdfjs

NPM version build status Test coverage npm download

Read and explore NetCDF v3 files.

Installation

$ npm install netcdfjs

API Documentation

For further information about the grammar you should go to this link.

Example I: NodeJS

const fs = require('fs');
const NetCDFReader = require('netcdfjs');

// http://www.unidata.ucar.edu/software/netcdf/examples/files.html
const data = fs.readFileSync('madis-sao.nc');

var reader = new NetCDFReader(data); // read the header
reader.getDataVariable('wmoId'); // go to offset and read it

Example II: Load from URL (does not require node)

// First load the netcdfjs library as normal : <script src='./dist/netcdfjs.js'></script>
// You could use the oficial CDN: <script src='http://www.lactame.com/lib/netcdfjs/0.3.0/netcdfjs.min.js'></script>

var urlpath =
  'http://www.unidata.ucar.edu/software/netcdf/examples/madis-sao.nc';
var reader;

var oReq = new XMLHttpRequest();
oReq.open('GET', urlpath, true);
oReq.responseType = 'blob';

oReq.onload = function(oEvent) {
  var blob = oReq.response;
  reader_url = new FileReader();

  reader_url.onload = function(e) {
    reader = new netcdfjs(this.result);
  };

  reader_url.readAsArrayBuffer(blob);
};
oReq.send(); //start process

reader.getDataVariable('wmoId'); // go to offset and read it

Example III: Client side file upload

This example creates a file input element and allows the user to select a file from their personal machine.

var reader;
var progress = document.querySelector('.percent');
function abortRead() {
  reader.abort();
}

function handleFileSelect(evt) {
  // Reset progress indicator on new file selection.
  progress.style.width = '0%';
  progress.textContent = '0%';

  reader = new FileReader();
  reader.onerror = errorHandler;
  reader.onprogress = updateProgress;
  reader.onabort = function(e) {
    alert('File read cancelled');
  };
  reader.onloadstart = function(e) {
    document.getElementById('progress_bar').className = 'loading';
  };
  reader.onload = function(e) {
    // Ensure that the progress bar displays 100% at the end.
    progress.style.width = '100%';
    progress.textContent = '100%';
    setTimeout("document.getElementById('progress_bar').className='';", 2000);
    //var reader = new NetCDFReader(reader.result);

    //replace reader with NetCDF reader
    reader = new netcdfjs(this.result);
    reader.getDataVariable('wmoId'); // go to offset and read it

    //... your program here  ..//
  };
  reader.readAsArrayBuffer(evt.target.files[0]);
}

// Make input element <input type="file" id="files" name="file" />
var input = document.createElement('input');
input.id = 'files';
input.type = 'file';
input.className = 'file';
document.body.appendChild(input); // put it into the DOM

// Make a Progress bar <div id="progress_bar"><div class="percent">0%</div></div>
var progress = document.createElement('div');
progress.id = 'progress_bar';
inner = document.createElement('div');
inner.className = 'percent';
inner.id = 'innerdiv'; // set the CSS class
progress.appendChild(inner);
document.body.appendChild(progress); // put it into the DOM

//Start event listener to check if a file has been selected
run = document
  .getElementById('files')
  .addEventListener('change', handleFileSelect, false);

///Progress bar and other functions
function errorHandler(evt) {
  switch (evt.target.error.code) {
    case evt.target.error.NOT_FOUND_ERR:
      alert('File Not Found!');
      break;
    case evt.target.error.NOT_READABLE_ERR:
      alert('File is not readable');
      break;
    case evt.target.error.ABORT_ERR:
      break;
    default:
      alert('An error occurred reading this file.');
  }
}

function updateProgress(evt) {
  // evt is an ProgressEvent. Updates progress bar
  if (evt.lengthComputable) {
    var percentLoaded = Math.round((evt.loaded / evt.total) * 100);
    // Increase the progress bar length.
    if (percentLoaded < 100) {
      progress.style.width = percentLoaded + '%';
      progress.textContent = percentLoaded + '%';
    }
  }
}

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].