GithubHelp home page GithubHelp logo

nrel / dw-tap-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 8.0 0.0 2.94 MB

License: BSD 3-Clause "New" or "Revised" License

Python 27.47% Dockerfile 0.32% CSS 4.41% HTML 52.33% JavaScript 15.29% Makefile 0.17%

dw-tap-api's Introduction

API Endpoint for DW-TAP Project

About

This is an endpoint repository -- it contains the code that runs a Flask app serving the processed WTK data. The processing includes height selection, time interval selection, spatial interpolation, vertical interpolation, and wind rose calculations.

How To Use

Deploy as a Container (requires Docker on the host)

Build:

docker build -t tap-api:latest .

Run:

docker run -p 8080:80 -it tap-api:latest /bin/bash

Inside the container, flask app will run on port 80. On the host, you can use any available port, e.g, 8080, like shown above.

For a simple test (showing info about the endpoint), navigate to the following URL in your browser (running on the host):

http://localhost:8080

For a more comprehensive test (with HSDS connection and spatial + vertical interpolations), navigate to this URL:

http://localhost:8080/v1/timeseries/windspeed?height=67.00m&lat=40.7888&lon=-74.0059&start_date=20110302&stop_date=20110303&vertical_interpolation=nearest&spatial_interpolation=idw

This should produce a json output with timestamp and windspeed values.

For other examples of working queries, refer to the file: dw-tap-api.postman_collection.json (look for raw attributes). This file can be used by the Postman app (e.g., installed locally, on a laptop), which will cycle through all documented queries and show their status.

Build & Run Natively (without a container)

conda env create
conda activate dw-tap-api
python api.py --development

Running Modes

Notice the --development flag in the command above -- it makes the endpoint run on port 8080; for short, you can run: python api.py -d.

Development is the default mode (run if no flag is specified). In contrast, you can run the endpoint in the Production mode using: python api.py --production or python api.py -p -- this is what is used in the container deployment described above (to see the details, check the end of Dockerfile).

To see how these production and development modes are configured, refer to config.json and see what host and port values are specified.

Documentation

Interactive HTML page with API documentation is produced using apiDoc. It can be recreated using (requires installing apiDoc locally):

apidoc -i . -o docs/ -t apidoc-template

The output can be seen by opening docs/index.html in a browser. The flask app is configured to serve this documentation page (and related files) at "/" (i.e., "home") route.

More about the Project

To read a concise summary of the DW-TAP project, please refer to: https://www.energy.gov/sites/prod/files/2020/02/f72/tap-fact-sheet_0.pdf

Credit

Code in this repository was developed by Dmitry Duplyakin ([email protected]), Caleb Phillips ([email protected]), and Sagi Zisman ([email protected]) to demonstrate the techniques used in distributed wind resource assessment at the National Renewable Energy Laboratory in Golden, Colorado, USA.

License

Refer to the file called: LICENSE.

dw-tap-api's People

Contributors

dmdu avatar sz512 avatar jruzekowicz avatar

Stargazers

Struan avatar

Watchers

James Cloos avatar Caleb avatar National Renewable Energy Laboratory avatar  avatar Nick Wunder avatar David Whiteside avatar Struan avatar  avatar

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.