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 2464 additions and 186 deletions
# 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' {} \;
[metadata]
name = wetb
summary = Wind Energy Toolbox
author = DTU Wind Energy
author-email = mmpe@dtu.dk
license = GPLv3
home-page = https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox
description-file = README
# Add here all kinds of additional classifiers as defined under
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers = Development Status :: 4 - Beta,
Programming Language :: Python,
Programming Language :: Python :: 2.7,
Programming Language :: Python :: 3,
Programming Language :: Python :: 3.3,
Programming Language :: Python :: 3.4,
Programming Language :: Python :: 3.5,
Environment :: Console,
Intended Audience :: Education,
Intended Audience :: Science/Research,
License :: OSI Approved :: GPL License,
Operating System :: OS Independent,
Operating System :: POSIX :: Linux,
Operating System :: Unix,
Operating System :: MacOS,
Operating System :: Microsoft :: Windows
Topic :: Scientific/Engineering :: Mathematics
[entry_points]
# Add here console scripts like:
# console_scripts =
# hello_world = wetb.module:function
# as well as other entry_points.
[files]
# Add here 'data_files', 'packages' or 'namespace_packages'.
# Additional data files are defined as key value pairs of source and target:
packages =
wetb
# data_files =
# share/wetb_docs = docs/*
[extras]
# Add here additional requirements for extra features, like:
# PDF =
# ReportLab>=1.2
# RXP
#ALL =
# django
# cookiecutter
[test]
# py.test options when running `python setup.py test`
#addopts = tests
[tool:pytest]
# Options for py.test:
# Specify command line options as you would do when invoking py.test directly.
# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml
# in order to write a coverage file that can be read by Jenkins.
#addopts =
# --cov wetb --cov-report term-missing
# --verbose
python_files = WindEnergyToolbox/wetb/*
[aliases]
docs = build_sphinx
[bdist_wheel]
# Use this option if your package is pure-python
universal = 0
[build_sphinx]
# Options for Sphinx build
source_dir = docs
build_dir = docs/_build
[pbr]
# Let pbr run sphinx-apidoc
autodoc_tree_index_modules = True
# autodoc_tree_excludes = ...
# Let pbr itself generate the apidoc
# autodoc_index_modules = True
# autodoc_exclude_modules = ...
# Convert warnings to errors
# warnerrors = True
[devpi:upload]
# Options for the devpi: PyPI serer and packaging tool
# VCS export must be deactivated since we are using setuptools-scm
no-vcs = 1
formats = bdist_wheel
This diff is collapsed.
import numpy as np
npt = np.testing
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.