Giter Club home page Giter Club logo

func-flow's Introduction

Functional Flows Calculator

Build Status

About

This project uses Python3

Getting Started in 4 simple steps (Mac OS)

  1. Install Python3, Git and a text editor of your choice.

  2. Clone your project in Terminal

    git clone https://github.com/larflows/func-flow.git
    cd func-flow/
    
  3. Create and activate virtualenv

    python3 -m venv my-virtualenv
    source my-virtualenv/bin/activate
    
  4. Install dependencies

    pip install -r requirements.txt
    

Getting Started in 5 steps (Windows)

  1. Install Python3, Git and a text editor of your choice.

  2. Add Python to System Path

    • Locate Python3 from your local computer. Usually located in the following folder:

      C:\python3
      

      or

      C:\Users\your-name\AppData\Local\Programs\Python\Python36-32
      
    • Follow this link from step 2 to the end.

    • Go into Command Prompt by typing cmd in search bar, and type python. You should see the following:

      Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
      [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>>
      
    • Type exit() to exit the python shell.

  3. Clone your project in Command Prompt

    git clone https://github.com/larflows/func-flow.git
    cd func-flow
    
  4. Create and activate virtualenv

    python -m venv my-virtualenv
    my-virtualenv\Scripts\activate
    
  5. Install dependencies

    pip install -r requirements.txt
    

Run Script

  1. In project directory

    python main.py
    

Using referee (R interface)

General note: during installation of dependencies, some may fail to install. If this occurs, run pip install numpy, pip install pandas, and pip install scipy, as these are the three libraries required for referee.

The R interface allows uploading from data frames and reading out results. For now, the variable EFF_DIR in referee.R must be set to the top-level func-flow directory. Python 3 must be used; if a virtual environment is being used (as per the directions above), set VENV_PATH appropriately and uncomment the line that calls use_virtualenv. Otherwise, make sure PYTHON_PATH is set appropriately to use Python 3. The program will not work with Python 2. If dependencies were installed to the virtual env (following the instructions above), then the virtual env must be used as the dependencies will not have been installed globally. If you get dependency errors, the most likely solution is to make sure that referee is set to use the virtual env and the path specified appropriately. In this case also make sure that the like use_python(...) is commented out. The current default is to use the virtual env, but the path must still be specified.

Multi-gage flow data can be uploaded through upload_gagedata, which requires a data frame with the columns gage (character), data (character - mm/dd/yyyy), and flow (cfs). The data for a single gage can be uploaded by using write_input_df and then upload_files, and the data can be put into the appropriate format with make_input_df.

Results can be read out into data frames (specifically, tibbles) through get_annual_flow_result. get_annual_flow_matrix and get_drh are also available, but do not process the data into a user-friendly format, unlike get_annual_flow_result (as the annual flow result data appears to be the most relevant).

The function process_gages will take a multi-gage data frame and return a list of all of the flow result data frames without any other user intervention. It will also work with a single gage with or without a gage column. It is unlikely that most users will need to use any of the lower-level functions described above. If the data is not in the correct format (gage, date as character mm/dd/yyyy, flow as cfs), then the function format_and_process should be used instead. The options are described in the comments in format_input_df.

Example data can be generated by example_gagedata. Thus, running process_gages(example_gagedata()) will demonstrate the full functionality of the script as far as annual flow results are concerned.

Development

  1. For older to newer python upgrade

    python server, when not able to create python env
    python -m venv test --without-pip
    source test/bin/activate
    curl https://bootstrap.pypa.io/get-pip.py | python
    

Error and Bug

Use Trello to keep upload error message, a screen shot, and raw data file used

Options

iTerm: iTerm2 is a replacement for Terminal

find . -name '*.rdb' -exec sh -c 'mv "$0" "${0%.rdb}.csv"' {} \;

  pip freeze > requirements.txt

Flask server

To start flask server, first init virtualenv and then install all dependencies. flask run

License

Copyright (c) 2018

Licensed under the MIT license.

func-flow's People

Contributors

leogoesger avatar noellepatterson avatar quantum-dan avatar madhavparekh avatar

Stargazers

Typical Engineer avatar

Watchers

James Cloos 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.