MHKiT-Software / MHKiT-Python

MHKiT-Python provides the marine renewable energy (MRE) community tools for data processing, visualization, quality control, resource assessment, and device performance.
https://mhkit-software.github.io/MHKiT/
BSD 3-Clause "New" or "Revised" License
47 stars 45 forks source link

Examples will not run #24

Closed SeanPluemer closed 4 years ago

SeanPluemer commented 4 years ago

Any example where the code is calling for the data in the examples folder will not run as they stand. For example:
# Load data from the csv file into a DataFrame data = pd.read_csv('data/wave_elevation_data.csv', index_col='Time') will result this error message: FileNotFoundError: [Errno 2] File data/wave_elevation_data.csv does not exist: 'data/wave_elevation_data.csv'

The only way I was able to get the code to run was by changing it to this: # Load data from the csv file into a DataFrame data = pd.read_csv(r'C:\users\pluem\documents\MHKiT-Python\examples\data/wave_elevation_data.csv', index_col='Time')

kmruehl commented 4 years ago

@SeanPluemer which example are you trying to run?

All of these examples should run using a relative path since the data is included in the examples directory on GitHub: https://github.com/MHKiT-Software/MHKiT-Python/tree/master/examples/data. You should not need to specify a direct path to get the example to run. This may mean that the relative path for this example is incorrect.

kmruehl commented 4 years ago

@SeanPluemer it looks like you're running https://github.com/MHKiT-Software/MHKiT-Python/blob/master/examples/qc_example.ipynb. This should run as a relative path if you are in the correct directory.

rpauly18 commented 4 years ago

I just tried running the qc example that I believe @SeanPluemer was running. It ran just fine for me using the relative path. So, not sure what the issue is. Perhaps something has changed in the paths on your computer. I had also had my intern run these examples a while back and he said they ran fine as they were.

kmruehl commented 4 years ago

@rpauly18 I agree. The relative path should work as is.

ssolson commented 4 years ago

As it stands there is nowhere in the examples/ documentation which directs the user to run/ look for the data using a relative path correct? Essentially running the example from the examples folder.

kmruehl commented 4 years ago

@ssolson The header of this example states "The data file used in this example is stored in the \MHKiT\examples\data directory." We could add that the example should be run from the examples directory.

ssolson commented 4 years ago

Talking to Sean it seems that the issue here is that it was not clear that these need to be run as Jupyter Notebooks. I suggest in the Documentation at the "Examples" subheader we add a quick note on how to start a python notebook (or point to a Jupyter Notebook reference). And maybe on each example near the top say to run this as a Jupyter notebook (or point to a reference). It may seem obvious to us that these are notebooks by the extension but I don't think it is to someone coming in unfamiliar with Python/ notebooks and this would help clarify.

kmruehl commented 4 years ago

@ssolson sounds good to me.

@SeanPluemer I suggest adding a note to the top of each example, and modifying the examples documentation here: https://mhkit-software.github.io/MHKiT/python.html#examples to specify these are Jupyter notebooks and how to run them.

ssolson commented 4 years ago

@SeanPluemer added a note clarifying that these were Jupyter notebooks in the documentation