This project uses Python3
-
Install Python3, Git and a text editor of your choice.
-
Clone your project in Terminal
git clone https://github.com/larflows/func-flow.git cd func-flow/
-
Create and activate virtualenv
python3 -m venv my-virtualenv source my-virtualenv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Install Python3, Git and a text editor of your choice.
-
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 typepython
. 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.
-
-
Clone your project in Command Prompt
git clone https://github.com/larflows/func-flow.git cd func-flow
-
Create and activate virtualenv
python -m venv my-virtualenv my-virtualenv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
In project directory
python main.py
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.
-
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
Use Trello to keep upload error message, a screen shot, and raw data file used
iTerm: iTerm2 is a replacement for Terminal
find . -name '*.rdb' -exec sh -c 'mv "$0" "${0%.rdb}.csv"' {} \;
pip freeze > requirements.txt
To start flask server, first init virtualenv and then install all dependencies. flask run
Copyright (c) 2018
Licensed under the MIT license.