-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
72 lines (63 loc) · 2.45 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /usr/bin/env python
# System imports
from distutils.core import setup, Command, Extension
from distutils.command.build_py import build_py as _build_py
from distutils import sysconfig
from pip import __file__ as pip_loc
import os
import subprocess
# Third-party modules - we depend on numpy for everything
import numpy
# Obtain the numpy include directory. This logic works across numpy versions.
try:
numpy_include = numpy.get_include()
except AttributeError:
numpy_include = numpy.get_numpy_include()
install_to = os.path.join(os.path.split(os.path.split(pip_loc)[0])[0],
'pycosmo', 'templates')
class build_py(_build_py):
description = "Custom command that concatenates COSMO height files"
def run(self):
folder = './cosmo_query/cosmo_info/'
# Concatenate all partial COSMO files
for res in ['1','2','7']:
cmd = 'cat ' + folder + 'cosmo_' + res + '_heights_split_a* > ' \
+ folder + 'cosmo_' + res + '_heights.npz'
print(cmd)
subprocess.call(cmd, shell=True)
_build_py.run(self)
# interp1 extension module
_interp1_c = Extension("_interp1_c",
["./cosmo_query/c/interp1_c.i","./cosmo_query/c/interp1_c.c"],
include_dirs = [numpy_include],
)
_radar_interp_c = Extension("_radar_interp_c",
["./cosmo_query/c/radar_interp_c.i","./cosmo_query/c/radar_interp_c.c"],
include_dirs = [numpy_include],
)
# ezrange setup
setup( name = "cosmo_query",
cmdclass={'build_py': build_py},
description = "Tools for retrieving COSMO data from CSCS servers",
version = "1.0",
url='http://gitlab.epfl.ch/wolfensb/cosmo_query/',
author='Daniel Wolfensberger - LTE EPFL',
author_email='[email protected]',
license='GPL-3.0',
packages=['cosmo_query','cosmo_query/c'],
package_data = {'cosmo_query/c' : ['*.o','*.i','*.c'],
'cosmo_query':['./cosmo_info/list_vars/*','./cosmo_info/file_logs/*',
'./cosmo_info/*.npz']},
data_files = [(install_to, ["LICENSE"])],
include_package_data=True,
install_requires=[
'pyproj',
'numpy',
'scipy',
'netCDF4',
'paramiko',
'h5py'
],
zip_safe=False,
ext_modules = [_interp1_c,_radar_interp_c ]
)