You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multidimensional Cp and Ct IEA 15MW definition can fail to load
The multidimensional Cp and Ct modeling feature in FLORIS requires the turbine definition to include a CSV file with the higher dimension tables. The CSV file is passed to the turbine definition via the power_thrust_data_file: input field. In the set of turbine definitions includes with FLORIS, referred to as the "turbine library", the multidimensional Cp and Ct definition for the IEA 15MW points to the CSV file with a relative path assuming that the calling script is in the examples directory (or more generally, in a directory parallel to the floris/ directory):
Since the turbine library should be available for any analysis script, the turbine definitions there should be path-agnostic.
This is part of the cause of #733.
How to reproduce
To test this, I first copied a couple of examples to a new directory outside of the floris repository along with their associated input files. The first example, 01_opening_floris_computing_power.py , uses the NREL 5MW turbine definition from the turbine library, and it runs fine. The next example using the multidimensional Cp and Ct feature, 30_multi_dimensional_cp_ct.py, selects iea_15MW_floating_multi_dim_cp_ct as the turbine type. Since the relative path to the CSV file now does not exist, the bug is exposed.
The error when running the multidimensional Cp and Ct example is:
(floris_pip) >>mbp@~/Desktop/floris_examples $ python 30_multi_dimensional_cp_ct.py
Traceback (most recent call last):
File "/Users/rmudafor/Desktop/floris_examples/30_multi_dimensional_cp_ct.py", line 59, in <module>
fi = FlorisInterface("gch_multi_dim_cp_ct.yaml")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/floris/tools/floris_interface.py", line 58, in __init__
self.floris = Floris.from_file(self.configuration)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/floris/simulation/floris.py", line 350, in from_file
return Floris.from_dict(input_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/floris/type_dec.py", line 160, in from_dict
return cls(**kwargs)
^^^^^^^^^^^^^
File "<attrs generated init floris.simulation.floris.Floris>", line 11, in __init__
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/floris/simulation/floris.py", line 85, in __attrs_post_init__
self.farm.construct_turbine_map()
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/floris/simulation/farm.py", line 254, in construct_turbine_map
TurbineMultiDimensional.from_dict(turb) for turb in self.turbine_definitions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/floris/type_dec.py", line 160, in from_dict
return cls(**kwargs)
^^^^^^^^^^^^^
File "<attrs generated init floris.simulation.turbine_multi_dim.TurbineMultiDimensional>", line 21, in __init__
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/floris/simulation/turbine_multi_dim.py", line 452, in __attrs_post_init__
df = pd.read_csv(self.power_thrust_data_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 948, in read_csv
return _read(filepath_or_buffer, kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 611, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1448, in __init__
self._engine = self._make_engine(f, self.engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1705, in _make_engine
self.handles = get_handle(
^^^^^^^^^^^
File "/Users/rmudafor/miniconda3/envs/floris_pip/lib/python3.12/site-packages/pandas/io/common.py", line 863, in get_handle
handle = open(
^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '../floris/turbine_library/iea_15MW_multi_dim_Tp_Hs.csv'
Floris version
To test this, I created a new virtual environment and installed floris from PyPI. Specifically, this is not a local editable install. This was tested with FLORIS v3.5.
The text was updated successfully, but these errors were encountered:
Multidimensional Cp and Ct IEA 15MW definition can fail to load
The multidimensional Cp and Ct modeling feature in FLORIS requires the turbine definition to include a CSV file with the higher dimension tables. The CSV file is passed to the turbine definition via the
power_thrust_data_file:
input field. In the set of turbine definitions includes with FLORIS, referred to as the "turbine library", the multidimensional Cp and Ct definition for the IEA 15MW points to the CSV file with a relative path assuming that the calling script is in theexamples
directory (or more generally, in a directory parallel to thefloris/
directory):Since the turbine library should be available for any analysis script, the turbine definitions there should be path-agnostic.
This is part of the cause of #733.
How to reproduce
To test this, I first copied a couple of examples to a new directory outside of the floris repository along with their associated input files. The first example, 01_opening_floris_computing_power.py , uses the NREL 5MW turbine definition from the turbine library, and it runs fine. The next example using the multidimensional Cp and Ct feature, 30_multi_dimensional_cp_ct.py, selects
iea_15MW_floating_multi_dim_cp_ct
as the turbine type. Since the relative path to the CSV file now does not exist, the bug is exposed.The files used to show this are:
The error when running the multidimensional Cp and Ct example is:
Floris version
To test this, I created a new virtual environment and installed floris from PyPI. Specifically, this is not a local editable install. This was tested with FLORIS v3.5.
The text was updated successfully, but these errors were encountered: