Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue loading csv files in examples -> working directory not same as file directory for VS Code on Windows #873

Open
jfrederik-nrel opened this issue Apr 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jfrederik-nrel
Copy link
Collaborator

When I'm running the examples using VS Code through Anaconda Navigator on my Windows computer, it automatically makes floris (i.e., the base folder) the running directory, instead of the folder in which the example is located (i.e., floris/examples). As a result, when the examples (e.g., 003_wind_data_objects.py or 006_get_farm_aep) try to load the inputs/wind_rose.csv file, it can't be found because it's looking in a non-existing directory.

This issue can easily be solved by the user adding examples to the path when loading the wind rose, but we probably want users on Windows to also be able to run the examples without having to change anything in the code. It also seems that someone at some point was aware of this issue, as I have noticed that FlorisModel does load the yaml files correctly due to this little try-except added to floris_model.py:

image

Perhaps we'll want to add a similar code snippet to other functions that load data from files, such as WindRose.read_csv_long() used to load wind_rose.csv in some of the examples.

I'm experiencing this issue on the v4 branch, but it seems to be a general problem not related to a specific version of FLORIS.

@jfrederik-nrel jfrederik-nrel added the bug Something isn't working label Apr 5, 2024
@paulf81
Copy link
Collaborator

paulf81 commented Apr 5, 2024

This is a good catch @jfrederik-nrel , maybe the easiest solution is then to add such code to the load_csv_long function so we don't clutter the example scripts themselves?

@jfrederik-nrel
Copy link
Collaborator Author

jfrederik-nrel commented Apr 5, 2024

Yes that was my thinking too. I'm just not sure how straightforward that would be and whether there are other functions that have the same issue but are not used in the examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants