Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • toolbox/WindEnergyToolbox
  • tlbl/WindEnergyToolbox
  • cpav/WindEnergyToolbox
  • frza/WindEnergyToolbox
  • borg/WindEnergyToolbox
  • mmpe/WindEnergyToolbox
  • ozgo/WindEnergyToolbox
  • dave/WindEnergyToolbox
  • mmir/WindEnergyToolbox
  • wluo/WindEnergyToolbox
  • welad/WindEnergyToolbox
  • chpav/WindEnergyToolbox
  • rink/WindEnergyToolbox
  • shfe/WindEnergyToolbox
  • shfe1/WindEnergyToolbox
  • acdi/WindEnergyToolbox
  • angl/WindEnergyToolbox
  • wliang/WindEnergyToolbox
  • mimc/WindEnergyToolbox
  • wtlib/WindEnergyToolbox
  • cmos/WindEnergyToolbox
  • fabpi/WindEnergyToolbox
22 results
Show changes
Showing
with 6057 additions and 167 deletions
......@@ -14,7 +14,7 @@ This tool comes handy in the following scenarios:
* different parameters variations are required, e.g. different wind speed range or different number of turbulent seed.
The generator of the cases uses an input spreadsheet where the cases are defined
in a more compact way.
in a more compact way.
The tool is based on the "tags" concept that is used for the generation of the htc files.
Main spreadsheet
......@@ -36,9 +36,9 @@ In each sheet the type of tag is defined in the line above the tag by typing one
Functions (F) tags
------------------
* Numbers can be converted to strings (for example when a tag refers to a file name)
* Numbers can be converted to strings (for example when a tag refers to a file name)
by using double quotes ```"``` for Functions (F):
* ```"wdir_[wdir]deg_wsp_[wsp]ms"``` will result in the tags ``` [wdir]```
* ```"wdir_[wdir]deg_wsp_[wsp]ms"``` will result in the tags ``` [wdir]```
and ```[wsp]``` being replaced with formatted text.
* following formatting rules are used:
* ```[wsp]```, ```[gridgustdelay]``` : ```02i```
......@@ -62,11 +62,11 @@ Generate the files
------------------
To generate the files defining the different DLC the following lines need to be executed:
export PATH=/home/python/miniconda3/bin:$PATH
source activate wetb_py3
python /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/GenerateDLCs.py --folder=DLCs
source activate py36-wetb
python /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/GenerateDLCs.py --folder=DLCs
the first two lines activate the virtual environment. The third calls the routine *GenerateDLCs.py * that generates the files.
The routine should be called from the folder *htc* where also the master spreadsheet *DLCs.xlsx* need to be located.
The generated files are placed in the folder *DLCs*.
......@@ -61,11 +61,11 @@ do this when the turbulence box size changes (e.g., if the rotor size changes)
or if you have a model that's never been simulated on mimer.
2. Determine your set ID code. There are two scenarios:
* No one else in your project has run simulations on mimer. In this case,
create a new set ID alpha code (e.g., "AA", "AB", etc.).
create a new set ID alpha code (e.g., "AA", "AB", etc.).
* Simulations for this project/turbine configuration already exist. In this
case, use a pre-existing set ID alpha code and add one to the most recent
Set ID (e.g., if "AB0008" exists, your new folder should be "AB0009").
Set ID (e.g., if "AB0008" exists, your new folder should be "AB0009").
##### 3. Add proper log files for your Set ID folder.
See the [house rules](docs/houserules-mimerhawc2sim.md) regarding log files.
......@@ -86,7 +86,7 @@ structure similar to this:
Your master htc file, stored in ```htc/_master/```, can take any desired naming
convention, but it must have ```_master_``` in the name or future scripts will
abort. ```htc/DLCs.xlsx``` is your master Excel file that will create the
abort. ```htc/DLCs.xlsx``` is your master Excel file that will create the
subordinate Excel files in the coming steps.
##### 5. Create your subordinate Excel files.
......@@ -94,7 +94,7 @@ From a terminal, change to your htc directory. Then run the following code:
```
$ export PATH=/home/python/miniconda3/bin:$PATH
$ source activate wetb_py3
$ source activate py36-wetb
$ python /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/GenerateDLCs.py --folder=DLCs
$ source deactivate
```
......@@ -125,7 +125,7 @@ $ launch.py -n 100 -p pbs_in/
```
There are many launch options available. You can read more about the options
and querying the cluster configurations/status/etc. on
and querying the cluster configurations/status/etc. on
[this page](docs/howto-make-dlcs.md), or you can use the ```launchy.py```
help function to print available launch options:
......@@ -135,7 +135,7 @@ $ launch.py --help
##### 8. Post-process results.
The wetb function ```qsub-wrap.py``` can not only generate htc files but also
The wetb function ```qsub-wrap.py``` can not only generate htc files but also
post-process results. For example, here is code to check the log files
and calculate the statistics, the AEP and the lifetime equivalent loads
(must be executed from the top-level Set ID folder):
......
HAWC2 tools
===========================
``wetb`` includes functions to help with the writing of HAWC2 input
files, also know as htc files. The documentation is in a Jupyter
notebook format. You can download the source notebooks from the
``wetb`` repository, under ``docs/source/hawc2``.
.. toctree::
:caption: HAWC2
notebooks/hawc2/InputFileWriting
notebooks/hawc2/RunningSimulations
notebooks/hawc2/RunningSimulationsJess
......@@ -15,7 +15,7 @@ DONE:
-->
> WARNING: these notes contain configuration settings that are specif to the
DTU Wind Energy cluster Gorm. Only follow this guide in another environment if
DTU Wind Energy cluster Jess. Only follow this guide in another environment if
you know what you are doing!
......@@ -41,7 +41,7 @@ result and log files with lower case file names, regardless of the user input.
Hence, in order to avoid possible ambiguities at all times, make sure that there
are no upper case symbols defined in the value of the following tags (as defined
in the Excel spreadsheets): ```[Case folder]```, ```[Case id.]```, and
```[Turb base name]```.
```[turb_base_name]```.
The system will always force the values of the tags to be lower case anyway, and
when working on Windows, this might cause some confusing and unexpected behavior.
......@@ -53,8 +53,8 @@ either let the system fill that in for you (by using the variable ```$USER```),
or explicitly user your user name instead. This user name is the same as your
DTU account name (or student account/number).
This document refers to commands to be entered in the terminal on Gorm when the
line starts with ```g-000 $```. The command that needs to be entered starts
This document refers to commands to be entered in the terminal on Jess when the
line starts with ```j-000 $```. The command that needs to be entered starts
after the ```$```.
......@@ -73,10 +73,7 @@ Connecting to the cluster
-------------------------
We provide here an overview of how to connect to the cluster, but general,
up-to-date information can be found in the [HPC documentation](https://docs.hpc.ait.dtu.dk)
or on the [Gorm wiki](http://gorm.risoe.dk/gormwiki). Note that the
information from the Gorm wiki will be migrated into the HPC documentation
over time.
up-to-date information can be found in the [HPC documentation](https://docs.hpc.ait.dtu.dk).
You connect to the cluster via an SSH terminal, and there are different SSH
terminals based on your operating system (see the platform-specific
......@@ -94,10 +91,10 @@ be downloaded from
Once you have installed PuTTY and placed the executable somewhere convenient
(e.g., the Desktop), double click on the executable. In the window that opens
up, enter/verify the following settings:
* Session > Host Name: gorm.risoe.dk
* Session > Host Name: jess.dtu.dk
* Session > Port: 22
* Session > Connection type: SSH
* Session > Saved Sessions: Gorm
* Session > Saved Sessions: Jess
* Connection > Data > Auto-login username: your DTU username
* Connection > Data > When username is not specified: Use system username
* Window > Colours > Select a colour to adjust > ANSI Blue: RGB = 85, 85, 255
......@@ -110,12 +107,12 @@ to be lighter and therefore easier to read when working in the terminal. Once
you have entered these options, click "Save" on the "Session" tab and close
the window.
With PuTTY configured, you can connect to Gorm by double-clicking the PuTTY
executable; then, in the window that opens select "Gorm" in "Saved Sessions",
With PuTTY configured, you can connect to Jess by double-clicking the PuTTY
executable; then, in the window that opens select "Jess" in "Saved Sessions",
click the "Load" button, and finally click the "Open" button. A terminal
window will open up. Type your DTU password in this new window when prompted
(your text will not appear in the window) and then hit the Enter key. You
should now be logged into Gorm.
should now be logged into Jess.
To close the PuTTY window, you can either hit the red "X" in the upper-right
corner of the window or type "exit" in the terminal and hit enter.
......@@ -133,11 +130,11 @@ terminals. To connect to the cluster, enter the following command into
the terminal:
```
ssh $USER@gorm.risoe.dk
ssh $USER@jess.dtu.dk
```
Enter your DTU password when prompted. This will give you terminal access
to the Gorm cluster.
to the Jess cluster.
Mounting the cluster discs
......@@ -145,7 +142,7 @@ Mounting the cluster discs
When doing the HAWC2 simulations, you will interact regularly with the cluster
file system and discs. Thus, it can be very useful to have two discs mounted
locally so you can easily access them: 1) your home directory on Gorm and 2)
locally so you can easily access them: 1) your home directory on Jess and 2)
the HAWC2 simulation folder on Mimer.
You need to be connected to the DTU network (either directly or via VPN) for
......@@ -167,17 +164,17 @@ $WIN_VERSION is your version number.
In Windows 7, you can map a network drive in the following steps:
1. Open a Windows Explorer window
2. Right-click on "Computer" and select "Map network drive"
3. Select any unused drive and type ```\\gorm.risoe.dk\$USER``` into the folder field,
replacing "$USER" with your DTU username (e.g., DTU user "ABCD" has a Gorm home
drive of ```\\gorm.risoe.dk\abcd```)
3. Select any unused drive and type ```\\Jess.dtu.dk\$USER``` into the folder field,
replacing "$USER" with your DTU username (e.g., DTU user "ABCD" has a Jess home
drive of ```\\Jess.dtu.dk\abcd```)
4. Check the "Reconnect at logon" box if you want to connect to this drive
every time you log into your computer (recommended)
5. Click the Finish button
6. Repeat Steps 1 through 5, replacing the Gorm home address in Step 3 with the
6. Repeat Steps 1 through 5, replacing the Jess home address in Step 3 with the
HAWC2 simulation folder address: ```\\mimer.risoe.dk\hawc2sim```
Note that by default Windows Explorer will hide some of the files you will need
edit. In order to show all files on your Gorm home drive, you need to un-hide
edit. In order to show all files on your Jess home drive, you need to un-hide
system files: Explorer > Organize > Folder and search options > "View" tab >
Hidden files and folders > "Show hidden files, folders, and drives".
......@@ -187,7 +184,7 @@ From Linux/Mac, you should be able to mount using either of the following
addresses:
```
//mimer.risoe.dk/hawc2sim
//gorm.risoe.dk/$USER
//jess.dtu.dk/$USER
```
You can use either ```sshfs``` or ```mount -t cifs``` to mount the discs.
......@@ -195,8 +192,8 @@ You can use either ```sshfs``` or ```mount -t cifs``` to mount the discs.
Preparation
-----------
Add the cluster-tools script to your system's PATH of you Gorm environment,
by editing the file ```.bash_profile``` file in your Gorm’s home directory
Add the cluster-tools script to your system's PATH of you Jess environment,
by editing the file ```.bash_profile``` file in your Jess’s home directory
(```/home/$USER/.bash_profile```), and add the following lines (add at the end,
or create a new file with this file name in case it doesn't exist):
......@@ -212,13 +209,13 @@ are much appreciated!)
> If you have been using an old version of this how-to, you might be pointing
to an earlier version of these tools/utils and any references containing
```cluster-tools``` or ```prepost``` should be removed
from your ```.bash_profile``` and/or ```.bashrc``` file on your gorm home drive.
from your ```.bash_profile``` and/or ```.bashrc``` file on your Jess home drive.
After modifying ```.bash_profile```, save and close it. Then, in the terminal,
run the command (or logout and in again to be safe):
```
g-000 $ source ~/.bash_profile
g-000 $ source ~/.bashrc
j-000 $ source ~/.bash_profile
j-000 $ source ~/.bashrc
```
You will also need to configure wine and place the HAWC2 executables in your
......@@ -226,7 +223,7 @@ local wine directory, which by default is assumed to be ```~/.wine32```, and
```pbsutils``` contains and automatic configuration script you can run:
```
g-000 $ /home/MET/repositories/toolbox/pbsutils/config-wine-hawc2.sh
j-000 $ /home/MET/repositories/toolbox/pbsutils/config-wine-hawc2.sh
```
If you need more information on what is going on, you can read a more detailed
......@@ -252,7 +249,7 @@ precedence over the ones placed in ```/home/$USER/wine_exe/win32```.
At this stage you can run HAWC2 as follows:
```
g-000 $ wine32 hawc2-latest htc/some-intput-file.htc
j-000 $ wine32 hawc2-latest htc/some-intput-file.htc
```
......@@ -263,7 +260,7 @@ When there is a new version of HAWC2, or when a new license manager is released,
you can update your local wine directory as follows:
```
g-000 $ rsync -au /home/MET/hawc2exe/win32 /home/$USER/wine_exe/win32 --progress
j-000 $ rsync -au /home/MET/hawc2exe/win32 /home/$USER/wine_exe/win32 --progress
```
The file ```hawc2-latest.exe``` will always be the latest HAWC2
......@@ -310,19 +307,19 @@ For example, in order to generate all the HAWC2 htc input files and the
corresponding ```*.p``` cluster launch files using this default DLB setup with:
```
g-000 $ cd /mnt/mimer/hawc2sim/demo/A0001 # folder where the hawc2 model is located
g-000 $ qsub-wrap.py -f /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/dlctemplate.py --prep
j-000 $ cd /mnt/mimer/hawc2sim/demo/A0001 # folder where the hawc2 model is located
j-000 $ qsub-wrap.py -f /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/dlctemplate.py --prep
```
You could consider adding ```dlctemplate.py``` into the turbine folder or in
the simulation set id folder for your convenience:
```
g-000 $ cd /mnt/mimer/hawc2sim/demo/
j-000 $ cd /mnt/mimer/hawc2sim/demo/
# copy the dlctemplate to your turbine model folder and rename to myturbine.py
g-000 $ cp /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/dlctemplate.py ./myturbine.py
g-000 $ cd A0001
g-000 $ qsub-wrap.py -f ../myturbine.py --prep
j-000 $ cp /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/dlctemplate.py ./myturbine.py
j-000 $ cd A0001
j-000 $ qsub-wrap.py -f ../myturbine.py --prep
```
......@@ -338,23 +335,23 @@ First activate the Anaconda Python environment by typing:
```bash
# add the Anaconda Python environment paths to the system PATH
g-000 $ export PATH=/home/python/miniconda3/bin:$PATH
j-000 $ export PATH=/home/python/miniconda3/bin:$PATH
# activate the custom python environment:
g-000 $ source activate wetb_py3
j-000 $ source activate py36-wetb
```
For example, launch the auto-generation of DLCs input files:
```
# folder where the HAWC2 model is located
g-000 $ cd /mnt/mimer/hawc2sim/demo/AA0001
j-000 $ cd /mnt/mimer/hawc2sim/demo/AA0001
# assuming myturbine.py is copy of dlctemplate.py and is placed one level up
g-000 $ python ../myturbine.py --prep
j-000 $ python ../myturbine.py --prep
```
Or start an interactive IPython shell:
```
g-000 $ ipython
j-000 $ ipython
```
Users should be aware that running computational heavy loads on the login node
......@@ -406,12 +403,12 @@ Required, and used for the PBS output and post-processing
Optional
* ```[turb_db_dir] = '../turb/'```
* ```[wake_dir] = False```
* ```[wake_db_dir] = False```
* ```[wake_base_name] = 'turb_'```
* ```[micro_dir] = False```
* ```[micro_db_dir] = False```
* ```[micro_base_name] = 'turb_'```
* ```[meander_dir] = False```
* ```[meand_db_dir] = False```
* ```[meand_base_name] = 'turb_'```
* ```[meander_db_dir] = False```
* ```[meander_base_name] = 'turb_'```
* ```[mooring_dir] = False```, all files and sub-folders copied to node
* ```[hydro_dir] = False```, all files and sub-folders copied to node
......@@ -464,19 +461,48 @@ turbulence boxes using the 64-bit version of the stand alone Mann turbulence
box generator. The appropriate input parameters are taken from the following
tags:
* ```[tu_model]```
* ```[Turb base name]```
* ```[MannAlfaEpsilon]```
* ```[MannL]```
* ```[MannGamma]```
* ```[seed]```
* ```[turb_nr_u]``` : number of grid points in the u direction
* ```[turb_nr_v]``` : number of grid points in the v direction
* ```[turb_nr_w]``` : number of grid points in the w direction
* ```[turb_dx]``` : grid spacing in meters in the u direction
* ```[turb_dy]``` : grid spacing in meters in the v direction
* ```[turb_dz]``` : grid spacing in meters in the w direction
* ```[high_freq_comp]```
* Atmospheric turbulence:
* ```[tu_model] = 1```
* ```[turb_base_name]```
* ```[MannAlfaEpsilon]```
* ```[MannL]```
* ```[MannGamma]```
* ```[seed]```
* ```[turb_nr_u]``` : number of grid points in the u direction
* ```[turb_nr_v]``` : number of grid points in the v direction
* ```[turb_nr_w]``` : number of grid points in the w direction
* ```[turb_dx]``` : grid spacing in meters in the u direction
* ```[turb_dy]``` : grid spacing in meters in the v direction
* ```[turb_dz]``` : grid spacing in meters in the w direction
* ```[high_freq_comp]```
* Micro turbulence for DWM:
* ```[micro_base_name]```
* ```[MannAlfaEpsilon_micro]```
* ```[MannL_micro]```
* ```[MannGamma_micro]```
* ```[seed_micro]```
* ```[turb_nr_u_micro]``` : number of grid points in the u direction
* ```[turb_nr_v_micro]``` : number of grid points in the v direction
* ```[turb_nr_w_micro]``` : number of grid points in the w direction
* ```[turb_dx_micro]``` : grid spacing in meters in the u direction
* ```[turb_dy_micro]``` : grid spacing in meters in the v direction
* ```[turb_dz_micro]``` : grid spacing in meters in the w direction
* ```[high_freq_comp_micro]```
* Meander turbulence for DWM
* ```[meander_base_name]```
* ```[MannAlfaEpsilon_meander]```
* ```[MannL_meander]```
* ```[MannGamma_meander]```
* ```[seed_meander]```
* ```[turb_nr_u_meander]``` : number of grid points in the u direction
* ```[turb_nr_v_meander]``` : number of grid points in the v direction
* ```[turb_nr_w_meander]``` : number of grid points in the w direction
* ```[turb_dx_meander]``` : grid spacing in meters in the u direction
* ```[turb_dy_meander]``` : grid spacing in meters in the v direction
* ```[turb_dz_meander]``` : grid spacing in meters in the w direction
* ```[high_freq_comp_meander]```
### Tags required for hydro file generation
......@@ -489,6 +515,11 @@ tags:
* ```[Hs]``` : see HAWC2 manual for options
* ```[Tp]``` : see HAWC2 manual for options
* ```[wave_seed]``` : see HAWC2 manual for options
* ```[wave_gamma]``` : see HAWC2 manual for options
* ```[wave_coef]``` : see HAWC2 manual for options
* ```[stretching]``` : see HAWC2 manual for options
* ```[embed_sf]``` : see HAWC2 manual for options, and look for how it is implemented
in [prepost.dlcsdefs.vartag_excel_stabcon(master)](wetb/prepost/dlcdefs.py).
And the corresponding section the htc master file:
......@@ -571,7 +602,7 @@ The ```launch.py``` script has various different options, and you can read about
them by using the help function (the output is included for your convenience):
```bash
g-000 $ launch.py --help
j-000 $ launch.py --help
Usage:
launch.py -n nr_cpus
......@@ -627,8 +658,8 @@ Then launch the actual jobs (each job is a ```*.p``` file in ```pbs_in```) using
100 cpu's:
```bash
g-000 $ cd /mnt/mimer/hawc2sim/demo/A0001
g-000 $ launch.py -n 100 -p pbs_in/
j-000 $ cd /mnt/mimer/hawc2sim/demo/A0001
j-000 $ launch.py -n 100 -p pbs_in/
```
If the launching process requires hours, and you have to close you SHH/PuTTY
......@@ -641,8 +672,8 @@ simple and light job. ```launch.py``` will remove all the users crontab jobs
at the end with ```crontab -r```.
```bash
g-000 $ cd /mnt/mimer/hawc2sim/demo/A0001
g-000 $ launch.py -n 100 -p pbs_in/ --crontab
j-000 $ cd /mnt/mimer/hawc2sim/demo/A0001
j-000 $ launch.py -n 100 -p pbs_in/ --crontab
```
......@@ -660,25 +691,25 @@ length of the queue, etc
Notice that the pbs output files in ```pbs_out``` are only created when the job
has ended (or failed). When you want to inspect a running job, you can ssh from
the Gorm login node to node that runs the job. First, find the job id by listing
the Jess login node to node that runs the job. First, find the job id by listing
all your current jobs (```qstat -u $USER```). The job id can be found in the
first column, and you only need to consider the number, not the domain name
attached to it. Now find the on which node it runs with (replace 123546 with the
relevant job id):
```
g-000 $ qstat -f 123456 | grep exec_host
j-000 $ qstat -f 123456 | grep exec_host
```
From here you login into the node as follows (replace g-078 with the relevant
From here you login into the node as follows (replace j-078 with the relevant
node):
```
g-000 $ ssh g-078
j-000 $ ssh j-078
```
And browse to the scratch directory which lands you in the root directory of
your running HAWC2 model (replace 123456 with the relevant job id):
```
g-000 $ cd /scratch/$USER/123456.g-000.risoe.dk
j-000 $ cd /scratch/$USER/123456.j-000.risoe.dk
```
You can find what HAWC2 (or whatever other executable you are running) is
......@@ -690,8 +721,6 @@ Or when watch what is happening at the end in real time
```
# on Jess:
tail -f /var/lib/torque/spool/JOBID.jess.dtu.dk.OU
# on Gorm:
tail -f /var/spool/pbs/spool/JOBID.g-000.risoe.dk.OU
```
......@@ -706,7 +735,7 @@ found in the ```pbs_in``` folder) of the failed cases to a new folder (for
example ```pbs_in_failed```). Now run ```launch.py``` again, but instead point
to the folder that contains the ```*.p``` files of the failed cases, for example:
```
g-000 $ launch.py -n 100 --node -p pbs_in_failed
j-000 $ launch.py -n 100 --node -p pbs_in_failed
```
2. Use the ```--cache``` option, and edit the PBS file list in the file
......@@ -718,7 +747,7 @@ job will be launched.
3. Each pbs file can be launched manually as follows:
```
g-000 $ qsub path/to/pbs_file.p
j-000 $ qsub path/to/pbs_file.p
```
Alternatively, one can use the following options in ```launch.py```:
......@@ -742,13 +771,13 @@ files, calculating the statistics, the AEP and the life time equivalent loads:
```
# myturbine.py (copy of dlctemplate.py) is assumed to be located one folder up
g-000 $ qsub-wrap.py -f ../myturbine.py --years=25 --neq=1e7 --stats --check_logs --fatigue
j-000 $ qsub-wrap.py -f ../myturbine.py --years=25 --neq=1e7 --stats --check_logs --fatigue
```
Other options for the original ```dlctemplate.py``` script:
```
(wetb_py3) [dave@jess]$ python dlctemplate.py --help
(py36-wetb) [dave@jess]$ python dlctemplate.py --help
usage: dlctemplate.py [-h] [--prep] [--check_logs]
[--pbs_failed_path PBS_FAILED_PATH] [--stats]
[--fatigue] [--AEP] [--csv] [--years YEARS]
......
Welcome to WETB
===========================================
*- The Wind Energy Toolbox of DTU*
This toolbox provides Python tools intended for use in the wind
community, and especially HAWC2 users. Please see the Installation
tab on the left to install the code and get started.
Source code repository (and issue tracker):
https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox
License:
GPLv3_
.. _GPLv3: https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/blob/master/LICENSE.txt
Contents:
.. toctree::
installation
fatigue
hawc2
bladed/bladed2hawc
......@@ -6,9 +6,9 @@
```
conda update --all
conda create -n wetb_py3 python=3.5
source activate wetb_py3
conda install setuptools_scm future h5py pytables pytest nose sphinx blosc psutil
conda create -n py36-wetb python=3.6
source activate py36-wetb
conda install setuptools_scm mock h5py pytables pytest nose sphinx blosc psutil
conda install scipy pandas matplotlib cython xlrd coverage xlwt openpyxl paramiko
conda install -c https://conda.anaconda.org/conda-forge pyscaffold pytest-cov
```
......@@ -17,9 +17,9 @@ conda install -c https://conda.anaconda.org/conda-forge pyscaffold pytest-cov
```
conda update --all
conda create -n wetb_py3 python=3.4
source activate wetb_py3
conda install setuptools_scm future h5py pytables pytest nose sphinx psutil
conda create -n py36-wetb python=3.6
source activate py36-wetb
conda install setuptools_scm mock h5py pytables pytest nose sphinx psutil
conda install scipy pandas matplotlib cython xlrd coverage xlwt openpyxl paramiko
conda install -c https://conda.anaconda.org/conda-forge pyscaffold pytest-cov
```
......
# Anaconda (Windows/Mac/Linux)
## Installation
......@@ -7,9 +5,9 @@
Install the necessary Python dependencies using the ```conda``` package manager:
```
>> conda install setuptools_scm future h5py pytables pytest pytest-cov nose sphinx blosc pbr paramiko
>> conda install setuptools_scm mock h5py pytables pytest pytest-cov nose sphinx blosc pbr paramiko
>> conda install scipy pandas matplotlib cython xlrd coverage xlwt openpyxl psutil
>> conda install -c conda-forge pyscaffold sshtunnel --no-deps
>> conda install -c conda-forge sshtunnel --no-deps
```
Now you can install ```wetb``` with ```pip``` (there is no ```conda``` package
......@@ -32,34 +30,12 @@ expclicitally tell ```pip``` to only install ```wetb``` and nothing more:
# Pip (Windows/Mac/Linux)
Do not use this procedure in conda environments. See above.
## Installation and update
```
>> pip install --upgrade wetb
```
# Works with Python 2 and Python 3
This module is tested for Python 2.7 and 3.4+ compatibility, and works on both
Windows and Linux. Testing for Mac is on the way, but in theory it should work.
Python 2 and 3 compatibility is achieved with a single code base with the help
of the Python module [future](http://python-future.org/index.html).
Switching to Python 3 is in general a very good idea especially since Python 3.5
was released. Some even dare to say it
[is like eating your vegetables](http://nothingbutsnark.svbtle.com/porting-to-python-3-is-like-eating-your-vegetables).
So if you are still on Python 2, we would recommend you to give Python 3 a try!
You can automatically convert your code from Python 2 to 3 using the
[2to3](https://docs.python.org/2/library/2to3.html) utility which is included
in Python 2.7 by default. You can also write code that is compatible with both
2 and 3 at the same time (you can find additional resources in
[issue 1](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/issues/1)).
# Note
This project has been set up using PyScaffold 2.5. For details and usage
information on PyScaffold see http://pyscaffold.readthedocs.org/.
.. _installation:
Installation
===========================
Normal user
--------------------------------
* Quick install::
pip install wetb
* Install a specific version on PyPI::
pip install wetb==0.0.21
* Update an installation to the most recent version::
pip install --upgrade wetb
* Install with dependencies needed by prepost
pip install wetb[prepost]
* Install with all dependencies
pip install wetb[all]
**NOTE**. Dependency conflicts can arise if you do not install
``wetb`` into a clean environment. In particular, your installation
might break if ``wetb`` is installed using ``pip``, and then later
packages are installed using ``conda``. (See more details at
`this article <https://www.anaconda.com/blog/using-pip-in-a-conda-environment>`_.
We therefore recommend that you install ``wetb`` in a clean
environment.
Advanced user
--------------------------------
Clone the repository and install a local editable copy::
git clone https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox.git
cd WindEnergyToolbox
pip install -e .[all]
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
%% Cell type:markdown id: tags:
# Running simulations
%% Cell type:markdown id: tags:
## Single simulation on local pc
%% Cell type:code id: tags:
``` python
from wetb import hawc2
from wetb.hawc2 import HTCFile
from wetb.hawc2.tests.test_files import tfp
```
%% Cell type:code id: tags:
``` python
hawc2_path = "HAWC2MB.exe" # make sure HAWC2MB.exe is on your path or specify the full path to HAWC2
```
%% Cell type:markdown id: tags:
Generate and save a HAWC2 input htc file for a short simulation
%% Cell type:code id: tags:
``` python
htc = HTCFile(tfp + "simulation_setup/DTU10MWRef6.0/htc/DTU_10MW_RWT.htc")
htc.simulation.time_stop = 1 # stop the simulation after 1 s
htc.save(tfp + 'simulation_setup/DTU10MWRef6.0/htc/tmp.htc')
```
%% Cell type:markdown id: tags:
Execute the simulation
%% Cell type:code id: tags:
``` python
stdout, log = htc.simulate(hawc2_path)
```
%% Cell type:code id: tags:
``` python
print(stdout)
```
%% Output
***********************************************************************
* Build information for HAWC2MB.exe (GIT)
* Intel, version 1900 , 20190206
* WINDOWS 32-bit
***********************************************************************
* GIT-TAG = 12.8.0
* BUILDER = mmpe
* COMPUTER_NAME = VINDRI-D17205
* BUILD_DATE = 30-01-2020
***********************************************************************
Logfile: ./log/dtu_10mw_rwt_ver4.log is open for log outputs
Basic DTU Wind Energy Controller (ver. 2.3 v0.1.dev69.17400ca) loaded ...
Gen. torque Servo (ver. 2.2 v0.1.dev15.eddfec3) loaded...
Mech brake (ver. 2.2 v0.1.dev14.9e614a3) loaded...
Pitch Servo (ver. 2.2 v0.1.dev15.eddfec3) loaded...
Using licence_manager.dll, version: unknown
License verified - OK
Opening main command file: htc\tmp.htc
Current directory is
c:\mmpe\programming\python\windenergytoolbox\wetb\hawc2\tests\test_files\simula
tion_setup\DTU10MWRef6.0
Continue on no convergence = true
%% Cell type:code id: tags:
``` python
print(log)
```
%% Output
***********************************************************************
* Build information for HAWC2MB.exe (GIT)
* Intel, version 1900 , 20190206
* WINDOWS 32-bit
***********************************************************************
* GIT-TAG = 12.8.0
* BUILDER = mmpe
* COMPUTER_NAME = VINDRI-D17205
* BUILD_DATE = 30-01-2020
***********************************************************************
________________________________________________________________________________________________________________________
Log file output
Time : 14:55:07
Date : 26:05.2020
________________________________________________________________________________________________________________________
Newmark commands read with succes
Simulation commands read with succes
Reading data of main body : tower
Succes opening ./data/dtu_10mw_rwt_tower_st.dat
timoschenko input commands read with succes
topologi_c2def_inputs read with succes
Topologi main body tower commands read with succes
Reading data of main body : towertop
Succes opening ./data/dtu_10mw_rwt_towertop_st.dat
timoschenko input commands read with succes
topologi_c2def_inputs read with succes
Topologi main body towertop commands read with succes
Reading data of main body : shaft
Succes opening ./data/dtu_10mw_rwt_shaft_st.dat
timoschenko input commands read with succes
topologi_c2def_inputs read with succes
Topologi main body shaft commands read with succes
Reading data of main body : hub1
Succes opening ./data/dtu_10mw_rwt_hub_st.dat
timoschenko input commands read with succes
topologi_c2def_inputs read with succes
Topologi main body hub1 commands read with succes
Reading data of main body : hub2
Topologi main body hub2 commands read with succes
Reading data of main body : hub3
Topologi main body hub3 commands read with succes
Reading data of main body : blade1
Succes opening ./data/dtu_10mw_rwt_blade_st.dat
timoschenko input commands read with succes
topologi_c2def_inputs read with succes
Topologi main body blade1 commands read with succes
Reading data of main body : blade2
Topologi main body blade2 commands read with succes
Reading data of main body : blade3
Topologi main body blade3 commands read with succes
Base orientation input commands read with succes
relative orientation input commands read with succes
relative orientation input commands read with succes
relative orientation input commands read with succes
relative orientation input commands read with succes
relative orientation input commands read with succes
relative orientation input commands read with succes
relative orientation input commands read with succes
relative orientation input commands read with succes
Orientation input commands read with succes
Fix0 constraint input commands read with succes
Fix1 constraint input commands read with succes
Bearing1 constraint input commands read with succes
Fix1 constraint input commands read with succes
Fix1 constraint input commands read with succes
Fix1 constraint input commands read with succes
bearing2 constraint input commands read with succes
bearing2 constraint input commands read with succes
bearing2 constraint input commands read with succes
constraint input commands read with succes
Topologi commands read with succes
Tower shadow (potential2 flow) commands read with succes
Wind commands read with succes
aerodrag element commands read with succes
aerodrag element commands read with succes
Aerodrag commands read with succes
Aerodynamic commands read with succes
output commands read with succes
Output commands read
Dll type2 input commands read with succes
output commands read with succes
Output commands read
Actions commands read
Dll type2 input commands read with succes
output commands read with succes
Output commands read
Actions commands read
Dll type2 input commands read with succes
output commands read with succes
Output commands read
Actions commands read
Dll type2 input commands read with succes
output commands read with succes
Output commands read
Dll type2 input commands read with succes
DLL commands read with succes
output commands read with succes
Output commands read
output_at read with succes
Initialization of structure
Initializing of aero rotor...
Initialization of rotor aerodynamics
Succes opening ./data/dtu_10mw_rwt_ae.dat
Succes opening ./data/dtu_10mw_rwt_pc.dat
Initialization of rotor induction
Initialization of wind
Initialization of external type2 DLL
External DLL ./control/dtu_we_controller.dll is attempted to open
Using ./control/dtu_we_controller.dll, version: unknown
Succes opening external DLL ./control/dtu_we_controller.dll
DLL subroutine init init_regulation is called
In initialization call of ./control/dtu_we_controller.dll Output is
0.000000000000000E+000
*** INFO *** The DLL subroutine message could not be loaded - bypassed!
Initialization of external type2 DLL
External DLL ./control/generator_servo.dll is attempted to open
Using ./control/generator_servo.dll, version: unknown
Succes opening external DLL ./control/generator_servo.dll
DLL subroutine init init_generator_servo is called
In initialization call of ./control/generator_servo.dll Output is
0.000000000000000E+000
*** INFO *** The DLL subroutine message could not be loaded - bypassed!
Initialization of external type2 DLL
External DLL ./control/mech_brake.dll is attempted to open
Using ./control/mech_brake.dll, version: unknown
Succes opening external DLL ./control/mech_brake.dll
DLL subroutine init init_mech_brake is called
In initialization call of ./control/mech_brake.dll Output is
0.000000000000000E+000
*** INFO *** The DLL subroutine message could not be loaded - bypassed!
Initialization of external type2 DLL
External DLL ./control/servo_with_limits.dll is attempted to open
Using ./control/servo_with_limits.dll, version: unknown
Succes opening external DLL ./control/servo_with_limits.dll
DLL subroutine init init_servo_with_limits is called
In initialization call of ./control/servo_with_limits.dll Output is
0.000000000000000E+000
*** INFO *** The DLL subroutine message could not be loaded - bypassed!
Initialization of external type2 DLL
External DLL ./control/towclearsens.dll is attempted to open
Using ./control/towclearsens.dll, version: unknown
Succes opening external DLL ./control/towclearsens.dll
DLL subroutine init initialize is called
In initialization call of ./control/towclearsens.dll Output is
2.66000000000000
*** INFO *** The DLL subroutine message could not be loaded - bypassed!
Creating link between structure and aerodynamics
Creating link between structure and aerodrag
Initialization of Aerodrag
Starting simulation
Dynamic stall method: 2 used for entire rotor
Global time = 2.000000000000000E-002 Iter = 2
Global time = 4.000000000000000E-002 Iter = 2
Global time = 6.000000000000000E-002 Iter = 2
Global time = 8.000000000000000E-002 Iter = 2
Global time = 0.100000000000000 Iter = 2
Global time = 0.120000000000000 Iter = 2
Global time = 0.140000000000000 Iter = 2
Global time = 0.160000000000000 Iter = 2
Global time = 0.180000000000000 Iter = 2
Global time = 0.200000000000000 Iter = 2
Global time = 0.220000000000000 Iter = 2
Global time = 0.240000000000000 Iter = 2
Global time = 0.260000000000000 Iter = 2
Global time = 0.280000000000000 Iter = 3
Global time = 0.300000000000000 Iter = 3
Global time = 0.320000000000000 Iter = 3
Global time = 0.340000000000000 Iter = 3
Global time = 0.360000000000000 Iter = 3
Global time = 0.380000000000000 Iter = 3
Global time = 0.400000000000000 Iter = 3
Global time = 0.420000000000000 Iter = 3
Global time = 0.440000000000000 Iter = 3
Global time = 0.460000000000000 Iter = 3
Global time = 0.480000000000000 Iter = 3
Global time = 0.500000000000000 Iter = 3
Global time = 0.520000000000000 Iter = 3
Global time = 0.540000000000000 Iter = 2
Global time = 0.560000000000000 Iter = 3
Global time = 0.580000000000000 Iter = 3
Global time = 0.600000000000000 Iter = 3
Global time = 0.620000000000000 Iter = 3
Global time = 0.640000000000000 Iter = 3
Global time = 0.660000000000000 Iter = 3
Global time = 0.680000000000000 Iter = 3
Global time = 0.700000000000000 Iter = 3
Global time = 0.720000000000000 Iter = 3
Global time = 0.740000000000000 Iter = 2
Global time = 0.760000000000000 Iter = 3
Global time = 0.780000000000000 Iter = 3
Global time = 0.800000000000000 Iter = 2
Global time = 0.820000000000000 Iter = 2
Global time = 0.840000000000000 Iter = 3
Global time = 0.860000000000000 Iter = 2
Global time = 0.880000000000000 Iter = 2
Global time = 0.900000000000000 Iter = 3
Global time = 0.920000000000000 Iter = 3
Global time = 0.940000000000000 Iter = 2
Global time = 0.960000000000000 Iter = 2
Global time = 0.980000000000000 Iter = 2
Global time = 1.00000000000000 Iter = 3
Closing of external type2 DLL
Closing of external type2 DLL
Closing of external type2 DLL
Closing of external type2 DLL
Closing of external type2 DLL
Elapsed time : 0.9218750
%% Cell type:code id: tags:
``` python
```
This diff is collapsed.
# Tutorial 2: Creating subordinate Excel files
The Wind Energy Toolbox has a workflow for automatically running design load
The Wind Energy Toolbox has a workflow for automatically running design load
bases (DLBs) on Gorm.
This workflow has the following steps:
1. [Create a master Excel sheet defining each case in the DLB](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/blob/master/docs/tutorials/1-creating-master-excel.md)
2. Create subordinate Excel sheets from each tab in the master Excel sheet
3. [Create htc files and PBS job scripts for each requisite simulation using
3. [Create htc files and PBS job scripts for each requisite simulation using
the subordinate Excel files and a master htc file.](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/blob/master/docs/tutorials/3-creating-htc-pbs-files.md)
4. Submit all PBS job scripts to the cluster
5. Post-process results
......@@ -13,7 +13,7 @@ the subordinate Excel files and a master htc file.](https://gitlab.windenergy.dt
This tutorial presents how to accomplish Step 2.
Note that it is possible to customize your simulations by skipping/modifying
Note that it is possible to customize your simulations by skipping/modifying
steps.
Such a procedure will be discussed in a later tutorial.
......@@ -22,44 +22,44 @@ https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/issues).
## 1. Background: Subordinate Excel Files
The subordinate Excel files are a series of basic Excel files that are
generated from the master Excel file. (See our tutorial on generating the
The subordinate Excel files are a series of basic Excel files that are
generated from the master Excel file. (See our tutorial on generating the
master Excel file [here]( https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/blob/master/docs/tut orials/1-creating-master-excel.md).)
There is a different subordinate Excel file for every tab in the master Excel
file, except for the "Main" tab, one for each case to simulate (e.g., design
There is a different subordinate Excel file for every tab in the master Excel
file, except for the "Main" tab, one for each case to simulate (e.g., design
load case 1.2 from IEC-61400-1).
Each subordinate Excel file has a single tab that lists the different tag
values for the htc master file in the column, and each row corresponds to a
Each subordinate Excel file has a single tab that lists the different tag
values for the htc master file in the column, and each row corresponds to a
different htc file to be generated.
The generation of the htc files from the subordinate Excel files is discused
The generation of the htc files from the subordinate Excel files is discused
in the next tutorial.
## 2. Tutorial
The generation of the subordinate Excel files is done using the
The generation of the subordinate Excel files is done using the
[GenerateDLS.py](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/blob/master/wetb/prepost/GenerateDLCs.py)
function in the Wind Energy Toolbox.
On Gorm, the command can be executed from the htc directory with the master
On Gorm, the command can be executed from the htc directory with the master
Excel file as follows:
```
export PATH=/home/python/miniconda3/bin:$PATH
source activate wetb_py3
source activate py36-wetb
python /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/GenerateDLCs.py [--folder=$FOLDER_NAME] [--master=$MASTER_NAME]
source deactivate
```
The ```export PATH``` command adds the miniconda bin directory to the path,
The ```export PATH``` command adds the miniconda bin directory to the path,
which is necessary for the toolbox.
The ```source activate wetb_py3``` and ```source deactivate``` are
The ```source activate py36-wetb``` and ```source deactivate``` are
Gorm-specific commands to activate the Wind Energy Toolbox Python environment.
The ```--folder``` and ```--master``` flags are optional flags to specify,
respectively, the name of the folder to which the subordinate Excel files
The ```--folder``` and ```--master``` flags are optional flags to specify,
respectively, the name of the folder to which the subordinate Excel files
should be written to and the name of the master Excel file.
The default values for these two options are './' (i.e., the current
The default values for these two options are './' (i.e., the current
directory) and 'DLCs.xlsx', respectively.
After running the commands in the above box on Gorm, you should see a folder in
After running the commands in the above box on Gorm, you should see a folder in
your htc directory with all of your subordinate Excel files.
......
# Tutorial 3: Creating htc and PBS files
The Wind Energy Toolbox has a workflow for automatically running design load
The Wind Energy Toolbox has a workflow for automatically running design load
bases (DLBs) on Gorm.
This workflow has the following steps:
1. [Create a master Excel sheet defining each case in the DLB](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/blob/master/docs/tutorials/1-creating-master-excel.md)
2. [Create subordinate Excel sheets from each tab in the master Excel sheet](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/blob/master/docs/tutorials/2-creating-subordinate-excels.md)
3. Create htc files and PBS job scripts for each requisite simulation using
3. Create htc files and PBS job scripts for each requisite simulation using
the subordinate Excel files and a master htc file.
4. Submit all PBS job scripts to the cluster
5. Post-process results
......@@ -13,7 +13,7 @@ the subordinate Excel files and a master htc file.
This tutorial presents how to accomplish Step 3.
Note that it is possible to customize your simulations by skipping/modifying
Note that it is possible to customize your simulations by skipping/modifying
steps.
Such a procedure will be discussed in a later tutorial.
......@@ -23,16 +23,16 @@ https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/issues).
## 1. Background: htc and PBS file creation
The main function used in this tutorial is [dlctemplate.py](https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox/blob/master/wetb/prepost/dlctemplate.py),
which creates all htc and PBS job scripts for the cases specified in the
which creates all htc and PBS job scripts for the cases specified in the
subordinate Excel file folder.
The htc files are the main input files for HAWC2 simulations.
They are created by copying the master htc file in the ```_master/``` folder in
your htc directory and replacing all of the tags with the values specified in
They are created by copying the master htc file in the ```_master/``` folder in
your htc directory and replacing all of the tags with the values specified in
the subordinate Excel files.
All of htc files for a single case are saved in a case-specific folder in your
All of htc files for a single case are saved in a case-specific folder in your
htc folder.
Thus, if you were running a standard DLB calculation for IEC 61400-1, your
Thus, if you were running a standard DLB calculation for IEC 61400-1, your
folder structure after generating your htc files might look like this:
```
|-- $TURB_NAME/
......@@ -50,9 +50,9 @@ folder structure after generating your htc files might look like this:
| | | |-- ...
```
The PBS job scripts are a series of text files that are used to tell the job
The PBS job scripts are a series of text files that are used to tell the job
scheduler on the high-performance computing (HPC) cluster how to run each job.
These files end with ".p", and are saved to a folder ```pbs_in/``` that is
These files end with ".p", and are saved to a folder ```pbs_in/``` that is
created in the main set ID folder on Gorm.
......@@ -61,29 +61,29 @@ created in the main set ID folder on Gorm.
There are two ways to call ```dlctemplate.py```.
The first is to call the function directly.
The second is to wrap it in a job scheduler to submit the job to the HPC cluster.
The first option is fine if you have only a few htc files or if the job
The first option is fine if you have only a few htc files or if the job
scheduler is not working for some reason.
The second option is generally preferred.
### 2.1 Directly generate htc files
The htc and PBS files can be directly generated by running the following
The htc and PBS files can be directly generated by running the following
commands from the set ID directory:
```
export PATH=/home/python/miniconda3/bin:$PATH
source activate wetb_py3
source activate py36-wetb
python /home/MET/repositories/toolbox/WindEnergyToolbox/wetb/prepost/dlctemplate.py --prep
source deactivate
```
The ```export PATH``` command adds the miniconda bin directory to the path,
The ```export PATH``` command adds the miniconda bin directory to the path,
which is necessary for the toolbox.
The ```source activate wetb_py3``` and ```source deactivate``` are
The ```source activate py36-wetb``` and ```source deactivate``` are
Gorm-specific commands to activate the Wind Energy Toolbox Python environment.
The ```--prep``` option tells the script to run in preparation mode, in which
The ```--prep``` option tells the script to run in preparation mode, in which
case it creates the htc and pbs files.
After running the commands in the above box on Gorm, you should have all of your
After running the commands in the above box on Gorm, you should have all of your
PBS input files in ```pbs_in/``` and all of your htc files in ```htc```.
### 2.2 Generate files using job scheduler
......
# Update conda ```wetb_py3``` environment and ```wetb```
# Update conda ```py36-wetb``` environment and ```wetb```
There are pre-configured miniconda/anaconda python environments installed on
Gorm and Jess at:
```
/home/python/miniconda3/envs/wetb_py3
/home/python/miniconda3/envs/py36-wetb
```
Note that these refer to the home drives of Gorm and Jess respectively and thus
refer to two different directories (but are named the same).
......@@ -15,20 +15,20 @@ Update the root Anaconda environment:
conda update --all
```
Activate the ```wetb_py3``` environment:
Activate the ```py36-wetb``` environment:
```
source activate wetb_py3
source activate py36-wetb
```
Update the ```wetb_py3``` environment:
Update the ```py36-wetb``` environment:
```
conda update --all
```
Pull latest wetb changes and create re-distributable binary wheel package for ```wetb_py3```:
Pull latest wetb changes and create re-distributable binary wheel package for ```py36-wetb```:
```
cd /home/MET/repositories/tooblox/WindEnergyToolbox
......@@ -45,5 +45,5 @@ pip install --no-deps -U dist/wetb-X.Y.Z.post0.devXXXXXXXX-cp35m-linux_x86_64.wh
The option ```--no-deps``` is used here to avoid pip installing possible newer
versions of packages that should be managed by conda. This only works when all
dependencies of ```wetb``` are met (which is assumed by default for the
```wetb_py3``` environment).
```py36-wetb``` environment).
'''
Created on 28. jul. 2017
@author: mmpe
'''
import os
import subprocess
def _run_git_cmd(cmd, git_repo_path=None):
git_repo_path = git_repo_path or os.getcwd()
if not os.path.isdir(os.path.join(git_repo_path, ".git")):
raise Warning("'%s' does not appear to be a Git repository." % git_repo_path)
try:
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
cwd=os.path.abspath(git_repo_path))
stdout,stderr = process.communicate()
if process.returncode != 0:
raise EnvironmentError("%s\n%s"%(stdout, stderr))
return stdout.strip()
except EnvironmentError as e:
raise e
raise Warning("unable to run git")
def get_git_branch(git_repo_path=None):
cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
return _run_git_cmd(cmd, git_repo_path)
def get_git_version(git_repo_path=None):
cmd = ["git", "describe", "--tags", "--dirty", "--always"]
# format it will return: 'v0.1.0-12-g22668f0'
v = _run_git_cmd(cmd, git_repo_path)
# convert to something Pypi likes: 0.1.2.dev3.123456
# see also https://setuptools.pypa.io/en/latest/userguide/distribution.html
# and/or PEP440 https://peps.python.org/pep-0440/
v = v.replace('-', '.post', 1)
return v
def get_tag(git_repo_path=None, verbose=False):
tag = _run_git_cmd(['git', 'describe', '--tags', '--always', '--abbrev=0'],
git_repo_path)
if verbose:
print(tag)
return tag
def set_tag(tag, push, git_repo_path=None):
_run_git_cmd(["git", "tag", tag], git_repo_path)
if push:
_run_git_cmd(["git", "push"], git_repo_path)
_run_git_cmd(["git", "push", "--tags"], git_repo_path)
def update_git_version(version_module, git_repo_path=None):
"""Update <version_module>.__version__ to git version"""
version_str = get_git_version(git_repo_path)
assert os.path.isfile(version_module.__file__)
with open(version_module.__file__, "w") as fid:
fid.write("__version__ = '%s'" % version_str)
# ensure file is written, closed and ready
with open(version_module.__file__) as fid:
fid.read()
return version_str
def write_vers(vers_file='wetb/__init__.py', repo=None, skip_chars=1):
"""Writes out version string as follows:
"last tag"-("nr commits since tag")-("branch name")-("hash commit")
and where nr of commits since last tag is only included if >0,
branch name is only inlcuded when not on master,
and hash commit is only included when not at a tag (when nr of commits > 0)
"""
if not repo:
repo = os.getcwd()
version_long = get_git_version(repo)
branch = get_git_branch(repo)
verel = version_long.split('-')
# tag name
version = verel[0][skip_chars:]
# number of commits since last tag, only if >0
nr_commits = 0
if len(verel) > 1:
try:
nr_commits = int(verel[1])
except ValueError:
nr_commits = -1
if nr_commits > 0:
version += '-' + verel[1]
# branch name, only when NOT on master
if branch != 'master':
version += '-' + branch
# hash commit, only if not at tag
if len(verel) > 2 and nr_commits > 0:
# first character on the hash is always a g (not part of the hash)
version += '-' + verel[2][1:]
# if "-HEAD" is added to the version, which pypi does not like:
if version.endswith('-HEAD'):
version = version[:-5]
print(version_long)
print('Writing version: {} in {}'.format(version, vers_file))
with open(vers_file, 'r') as f:
lines = f.readlines()
for n, l in enumerate(lines):
if l.startswith('__version__'):
lines[n] = "__version__ = '{}'\n".format(version)
for n, l in enumerate(lines):
if l.startswith('__release__'):
lines[n] = "__release__ = '{}'\n".format(version)
with open(vers_file, 'w') as f:
f.write(''.join(lines))
return version
def rename_dist_file():
for f in os.listdir('dist'):
if f.endswith('whl'):
split = f.split('linux')
new_name = 'manylinux1'.join(split)
old_path = os.path.join('dist', f)
new_path = os.path.join('dist', new_name)
os.rename(old_path, new_path)
def main():
"""Example of how to run (pytest-friendly)"""
if __name__ == '__main__':
pass
main()
File added
[build-system]
requires = [
"setuptools>=60",
"setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"
[project]
name = "wetb"
authors = [{name="DTU Wind and Energy Systems"}]
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."
dependencies = [
'certifi',
'click',
'Cython',
'h5py',
'Jinja2',
'lxml',
'matplotlib',
'pillow',
'mock',
'numpy',
'numba',
'openpyxl',
'pandas',
'paramiko',
'psutil',
'pytest',
'pytest-cov',
'scipy',
'sshtunnel',
'tables',
'tqdm',
'xarray',
'xlwt',
'XlsxWriter',
]
license = {text = "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."}
dynamic = ["version"]
[project.urls]
repository = "https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox"
documentation = "https://toolbox.pages.windenergy.dtu.dk/WindEnergyToolbox/"
[project.optional-dependencies]
prepost = ["openpyxl", "tables", "xlwt", "Cython"]
all = ["openpyxl", "tables", "xlwt", "Cython", "paramiko", "sshtunnel", 'pytest', 'mock', 'click']
[tool.setuptools_scm]
version_scheme = "no-guess-dev"
[tool.setuptools]
packages = ["wetb"]
#!/bin/bash
find ./ -type f -iname "*.py" -exec sed -i '/from __future__ import print_function/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from __future__ import division/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from __future__ import unicode_literals/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from __future__ import absolute_import/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from io import open/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import object/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import map/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import chr/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import dict/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import super/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import zip/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import range/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import str/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from builtins import int/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/from future import standard_library/d' {} \;
find ./ -type f -iname "*.py" -exec sed -i '/standard_library.install_aliases()/d' {} \;