From 2633aabd505bc7d7a806c5a4bc0f61cd9d6e58b5 Mon Sep 17 00:00:00 2001 From: "Mads M. Pedersen" <mmpe@dtu.dk> Date: Thu, 31 Aug 2023 09:50:06 +0000 Subject: [PATCH] Fix doc and so input files --- .gitlab-ci.yml | 2 ++ docs/Makefile | 2 +- docs/{source => }/bladed/Bladed_airfoil.png | Bin docs/{source => }/bladed/Bladed_st_centers.png | Bin docs/{source => }/bladed/Bladed_turbine_coord.png | Bin docs/{source => }/bladed/HAWC2_c2_def_ccord.png | Bin docs/{source => }/bladed/HAWC2_st_centers.png | Bin docs/{source => }/bladed/HAWC2_turbine_coord.png | Bin docs/{source => }/bladed/bladed2hawc.ipynb | 0 docs/{source => }/bladed/bladed2hawc.rst | 4 ++-- docs/{source => }/conf.py | 2 +- docs/{source/fatigue_tools => }/fatigue.rst | 2 +- docs/{source/hawc2 => }/hawc2.rst | 6 +++--- docs/{source => }/index.rst | 4 ++-- docs/{source => }/installation.rst | 0 docs/make.bat | 2 +- {notebooks/fatigue => docs/notebooks}/Fatigue.ipynb | 0 .../notebooks}/hawc2/InputFileWriting.ipynb | 0 .../notebooks}/hawc2/RunningSimulations.ipynb | 0 .../notebooks}/hawc2/RunningSimulationsJess.ipynb | 0 docs/source/fatigue_tools/fatigue_nb.nblink | 3 --- docs/source/hawc2/InputFileWriting_nb.nblink | 3 --- docs/source/hawc2/RunningSimulationsJess_nb.nblink | 3 --- docs/source/hawc2/RunningSimulations_nb.nblink | 3 --- pyproject.toml | 2 +- update_pyproject.py | 2 +- wetb/hawc2/htc_file.py | 11 ++++++----- wetb/hawc2/tests/test_htc_file.py | 5 +++++ 28 files changed, 26 insertions(+), 30 deletions(-) rename docs/{source => }/bladed/Bladed_airfoil.png (100%) rename docs/{source => }/bladed/Bladed_st_centers.png (100%) rename docs/{source => }/bladed/Bladed_turbine_coord.png (100%) rename docs/{source => }/bladed/HAWC2_c2_def_ccord.png (100%) rename docs/{source => }/bladed/HAWC2_st_centers.png (100%) rename docs/{source => }/bladed/HAWC2_turbine_coord.png (100%) rename docs/{source => }/bladed/bladed2hawc.ipynb (100%) rename docs/{source => }/bladed/bladed2hawc.rst (98%) rename docs/{source => }/conf.py (99%) rename docs/{source/fatigue_tools => }/fatigue.rst (94%) rename docs/{source/hawc2 => }/hawc2.rst (73%) rename docs/{source => }/index.rst (92%) rename docs/{source => }/installation.rst (100%) rename {notebooks/fatigue => docs/notebooks}/Fatigue.ipynb (100%) rename {notebooks => docs/notebooks}/hawc2/InputFileWriting.ipynb (100%) rename {notebooks => docs/notebooks}/hawc2/RunningSimulations.ipynb (100%) rename {notebooks => docs/notebooks}/hawc2/RunningSimulationsJess.ipynb (100%) delete mode 100644 docs/source/fatigue_tools/fatigue_nb.nblink delete mode 100644 docs/source/hawc2/InputFileWriting_nb.nblink delete mode 100644 docs/source/hawc2/RunningSimulationsJess_nb.nblink delete mode 100644 docs/source/hawc2/RunningSimulations_nb.nblink diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 53b91b53..8ad2acc7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,8 +41,10 @@ pages: # "pages" is a job specifically for GitLab pages [1] script: # use sphinx to build docs, move to public page - pip install --upgrade pip - pip install sphinx --upgrade + - pip install sphinx sphinx_rtd_theme - pip install nbsphinx==0.3.5 - pip install git+https://github.com/vidartf/nbsphinx-link.git + - pip install -e . - cd docs; make html - cd ../; mv docs/build/html public/ artifacts: # required for GitLab pages [1] diff --git a/docs/Makefile b/docs/Makefile index cb6f40a6..061f2593 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -5,7 +5,7 @@ SPHINXOPTS = SPHINXBUILD = python -msphinx SPHINXPROJ = TOPFARM -SOURCEDIR = source +SOURCEDIR = . BUILDDIR = build # Put it first so that "make" without argument is like "make help". diff --git a/docs/source/bladed/Bladed_airfoil.png b/docs/bladed/Bladed_airfoil.png similarity index 100% rename from docs/source/bladed/Bladed_airfoil.png rename to docs/bladed/Bladed_airfoil.png diff --git a/docs/source/bladed/Bladed_st_centers.png b/docs/bladed/Bladed_st_centers.png similarity index 100% rename from docs/source/bladed/Bladed_st_centers.png rename to docs/bladed/Bladed_st_centers.png diff --git a/docs/source/bladed/Bladed_turbine_coord.png b/docs/bladed/Bladed_turbine_coord.png similarity index 100% rename from docs/source/bladed/Bladed_turbine_coord.png rename to docs/bladed/Bladed_turbine_coord.png diff --git a/docs/source/bladed/HAWC2_c2_def_ccord.png b/docs/bladed/HAWC2_c2_def_ccord.png similarity index 100% rename from docs/source/bladed/HAWC2_c2_def_ccord.png rename to docs/bladed/HAWC2_c2_def_ccord.png diff --git a/docs/source/bladed/HAWC2_st_centers.png b/docs/bladed/HAWC2_st_centers.png similarity index 100% rename from docs/source/bladed/HAWC2_st_centers.png rename to docs/bladed/HAWC2_st_centers.png diff --git a/docs/source/bladed/HAWC2_turbine_coord.png b/docs/bladed/HAWC2_turbine_coord.png similarity index 100% rename from docs/source/bladed/HAWC2_turbine_coord.png rename to docs/bladed/HAWC2_turbine_coord.png diff --git a/docs/source/bladed/bladed2hawc.ipynb b/docs/bladed/bladed2hawc.ipynb similarity index 100% rename from docs/source/bladed/bladed2hawc.ipynb rename to docs/bladed/bladed2hawc.ipynb diff --git a/docs/source/bladed/bladed2hawc.rst b/docs/bladed/bladed2hawc.rst similarity index 98% rename from docs/source/bladed/bladed2hawc.rst rename to docs/bladed/bladed2hawc.rst index 20f4faaa..44443268 100644 --- a/docs/source/bladed/bladed2hawc.rst +++ b/docs/bladed/bladed2hawc.rst @@ -58,9 +58,9 @@ available to extract a ``numpy`` array, for example as follows:: prj.bd['BSTIFFMB'] ---------------------------------- +------------------------------------ Convert BLADED project file to HAWC2 ---------------------------------- +------------------------------------ The class ``wetb.bladed.prj2hawc.Convert2Hawc`` will convert a Bladed project file into a set of HAWC2 input files. This process assumes that a standard diff --git a/docs/source/conf.py b/docs/conf.py similarity index 99% rename from docs/source/conf.py rename to docs/conf.py index eb03b910..f8ea741e 100644 --- a/docs/source/conf.py +++ b/docs/conf.py @@ -46,7 +46,7 @@ extensions = [ 'sphinx.ext.autosummary', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', - 'nbsphinx_link', + 'nbsphinx', ] # Add any paths that contain templates here, relative to this directory. diff --git a/docs/source/fatigue_tools/fatigue.rst b/docs/fatigue.rst similarity index 94% rename from docs/source/fatigue_tools/fatigue.rst rename to docs/fatigue.rst index 9b2f2799..d9d96a16 100644 --- a/docs/source/fatigue_tools/fatigue.rst +++ b/docs/fatigue.rst @@ -10,4 +10,4 @@ notebook format. You can download the source notebook from the :caption: Fatigue tools :maxdepth: 2 - fatigue_nb \ No newline at end of file + notebooks/Fatigue \ No newline at end of file diff --git a/docs/source/hawc2/hawc2.rst b/docs/hawc2.rst similarity index 73% rename from docs/source/hawc2/hawc2.rst rename to docs/hawc2.rst index bbb579ee..8bfa1541 100644 --- a/docs/source/hawc2/hawc2.rst +++ b/docs/hawc2.rst @@ -9,6 +9,6 @@ notebook format. You can download the source notebooks from the .. toctree:: :caption: HAWC2 - InputFileWriting_nb - RunningSimulations_nb - RunningSimulationsJess_nb \ No newline at end of file + notebooks/hawc2/InputFileWriting + notebooks/hawc2/RunningSimulations + notebooks/hawc2/RunningSimulationsJess \ No newline at end of file diff --git a/docs/source/index.rst b/docs/index.rst similarity index 92% rename from docs/source/index.rst rename to docs/index.rst index b3c1c440..34de79b1 100644 --- a/docs/source/index.rst +++ b/docs/index.rst @@ -24,7 +24,7 @@ Contents: .. toctree:: installation - fatigue_tools/fatigue - hawc2/hawc2 + fatigue + hawc2 bladed/bladed2hawc diff --git a/docs/source/installation.rst b/docs/installation.rst similarity index 100% rename from docs/source/installation.rst rename to docs/installation.rst diff --git a/docs/make.bat b/docs/make.bat index 4d9eb83d..c1becfd1 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -7,7 +7,7 @@ REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) -set SOURCEDIR=source +set SOURCEDIR=. set BUILDDIR=build if "%1" == "" goto help diff --git a/notebooks/fatigue/Fatigue.ipynb b/docs/notebooks/Fatigue.ipynb similarity index 100% rename from notebooks/fatigue/Fatigue.ipynb rename to docs/notebooks/Fatigue.ipynb diff --git a/notebooks/hawc2/InputFileWriting.ipynb b/docs/notebooks/hawc2/InputFileWriting.ipynb similarity index 100% rename from notebooks/hawc2/InputFileWriting.ipynb rename to docs/notebooks/hawc2/InputFileWriting.ipynb diff --git a/notebooks/hawc2/RunningSimulations.ipynb b/docs/notebooks/hawc2/RunningSimulations.ipynb similarity index 100% rename from notebooks/hawc2/RunningSimulations.ipynb rename to docs/notebooks/hawc2/RunningSimulations.ipynb diff --git a/notebooks/hawc2/RunningSimulationsJess.ipynb b/docs/notebooks/hawc2/RunningSimulationsJess.ipynb similarity index 100% rename from notebooks/hawc2/RunningSimulationsJess.ipynb rename to docs/notebooks/hawc2/RunningSimulationsJess.ipynb diff --git a/docs/source/fatigue_tools/fatigue_nb.nblink b/docs/source/fatigue_tools/fatigue_nb.nblink deleted file mode 100644 index 1125cbfe..00000000 --- a/docs/source/fatigue_tools/fatigue_nb.nblink +++ /dev/null @@ -1,3 +0,0 @@ -{ - "path": "../../../notebooks/fatigue/Fatigue.ipynb" -} \ No newline at end of file diff --git a/docs/source/hawc2/InputFileWriting_nb.nblink b/docs/source/hawc2/InputFileWriting_nb.nblink deleted file mode 100644 index 4ccd43b6..00000000 --- a/docs/source/hawc2/InputFileWriting_nb.nblink +++ /dev/null @@ -1,3 +0,0 @@ -{ - "path": "../../../notebooks/hawc2/InputFileWriting.ipynb" -} \ No newline at end of file diff --git a/docs/source/hawc2/RunningSimulationsJess_nb.nblink b/docs/source/hawc2/RunningSimulationsJess_nb.nblink deleted file mode 100644 index 42789e02..00000000 --- a/docs/source/hawc2/RunningSimulationsJess_nb.nblink +++ /dev/null @@ -1,3 +0,0 @@ -{ - "path": "../../../notebooks/hawc2/RunningSimulationsJess.ipynb" -} \ No newline at end of file diff --git a/docs/source/hawc2/RunningSimulations_nb.nblink b/docs/source/hawc2/RunningSimulations_nb.nblink deleted file mode 100644 index e4ea927f..00000000 --- a/docs/source/hawc2/RunningSimulations_nb.nblink +++ /dev/null @@ -1,3 +0,0 @@ -{ - "path": "../../../notebooks/hawc2/RunningSimulations.ipynb" -} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 95e01699..3cf235fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.1.0" description = "The Wind Energy Toolbox (or wetb, pronounce as wee-tee-bee) is a collection of Python scripts that facilitate working with (potentially a lot) of HAWC2, HAWCStab2, FAST or other text input based simulation tools." authors = ["Your Name <you@example.com>"] license = "wetb is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL, http://www.gnu.org/copyleft/gpl.html) as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. wetb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details http://www.gnu.org/licenses/ We encourage you to submit new code for possible inclusion in future versions of wetb." -readme = "README.md" + [tool.poetry.dependencies] click = "^8.0.4" diff --git a/update_pyproject.py b/update_pyproject.py index 065a0ce4..3b1b5579 100644 --- a/update_pyproject.py +++ b/update_pyproject.py @@ -10,7 +10,7 @@ with open("README.md") as f: readme = f.read().split("\n# ") for section in readme: if section.startswith("Introduction"): - description = " ".join(section.split("\n")[1:]).lstrip().rstrip() + description = " ".join(section.split("\n")[1:]).lstrip().rstrip()[:512] # Getting the package version. repo = git.cmd.Git("./") diff --git a/wetb/hawc2/htc_file.py b/wetb/hawc2/htc_file.py index bedd72b2..4f972477 100644 --- a/wetb/hawc2/htc_file.py +++ b/wetb/hawc2/htc_file.py @@ -197,8 +197,8 @@ class HTCFile(HTCContents, HTCDefaults, HTCExtensions): """Saves the htc object to an htc file. Args: - filename (str, optional): Specifies the filename of the htc file to be saved. - If the value is none, the filename attribute of the object will be used as the filename. + filename (str, optional): Specifies the filename of the htc file to be saved. + If the value is none, the filename attribute of the object will be used as the filename. Defaults to None. """ self.contents # load if not loaded @@ -213,12 +213,12 @@ class HTCFile(HTCContents, HTCDefaults, HTCExtensions): fid.write(str(self)) def set_name(self, name, subfolder=''): - """Sets the base filename of the simulation files. + """Sets the base filename of the simulation files. Args: name (str): Specifies name of the log file, dat file (for animation), hdf5 file (for visualization) and htc file. - subfolder (str, optional): Specifies the name of a subfolder to place the files in. - If the value is an empty string, no subfolders will be created. + subfolder (str, optional): Specifies the name of a subfolder to place the files in. + If the value is an empty string, no subfolders will be created. Defaults to ''. Returns: @@ -306,6 +306,7 @@ class HTCFile(HTCContents, HTCDefaults, HTCExtensions): files.append(dll.filename[0]) f, ext = os.path.splitext(dll.filename[0]) files.append(f + "_64" + ext) + files.append(f + ".so") if 'wind' in self: files.append(self.wind.get('user_defined_shear', [None])[0]) files.append(self.wind.get('user_defined_shear_turbulence', [None])[0]) diff --git a/wetb/hawc2/tests/test_htc_file.py b/wetb/hawc2/tests/test_htc_file.py index 22bcca55..ed15b9f4 100644 --- a/wetb/hawc2/tests/test_htc_file.py +++ b/wetb/hawc2/tests/test_htc_file.py @@ -246,14 +246,19 @@ end turb_export;""" './data/DTU_10MW_RWT_pc.dat', './control/risoe_controller.dll', './control/risoe_controller_64.dll', + './control/risoe_controller.so', './control/generator_servo.dll', './control/generator_servo_64.dll', + './control/generator_servo.so', './control/mech_brake.dll', './control/mech_brake_64.dll', + './control/mech_brake.so', './control/servo_with_limits.dll', './control/servo_with_limits_64.dll', + './control/servo_with_limits.so', './control/towclearsens.dll', './control/towclearsens_64.dll', + './control/towclearsens.so', './data/user_shear.dat', self.testfilepath.replace("\\", "/") + 'test.htc' ]: -- GitLab