Maintenance scheduled for Thursday, September 24th at 15:00 MDT. Expected downtime <1 hour.

Commit 30e874f2 authored by Domanski, Marian M.'s avatar Domanski, Marian M.

Merge branch 'master' of code.usgs.gov:mdomanski/fluegg

parents 8c9ce618 bba57b43
# Setting up the development environment on Windows
## 1. Download and install Miniconda
Miniconda is a Python distribution and environment manager. Miniconda will help
you install the correct packages and Python version to run the FluEgg code.
* Download [Miniconda](https://docs.conda.io/en/latest/miniconda.html). Be sure
to download the 64-bit Python 3.7 version.
* Run the installer. Install it for "Just me" when asked. This does not require
administrative privileges. **Do not** install Miniconda for "all users".
## 2. Download and install Git
## 1 Download and install Git
Git is a source control manager. It tracks changes made to the code and helps
to keep versions of the code organized.
* Download [Git](https://git-scm.com/). Similar to installing Miniconda, install
Git on your profile. This does not require administrative privileges. **Do
not** install Git for all users.
* Download [Git](https://git-scm.com/). Install Git on your profile.
This does not require administrative privileges.
**Do not** install Git for all users.
## 3. Create an SSH key and add it to your GitLab account
## 2. Create an SSH key and add it to your GitLab account
In order to securely communicate with the remote repository server, you'll need
to set up SSH.
......@@ -31,8 +20,8 @@ to set up SSH.
* Create an SSH key and add it to your GitLab account by following the
instructions beginning [here](https://code.usgs.gov/help/ssh/README.md#generating-a-new-ssh-key-pair).
Follow the instructions under **Generating a new SSH key pair** and **Adding an
SSH key to your GitLab account**.
Follow the instructions under **Generating a new SSH key pair** and
**Adding an SSH key to your GitLab account**.
* You want to use RSA when generating a new SSH key pair.
......@@ -42,40 +31,43 @@ SSH key to your GitLab account**.
ssh -T git@code.usgs.gov
```
## 4. Clone the repository
## 3. Clone the repository
Cloning the repository downloads a copy of the Git repository to your
local machine. This repository contains a history of changes, and most
importantly, the FluEgg code. Cloning the repository will also create a
reference from your local repository to the remote repository on code.usgs.gov.
This process may be done with either Windows Command Prompt or git bash. This
tutorial will use Command Prompt.
* Open Anaconda Prompt (available after installing Miniconda) and navigate to
the directory where you want to keep the FluEgg repository. In the following
instructions, `path-to-sources` is this directory.
* Open Command Prompt and navigate to the directory where you want to keep the
FluEgg repository by using the `cd` command. In the following instructions,
`path-to-sources` is this directory.
* Clone the repository using the following command (where `(base)
C:\path-to-sources>` is the command prompt).
* Clone the repository using the following command (where
`C:\path-to-sources>` is the command prompt).
```
(base) C:\path-to-sources>git clone git@code.usgs.gov:FluEgg/fluegg.git
C:\Users\user>cd C:\path-to-sources
C:\path-to-sources>git clone git@code.usgs.gov:FluEgg/fluegg.git
```
## 5. Create and activate the fluegg conda environment
## 4. Create and activate the fluegg venv environment
In this step, you will create an Anaconda environment that contains the version
In this step, you will create a venv environment that contains the version
of Python and versions of packages that are known to work with the FluEgg code
base.
* `cd` into the `fluegg` directory that was created after cloning the FluEgg
repository.
* Create an environment by running `python -m venv env`
```
(base) C:\path-to-sources>cd fluegg
```
* Create an environment by running `conda create --name fluegg`
```
(base) C:\path-to-sources\fluegg>conda create --name fluegg
C:\path-to-sources>cd fluegg
C:\path-to-sources\fluegg>python -m venv env
```
See [Creating an environment with commands](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands)
on the conda help page for more info.
See [Creating virtual environments](https://docs.python.org/3/library/venv.html#creating-virtual-environments)
on the venv help page for more info.
* Activate the fluegg environment
......@@ -83,31 +75,22 @@ You'll have to take this step every time you want to work in the FluEgg
development environment.
```
(base) C:\path-to-sources\fluegg>conda activate fluegg
(fluegg) C:\path-to-sources\fluegg>
C:\path-to-sources\fluegg>env\Scripts\activate
(env) C:\path-to-sources\fluegg>
```
## 6. Install the fluegg environment
## 5. Install the fluegg environment
The fluegg environment contains Python packages that the fluegg package is
known to work with.
First, install Python. This will also install supporting libraries and
programs, including pip.
```
(fluegg) C:\path-to-sources\fluegg>conda install python==3.7.3
```
If conda throws an SSL error, see [this document](doi-sslintercept.md)
Next, install the packages in the environment using pip.
First, install the packages in the environment using pip.
```
(fluegg) C:\path-to-sources\fluegg>pip install -r requirements.txt
(env) C:\path-to-sources\fluegg>pip install -r requirements.txt
```
## 7. Install the fluegg package
## 6. Install the fluegg package
In order for the Python interpreter in the fluegg environment to have "global"
access to the fluegg package, you'll have to install the package within the
......@@ -115,13 +98,13 @@ fluegg environment.
* Install the fluegg package with pip
```
(fluegg) C:\path-to-sources\fluegg>pip install -e .
(env) C:\path-to-sources\fluegg>pip install -e .
```
The `-e` option tells pip to install the fluegg package in "editable" mode.
See ["Editable" installs](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs) for more info.
## 8. Run the FluEgg unit tests
## 7. Run the FluEgg unit tests
Running the unit tests will ensure the environment is set up and the FluEgg
code is working correctly.
......@@ -129,12 +112,12 @@ code is working correctly.
* From the fluegg directory, run `python setup.py test` from the
command line. The output should look something like the below text.
```
(fluegg) C:\path-to-sources\fluegg>python setup.py test
(env) C:\path-to-sources\fluegg>python setup.py test
*test output... maybe some warnings but it doesn't matter so long as the tests
pass*
----------------------------------------------------------------------
Ran 40 tests in 3.452s
Ran 43 tests in 3.452s
OK
```
......@@ -142,7 +125,7 @@ OK
The tests passing is a clear indicator that the FluEgg environment has been set
up correctly. You're ready to begin working with the code.
## 9. Build the code documentation
## 8. Build the code documentation
Currently, only the docstrings within the FluEgg code are available in the
documentation.
......@@ -151,7 +134,7 @@ To build the documentation, run the command `python setup.py build_sphinx` from
the prompt. The output will look something like the below text.
```
(fluegg) C:\path-to-sources\fluegg>python setup.py build_sphinx
(env) C:\path-to-sources\fluegg>python setup.py build_sphinx
running build_sphinx
*build process output*
The HTML pages are in docs\_build\html.
......@@ -161,3 +144,29 @@ To view the generated HTML documentation, open the file
`path-to-sources\fluegg\docs\_build\html\index.html` in a browser. Again,
`path-to-sources\fluegg` is the top-level directory of the FluEgg project on
your machine.
## 9. Build an executable
The FluEgg repository also contains code for the user interface. This user interface
may be tested by running the following command:
```
(env) C:\path-to-source\fluegg>python app.py
```
For more information on how to use the user interface, see the FluEgg Manual.
In order to build the user interface as it appears through the command line,
the python module `pyinstaller` will be used. To start, enter the command:
```
(env) C:\path-to-source\fluegg>pyinstaller app.spec
```
The process of building the program may take a couple minutes. When complete,
attempt to run the build now stored in the auto-generated `dist` folder.
The executable will be named with a timestamp to distinguish between different
builds. If there are any issues during building or if the executable file
fails to run, check that all of the code requirements are satisfied using the command
`pip list` and see [Using Spec Files](https://pyinstaller.readthedocs.io/en/stable/spec-files.html)
from the pyinstaller manual.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -11,167 +11,23 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {
"scrolled": false
"scrolled": false,
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Help on class RASProject in module fluegg.ras:\n",
"\n",
"class RASProject(builtins.object)\n",
" | RAS project.\n",
" | \n",
" | After use, call close() to keep the RAS process from lingering. The\n",
" | RASProject interface facilitates the use of the with-statement. See\n",
" | below for an example.\n",
" | \n",
" | ```\n",
" | with RASProject(project_file_path) as rp:\n",
" | hydrauilc_data = rp.hydraulic_model_data('Unsteady')\n",
" | ```\n",
" | \n",
" | \n",
" | Parameters\n",
" | ----------\n",
" | project_file_path : str\n",
" | Path to RAS project file\n",
" | \n",
" | Notes\n",
" | -----\n",
" | The values in the output of hydraulic_model_data are in metric units. If\n",
" | the quantities in the RAS project are in English units, the output will be\n",
" | converted.\n",
" | \n",
" | Methods defined here:\n",
" | \n",
" | __enter__(self)\n",
" | \n",
" | __exit__(self, *args)\n",
" | \n",
" | __init__(self, project_file_path)\n",
" | Initialize self. See help(type(self)) for accurate signature.\n",
" | \n",
" | close(self)\n",
" | Close the RAS controller\n",
" | \n",
" | current_plan_name(self)\n",
" | Returns the current plan name\n",
" | \n",
" | Returns\n",
" | -------\n",
" | str\n",
" | \n",
" | current_reach_name(self)\n",
" | Returns the current reach name\n",
" | \n",
" | Returns\n",
" | -------\n",
" | str\n",
" | \n",
" | current_river_name(self)\n",
" | Returns the current river name\n",
" | \n",
" | Returns\n",
" | -------\n",
" | str\n",
" | \n",
" | hydraulic_model_data(self, profile_name, temperature=22)\n",
" | Returns a pandas.DataFrame containing hydraulic data for the specified profile.\n",
" | \n",
" | If 'Unsteady' is specified for profile_name, the index of the DataFrame will be a pandas.MultiIndex\n",
" | \n",
" | Parameters\n",
" | ----------\n",
" | profile_name : str\n",
" | Name of profile. The name must be in the list of profiles or 'Unsteady'. If 'Unsteady', the\n",
" | RAS profile must have an associated unsteady file.\n",
" | temperature : float\n",
" | Water temperature\n",
" | \n",
" | Returns\n",
" | -------\n",
" | pandas.DataFrame\n",
" | \n",
" | plan_names(self)\n",
" | Returns a list of plan names in this RAS project.\n",
" | \n",
" | Returns\n",
" | -------\n",
" | list\n",
" | \n",
" | profile_names(self)\n",
" | Returns a list of profile names in this RAS project.\n",
" | \n",
" | Returns\n",
" | -------\n",
" | list\n",
" | \n",
" | project_units(self)\n",
" | Returns the RAS project units.\n",
" | \n",
" | Returns\n",
" | -------\n",
" | str\n",
" | \n",
" | reach_names(self)\n",
" | Returns a list of reach names in this RAS project.\n",
" | \n",
" | Returns\n",
" | -------\n",
" | list\n",
" | \n",
" | river_names(self)\n",
" | Returns a list of river names in this RAS project.\n",
" | \n",
" | Returns\n",
" | -------\n",
" | list\n",
" | \n",
" | set_current_plan(self, plan_name)\n",
" | Sets the current plan name for this RAS project.\n",
" | \n",
" | Parameters\n",
" | ----------\n",
" | plan_name : str\n",
" | Plan name. The plan name must be in the list of plan names of this project.\n",
" | \n",
" | ----------------------------------------------------------------------\n",
" | Data descriptors defined here:\n",
" | \n",
" | __dict__\n",
" | dictionary for instance variables (if defined)\n",
" | \n",
" | __weakref__\n",
" | list of weak references to the object (if defined)\n",
"\n"
]
}
],
"outputs": [],
"source": [
"help(RASProject)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Current plan name: case1\n",
"Profile names\n",
"----------\n",
" PF 1\n",
" PF 2\n"
]
}
],
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"project_file_path = r'..\\test\\data\\ras\\steadyflume\\rectangular-flume.prj'\n",
"\n",
......@@ -187,95 +43,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Depth_m</th>\n",
" <th>Q_cms</th>\n",
" <th>Vmag_mps</th>\n",
" <th>CumlDistance_km</th>\n",
" <th>Ustar_mps</th>\n",
" <th>Vvert_mps</th>\n",
" <th>Vlat_mps</th>\n",
" <th>Temp_C</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1.835397</td>\n",
" <td>24.999996</td>\n",
" <td>0.136210</td>\n",
" <td>5.0</td>\n",
" <td>0.013188</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1.835564</td>\n",
" <td>24.999996</td>\n",
" <td>0.136198</td>\n",
" <td>15.0</td>\n",
" <td>0.013187</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1.835687</td>\n",
" <td>24.999996</td>\n",
" <td>0.136189</td>\n",
" <td>20.0</td>\n",
" <td>0.013186</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>22</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Depth_m Q_cms Vmag_mps CumlDistance_km Ustar_mps Vvert_mps \\\n",
"1 1.835397 24.999996 0.136210 5.0 0.013188 0 \n",
"2 1.835564 24.999996 0.136198 15.0 0.013187 0 \n",
"3 1.835687 24.999996 0.136189 20.0 0.013186 0 \n",
"\n",
" Vlat_mps Temp_C \n",
"1 0 22 \n",
"2 0 22 \n",
"3 0 22 "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"profile_name = project_profile_names[0]\n",
"temperature = 22\n",
......@@ -285,6 +55,13 @@
"\n",
"hydraulic_data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......@@ -303,7 +80,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.7.7"
}
},
"nbformat": 4,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -536,7 +536,7 @@ class PlotsWindow(QMainWindow):
# Cancel if no project is loaded
return
data = (raw_data[1, 0], data[1:])
data = (raw_data[1, 0]*1000, data[1:])
self.ui.progressBar.setValue(75)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment