This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from OpenFAST/f/rename
- Loading branch information
Showing
377 changed files
with
10,572 additions
and
9,762 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Developer Notes | ||
|
||
|
||
|
||
## Release Steps | ||
Typically releases are done for each new version of OpenFAST | ||
|
||
1. Create a pull request from main to dev | ||
2. Make sure the input files in the `data` directory are compatible with the new OpenFAST version | ||
3. Change the file VERSION (and/or setup.py) and push to the pull request | ||
4. Merge pull request to main | ||
5. Tag the commit using `git tag -a vX.X.X` and push to remote: `git push --tags``. | ||
6. Upload to pypi and conda (see below) | ||
7. Merge main to dev | ||
|
||
|
||
## Upload a new version for pip | ||
Detailled steps are provided further below. | ||
|
||
### Summary | ||
Remember to change VERSION file and/or setup.py | ||
```bash | ||
python setup.py sdist | ||
twine upload dist/* # upload to pypi | ||
``` | ||
|
||
|
||
|
||
### (Step 0 : create an account on pypi) | ||
|
||
### Step 1: go to your repo | ||
Go to folder | ||
```bash | ||
cd path/to/python-toolbox | ||
``` | ||
|
||
### Step 2: change version in setup.py and tag it | ||
change VERSION in setup.py | ||
``` | ||
git add setup.py VERSION | ||
git commit "Version X.X.X" | ||
git tag -a | ||
``` | ||
|
||
### Step 3: Create a source distribution | ||
```bash | ||
python setup.py sdist | ||
``` | ||
|
||
### Step 4: Install twine | ||
```bash | ||
pip install twine | ||
``` | ||
|
||
### Step 5: Ubplot to pypi | ||
Run twine to upload to Pypi (will ask for username and password) | ||
```bash | ||
twine upload dist/* | ||
``` | ||
|
||
### After clone / first time | ||
Add `.gitconfig` to your path, to apply filters on jupyter notebooks | ||
```bash | ||
git config --local include.path ../.gitconfig | ||
``` | ||
|
||
|
||
|
||
## Upload a new version to Conda | ||
TODO TODO TODO | ||
|
||
conda-forge, | ||
make a pull request there. | ||
- setup build script (https://conda-forge.org/docs/maintainer/adding_pkgs.html). | ||
see e.g. FLORIS (https://github.com/conda-forge/floris-feedstock/blob/master/recipe/meta.yaml). | ||
- make a pull request to https://github.com/conda-forge/staged-recipes/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Initialize everything""" | ||
import os | ||
from openfast_toolbox.common import * | ||
# Make main io tools available | ||
from .io import read | ||
from .io.fast_input_file import FASTInputFile | ||
from .io.fast_output_file import FASTOutputFile | ||
from .io.fast_input_deck import FASTInputDeck | ||
|
||
# Add version to package | ||
with open(os.path.join(os.path.dirname(__file__), "..", "VERSION")) as fid: | ||
__version__ = fid.read().strip() | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
86 changes: 86 additions & 0 deletions
86
openfast_toolbox/aeroacoustics/examples/_plot_directivity.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import numpy as np | ||
import pandas as pd | ||
import matplotlib.pyplot as plt | ||
from parse import * | ||
import re, os, platform | ||
from openfast_toolbox.io.fast_output_file import FASTOutputFile | ||
|
||
######################################################################################################################################### | ||
## User inputs | ||
# Save plot and/or data? | ||
save_fig = False | ||
save_data = False | ||
fig_ext = '.png' | ||
|
||
# Number of revolutions (n) to average spectra | ||
n = 1 | ||
|
||
######################################################################################################################################### | ||
## Paths to files | ||
if platform.system() == 'Windows': | ||
FAST_directory = os.path.dirname( os.path.dirname( os.path.dirname( os.path.dirname( os.path.realpath(__file__) ) ) ) ) + os.sep + 'reg_tests' + os.sep + 'r-tests' + os.sep + 'glue-codes' + os.sep + 'openfast' + os.sep + 'IEA_LB_RWT-AeroAcoustics' | ||
else: | ||
FAST_directory = os.path.dirname( os.path.dirname( os.path.dirname( os.path.dirname( os.path.realpath(__file__) ) ) ) ) + os.sep + 'openfast' + os.sep + 'reg_tests' + os.sep + 'r-tests' + os.sep + 'glue-codes' + os.sep + 'openfast' + os.sep + 'IEA_LB_RWT-AeroAcoustics' | ||
AAfilename = FAST_directory + os.sep + 'IEA_LB_RWT-AeroAcoustics_1.out' | ||
OFfilename = FAST_directory + os.sep + 'IEA_LB_RWT-AeroAcoustics.out' | ||
locfilename = FAST_directory + os.sep + 'AA_ObserverLocations_Map.dat' | ||
output_dir = os.path.dirname( os.path.realpath(__file__) ) | ||
outputfilename = output_dir + os.sep + "data_output1" | ||
|
||
######################################################################################################################################### | ||
## Read in data, manipulate it, and plot it | ||
# reads in file data | ||
AA_1 = FASTOutputFile(AAfilename).toDataFrame() | ||
OF = FASTOutputFile(OFfilename).toDataFrame() | ||
location = pd.read_csv(locfilename,delimiter='\s+',skiprows=[0,1],names=['x','y','z']) | ||
|
||
# determine number of observers | ||
num_obs = AA_1.shape[1]-1 | ||
|
||
# calculate sample time for n revolutions | ||
rpm = OF[["RotSpeed_[rpm]"]].mean()[0] | ||
yaw = OF[["YawPzn_[deg]"]].mean()[0] / 180. * np.pi | ||
time_revs = n*60/rpm | ||
tot_time = AA_1["Time_[s]"].max() | ||
if time_revs < tot_time: | ||
sample_time = tot_time - time_revs | ||
else: | ||
print("Error: Time for number of revolutions exceeds simulation time. Reduce n.") | ||
raise SystemExit('') | ||
|
||
# slice AA dataframe for t > sample_time | ||
AA_1 = AA_1[AA_1["Time_[s]"] > sample_time] | ||
AA_1=AA_1.drop("Time_[s]",axis=1) | ||
|
||
# average P over rotor revolution | ||
AA_1 = AA_1.mean() | ||
|
||
# merge location info with SPL info | ||
AA_1=AA_1.reset_index() | ||
AA_1=AA_1.drop("index",axis=1) | ||
AA_1=pd.merge(location,AA_1,left_index=True,right_index=True) | ||
AA_1=AA_1.rename(index=str,columns={0:"SPL"}) | ||
|
||
# contour plot of SPL for each location | ||
if num_obs < 3: | ||
print("Error: Need at least 3 observers to generate contour.") | ||
else: | ||
x=AA_1['x']; | ||
y=AA_1['y']; | ||
z=AA_1['SPL']; | ||
fs = 10 | ||
fig,ax=plt.subplots() | ||
ax.set_aspect('equal') | ||
ax.set_xlabel('x [m]', fontsize=fs+2, fontweight='bold') | ||
ax.set_ylabel('y [m]', fontsize=fs+2, fontweight='bold') | ||
tcf=ax.tricontourf(x,y,z, range(58, 84, 1)) | ||
fig.colorbar(tcf,orientation="vertical").set_label(label = 'Overall SPL [dB]', fontsize=fs+2,weight='bold') | ||
if save_fig == True: | ||
fig_name = 'directivity_map' | ||
fig.savefig(output_dir + os.sep + fig_name + fig_ext) | ||
plt.show() | ||
|
||
# export to csv | ||
if save_data == True: | ||
AA_1.to_csv(r'{}-data.csv'.format(outputfilename)) | ||
|
Oops, something went wrong.