GithubHelp home page GithubHelp logo

jsdap's Introduction

jsdap

A JavaScript OPeNDAP client.

Installation

For use with Node.js, simply install using npm:

:::bash
$ npm install jsdap

Precompiled files for drop in usage in the browser are provided on the downloads page.

Usage

The API exposes several simple loading functions, as well as the internal new request and handler functions for increased flexibility.

:::js
jsdap.loadDataAndDDS(url, onLoad, onError, onAbort, onProgress, onTimeout);

This reads the data from a .dods URL (http://example.com/dataset.dods?var2,var1&var3>0), returning an object with the dataset descriptor structure (DDS) for the given query as dds property, and a data property containing the requested data as an object or list depending on if the data is structured or flat.

:::js
jsdap.loadData = function(url, onLoad, onError, onAbort, onProgress, onTimeout);

This will return only the data from loadDataAndDDS (see above) and discard the DDS.

:::js
jsdap.loadDDS = function(url, onLoad, onError, onAbort, onProgress, onTimeout) {

This will load just the dataset descriptor structure (DDS) from a .dds OPeNDAP URL (http://example.com/dataset.das?var2,var1&var3>0).

:::js
jsdap.loadDataset(url, onLoad, onError, onAbort, onProgress, onTimeout);

This will load the metadata from an OPeNDAP url, and return it to your callback function as a JavaScript object identical to pydap's JSON response (http://pydap.org/2.x/responses/json.html) using loadDDS (see above) and loadDAS (see below).

:::js
jsdap.loadDAS = function(url, dds, onLoad, onError, onAbort, onProgress, onTimeout);

This will load just the dataset attributes structure (DAS) from a .das OPeNDAP url (http://example.com/dataset.das?var2,var1&var3>0) and is part of the loadDataset function.

Examples

More detailed examples can be found in the examples folder, examples/README.md covers how to run them.

Limitations

Dods data is parsed using an ArrayBuffer, so IE 9 and below are not supported.

Development

The source can be checked out from the git repository.

It is recommended to develop in a virtualenv with nodeenv installed:

:::bash
$ virtualenv jsdap
$ cd jsdap
$ source bin/activate
$ pip install nodeenv

Install the latest node and set nodeenv to activate with the parent virtualenv:

:::bash
$ nodeenv -p

Checkout the source and install the requirements in the nodeenv:

:::bash
$ git clone [email protected]:jetfuse/jsdap.git
$ cd jsdap
$ npm install

You may wish to link eslint into your path for JavaScript linting, assuming development inside a nodeenv:

:::bash
$ ln -s --relative node_modules/eslint/bin/eslint.js ../bin/eslint

Jsdap is composed of 3 separate files: parser.js, xdr.js, and api.js. They are located within the src directory.

Unit tests are written with Jasmine and run by the Karma test runner. Tests are run against Firefox, Chrome, and Node.js. They can be run using npm:

:::bash
$ npm run test

License

Jsdap is (c) 2007--2009 Roberto De Almeida, licensed under the MIT license.

References

jsdap's People

Contributors

biovisualize avatar brussee avatar jeremybarbet avatar joeblynch avatar nielsenb-jf avatar svniemeijer avatar

Watchers

 avatar

Forkers

joakimono

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.