knitr::opts_chunk$set(echo = TRUE)
fig_caption=TRUE

Introduction

The United States Geological Survey (USGS) has developed the Streamflow Stats tool within the National Water Census Data Portal (NWC-DP). The Streamflow Stats tool allows users to easily perform statistical analyses on stream flow at a user-selected stream gage. The Streamflow Stats tool uses 6 statistics packages: Seven Fundamental Daily Streamflow Statistics, Flow Magnitude, Flow Frequency, Flow Duration, Flow Timing, and Rate of Change. This lab will walk through how to use these statistical packages.

Important Questions to Ask Yourself

  1. Where can I find the metadata for the datasets associated with the Streamflow Stats tool?
  2. Where can I find the software used to perform the statistics?
  3. How do I download the results of the statistic analysis?

Useful Terms and Acronyms

Term | Definition ------------ | --------------------------------------------------- Metadata | A set of data that describes and gives information about other data HUC | Hydrologic Unit Code which identifies a watershed Watershed | An area or ridge of land that separates waters flowing to different rivers, basins, or seas ET | Evapotransiration - water transferred to the atmosphere through evaporation from soil and transpiration from plants

Exercise 1


Step 1

The purpose of Exercise 1 is to walk through the process of selecting a desired stream gage and comparing the respective data plot with the data plot of a second stream gage. For information regarding operating within the NWC-DP interface, please consult Lab 1. For this exercise, go to the NWC-DP homepage at https://cida.usgs.gov/nwc/ as shown in Figure 1 from Lab 1. Click on the tab titled, "Streamflow Stats" in the Menu ribbon on the left of the page or anywhere in the large Streamflow Stats icon to access the tool.


Step 2

After selecting the Streamflow Stats tool, a new page will open shown in Figure 1 below.


**Figure 1: Streamflow Statistics Calculator homepage.**


In the **`Stream Gage Filters:`** there are 4 layers which can be selected: "Gages for Evaluating Streamflow", "Gages Active in 2009", "Gages II Reference Gages", and "Gages Sorted by Period of Record" as shown in **Figure 2** below.


**Figure 2: Gage layer selections.**


Before selecting a button, we must first understand where the streamflow data come from. To obtain the metadata, right click on **Gages II dataset**, located to the right of the Stream Gage Filters dropdown menu, and open a new tab. A new page will open displaying an abstract for Gages II as shown in **Figure 3**. Under the section titled "Links" there is a link to the metadata. Click on the "Metadata" link. The metadata page is shown in **Figure 4** below.


![**Figure 3: Gages-II abstract and metadata link.**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure3MetaDataLink.JPG)
![**Figure 4: Webpage displaying metadata.**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure2MetaDataHomePage.JPG)



Look under the _**`Description`**_ section. What information do you find related to the different gage layers in the Streamflow Stats tool?
#### Step 3
Go back to the "Streamflow Stats" tool homepage. From the dropdown box, select **Gages for Evaluating Streamflow**. In the search bar, type "La Pine". Do not press the enter key. Once the options have appeared, select the "La Pine OR Deschutes County" option. The map zooms to La Pine, Oregon. Click on the gage nearest La Pine as shown in **Figure 5** below. A new page will open as shown in **Figure 6**. Gage information and location are displayed in the upper left corner. The rest of the screen appears blank. Click the **`Streamflow Data Plot`** button in the center of the screen. A time series plot of streamflow data will display above the **`Streamflow Data Plot`** button.

![**Figure 5: La Pine gage location link.**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure5LaPineArrow.JPG)
![**Figure 6: Webpage displaying metadata.**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure6LaPineGageComparisonBlank.JPG)


Move your cursor over the plotted data. You will notice that actual data points are displayed below the plot similarly to data plots generated using the Water Budget tool. There are two identical tables below the streamflow data plot, each with unchecked boxes and a list of statistic group names. See **Figure 7** below.

![**Figure 7: Statistic group tables link.**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure7StatisticGroups.JPG)
Notice that all the group names listed under the "Statistic Group Name" column have on the right side a small icon depicting a box with an arrow. To obtain the desired metadata associated with the respective statistic group, click on the icon.

####Step 4
Let's use the Streamflow Stats tool to perform some statistical analyses for the streamflow data collected at the Little Deschutes River gage near La Pine, Oregon. Check the box in the Statistic Group table on the left side of the screen next to **Seven Fundamental Daily Streamflow Statistics**. Click the **`Calculate Statistics`** button above the table. The calculations may take a few minutes. The results are shown in **Figure 8** below.

![**Figure 8: Seven Fundamental Daily Streamflow Statistics results link.**]( https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure8StatsResults.JPG)
Statistics including the mean of the daily streamflow, skewness, kurtosis, and other statistics have been calculated. Click on the green **`Download These Statistics`** button to download the results. Once the file has been downloaded, right click on the file and select "Show in Folder". The file should be located in the "Downloads" folder. Copy and paste the file in a preferred location, such as in a NWC-DP project folder. You will notice that the file type is a .tsv (tab separated value ) file type. We will use Microsoft Excel to open the file.

#### Step 5
There are a few methods which can be used to view the statistics results generated using the Streamflow Stats tool. For this example, we will use Microsoft Excel. Open Microsoft Excel. Once Excel is open, click on the **Data** tab. Under the **`From Text`** search for the .tsv file. Excel does default to recognize .tsv files. In the lower right corner of the window, change the file type to "All Files" as shown in **Figure 9**.

![**Figure 9: Changing file types in Excel to "All Files".**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure9ExcelImport.JPG)

Once the correct file has been selected, a **`Text Import Wizard`** box will appear as shown in **Figure 10** below. This wizard allows the user to specify the attributes of the file such as "Delimited" or "Fixed width". In a box located at the bottom of the wizard, a preview of the data is displayed. The data downloaded from the NWC-DP is delimited. Click **`Next`**. A new set of options appears in the wizard as shown in **Figure 11** which allows the user to specify how the contents of the file should be separated. In the bottom of the wizard is a preview of the data. Because the downloaded data was saved as a .tsv file, it can be assumed that the data has been separated by tabs. To verify that assumption, under **Delimiters** select the various options and view the effects in the preview box below. Make sure the **`Tab`** box is checked and then click **`Next`**. The wizard updates to show options for editing column formats. The data file we have downloaded has already been formatted. Click **`Finish`**.

![**Figure 10: Gages-II abstract and metadata link.**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure10DelimitedTextWizard.JPG)
![**Figure 11: Webpage displaying metadata.**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure11DelimiterSetting.JPG)


The wizard disappears and another popup box appears allowing the user to select a cell to import the data into. Click **`Import`** or **`OK`**. The results of the statistical analysis performed using the **Streamflow Stats** tool through the NWC-DP is displayed in **Figure 12** below.

![**Figure 12: Statistics results displayed in Excel.**](https://cdn.rawgit.com/NWCEd/NWCEd/master/inst/Lab2_NWC-DP_Images/Figure12ImportedData.JPG)
## Try It Yourself
#### Problem 1
Using the steps outlined previously for the **Streamflow Statistics Tool**, * Select a NWIS gage near where you live. * Run the Seven Fundamental Daily Streamflow Statistics for your selected gage. * Using the steps outlined above, use Microsoft Excel to view the results of the Seven Fundamental Daily Streamflow Statistics for your selected gage.



NWCEd/NWCEd documentation built on May 7, 2019, 6:04 p.m.