Skip to content

Commit

Permalink
Modifying examples to be more readable (#35)
Browse files Browse the repository at this point in the history
* Updated QC_example

* Update river_example.ipynb

Check the end, I believe it should be "Annual Energy Produced: 19.07 MWh" not Annual Energy Produced: 19.07 MW"

* Update tidal_example.ipynb

* Update wave_example.ipynb

* Updated river_example to display the correct annual energy produced
  • Loading branch information
SeanPluemer committed May 20, 2020
1 parent 6a76c0d commit 1fc2cc7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
8 changes: 4 additions & 4 deletions examples/qc_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The wave elevation data used in this example includes several issues, including timestamps that are out of order, corrupt data with values of -999, data outside expected range, and stagnant data. \n",
"The wave elevation data used in this example includes several issues, including timestamps that are out of order, corrupt data with values of -999, data outside the expected range, and stagnant data. \n",
"\n",
"The data is loaded into a pandas DataFrame using the pandas method `read_csv`. The first 5 rows of data are shown below, along with a plot."
]
Expand Down Expand Up @@ -121,7 +121,7 @@
"metadata": {},
"source": [
"## Quality control tests\n",
"The following quality control tests are used to identify timestamp issues, corrupt data, data outside expected range, and stagnant data.\n",
"The following quality control tests are used to identify timestamp issues, corrupt data, data outside the expected range, and stagnant data.\n",
"\n",
"Each quality control tests results in the following information:\n",
"\n",
Expand All @@ -137,7 +137,7 @@
"### Check timestamp\n",
"Quality control analysis generally starts by checking the timestamp index of the data. \n",
"\n",
"The follow test checks to see if 1) the data contains duplicate timestamps, 2) timestamps are not monotonically increasing, and 3) timestamps occur at irregular intervals (an interval of 0.002s is expected for this data). \n",
"The following test checks to see if 1) the data contains duplicate timestamps, 2) timestamps are not monotonically increasing, and 3) timestamps occur at irregular intervals (an interval of 0.002s is expected for this data). \n",
"\n",
"If duplicate timestamps are found, the resulting DataFrames (cleaned data and mask) keep the first occurrence. If timestamps are not monotonic, the timestamps in the resulting DataFrames are reordered."
]
Expand Down Expand Up @@ -315,7 +315,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Check for data outside expected range\n",
"### Check for data outside the expected range\n",
"The next quality control test checks for data that is greater than 50 or less than -50. Note that expected range tests can also be used to compare measured values to a model, or analyze the expected relationships between data columns."
]
},
Expand Down
31 changes: 20 additions & 11 deletions examples/river_example.ipynb

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions examples/tidal_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"source": [
"## Loading Data from NOAA-Currents\n",
" \n",
"This example uses 1 year of data from the NOAA-Currents sites. A map of available currents stations is available at https://tidesandcurrents.noaa.gov/map/. The tidal io module includes two functions to import data: `request_noaa_data` which pulls data from the website, and `read_noaa_json` which loads a json file. The request function can save the json file for later use. \n",
"This example uses 1 year of data from the NOAA-Currents sites. A map of available currents stations is available at https://tidesandcurrents.noaa.gov/map/. The tidal io module includes two functions to import data: `request_noaa_data` which pulls data from the website, and `read_noaa_json` which loads a JSON file. The request function can save the JSON file for later use. \n",
"\n",
"For simplicity, this example loads data from a json file into a pandas DataFrame. This data contains 1 year of 6 minute averaged data from the Southampton Shoal Channel LB 6 (Station Number: s08010) in San Francisco Bay. The data includes 6 minute averaged direction [degrees] and speed [cm/s] indexed by time. The DataFrame key names returned by NOAA are 'd' for direction and 's' for speed. Since MHKIT uses SI units, speed is converted to m/s. "
"For simplicity, this example loads data from a JSON file into a pandas DataFrame. This data contains 1 year of 6 minute averaged data from the Southampton Shoal Channel LB 6 (Station Number: s08010) in San Francisco Bay. The data includes 6 minute averaged direction [degrees] and speed [cm/s] indexed by time. The DataFrame key names returned by NOAA are 'd' for direction and 's' for speed. Since MHKIT uses SI units, speed is converted to m/s. "
]
},
{
Expand Down Expand Up @@ -73,11 +73,11 @@
"metadata": {},
"source": [
"The data can also be obtained using the function `request_noaa_data` in the tidal IO module. \n",
"To use this function, we need a station number, parameter type, a start date and an end date. \n",
"To use this function, we need a station number, parameter type, start date, and end date.\n",
"The station number can be found on the NOAA tides and currents website linked above. \n",
"The IEC standard recommends 1 year of 10 minute direction and velocity data. The request function allows users to easily pull any timeframe of data although NOAA limits any one pull to 30 days.\n",
"The IEC standard recommends 1 year of 10-minute direction and velocity data. The request function allows users to easily pull any timeframe of data although NOAA limits any one pull to 30 days.\n",
"\n",
"The following code, which has been commented out for this demonstration, can be used to pull data from the NOAA website. This function can be used to save data to a json for later use."
"The following code, which has been commented out for this demonstration, can be used to pull data from the NOAA website. This function can be used to save data to a JSON for later use."
]
},
{
Expand All @@ -96,7 +96,7 @@
"metadata": {},
"source": [
"## Principal Flow Directions\n",
"As an initial check on the data, a velocity plot can be created to identify data gaps. To consider the velocity in one of the principal flow directions we apply the `principal_flow_directions` function. This function returns 2 directions (in degrees) corresponding to the flood and ebb directions of the tidal site. Principal flow directions are calculated based on the highest frequency directions. These directions are often close to 180 degrees apart, but are not required to be.\n",
"As an initial check on the data, a velocity plot can be created to identify data gaps. To consider the velocity in one of the principal flow directions we apply the `principal_flow_directions` function. This function returns 2 directions (in degrees) corresponding to the flood and ebb directions of the tidal site. Principal flow directions are calculated based on the highest frequency directions. These directions are often close to 180 degrees apart but are not required to be.\n",
"\n",
"The `plot_current_timeseries` function plots velocity in either direction using the speed timeseries. "
]
Expand Down Expand Up @@ -155,7 +155,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The plot above shows missing data for most of early and mid 2017. The IEC standard recommends a minimum of 1 year of 10 minute averaged data (See IEC 201 for full description). For the purposes of demonstration, this dataset is sufficient. To look at a specific month we can slice the dataset before passing to the plotting function."
"The plot above shows missing data for most of early and mid-2017. The IEC standard recommends a minimum of 1 year of 10 minute averaged data (See IEC 201 for full description). For the demonstration, this dataset is sufficient. To look at a specific month we can slice the dataset before passing to the plotting function."
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions examples/wave_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The `capture_length_matrix` function can also use a callable function as the statistic argument. For example, suppose that we wanted to generate a matrix with the variance of the capture length. We could achieve this by passing the numpy variance function `np.var` into the `capture_length_matrix` function, as shown below."
"The `capture_length_matrix` function can also use a callable function as the statistic argument. For example, suppose that we wanted to generate a matrix with the variance of the capture length. We could achieve this by passing the NumPy variance function `np.var` into the `capture_length_matrix` function, as shown below."
]
},
{
Expand All @@ -216,7 +216,7 @@
"metadata": {},
"source": [
"## MAEP\n",
"There are two ways to calculate mean annual energy production (MEAP). One is from capture length and wave energy flux matrices, the other is from time-series data, as shown below."
"There are two ways to calculate the mean annual energy production (MEAP). One is from capture length and wave energy flux matrices, the other is from time-series data, as shown below."
]
},
{
Expand Down Expand Up @@ -279,7 +279,7 @@
"metadata": {},
"source": [
"The plotting function only requires the matrix as input, but the function can also take several other arguments.\n",
"The list of optional arguments are: `xlabel, ylabel, zlabel, show_values, and ax`. The following uses these optional arguments. The matplotlib package is imported to define an axis with a larger figure size."
"The list of optional arguments is: `xlabel, ylabel, zlabel, show_values, and ax`. The following uses these optional arguments. The matplotlib package is imported to define an axis with a larger figure size."
]
},
{
Expand Down Expand Up @@ -344,7 +344,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.7.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 1fc2cc7

Please sign in to comment.