Skip to content

Commit 40e97d1

Browse files
committed
Merge branch 'develop' of https://github.com/rstoneback/pysatCDF into fortran_cdf
2 parents 256e6f2 + a81a48b commit 40e97d1

File tree

3 files changed

+12
-78
lines changed

3 files changed

+12
-78
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ before_install:
2929
- conda info -a
3030

3131
# Replace dep1 dep2 ... with your dependencies
32-
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION atlas numpy scipy matplotlib nose pandas statsmodels coverage
32+
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib nose pandas statsmodels coverage
3333

3434
# command to install dependencies
3535
install:
@@ -39,6 +39,7 @@ install:
3939
- pip install coveralls
4040
- pip install pysat
4141
- "python setup.py develop"
42+
- pip install netCDF4
4243
# command to run tests
4344
script:
4445
#- nosetests

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pysatCDF
2-
[![Build Status](https://travis-ci.org/rstoneback/pysatCDF.svg?branch=master)](https://travis-ci.org/rstoneback/pysatCDF)
3-
[![Coverage Status](https://coveralls.io/repos/github/rstoneback/pysatCDF/badge.svg?branch=master)](https://coveralls.io/github/rstoneback/pysatCDF?branch=master)
2+
[![Build Status](https://travis-ci.org/pysat/pysatCDF.svg?branch=master)](https://travis-ci.org/pysat/pysatCDF)
3+
[![Coverage Status](https://coveralls.io/repos/github/pysat/pysatCDF/badge.svg?branch=master)](https://coveralls.io/github/pysat/pysatCDF?branch=master)
44
[![DOI](https://zenodo.org/badge/51764432.svg)](https://zenodo.org/badge/latestdoi/51764432)
55

66
Self-contained Python reader for NASA CDF file format

setup.py

Lines changed: 8 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
# leave to None to install CDF library
2222
# system will look for installed packed before installing a pysatCDF specific CDF install
2323
base_cdf = None
24+
build_cdf_flag = True
2425

25-
# leave items below to None unless base_cdf set to something other than None
26-
26+
# leave items below to None
2727
# name of library, e.g. for mac os x, libcdf.a
2828
lib_name = None
2929
# shared library name, needed for some systems ( do not use Mac OS X)
3030
shared_lib_name = None
31-
3231
# CDF compile options
3332
# note that the shared library name will be appended to extra_link_args automatically
3433
extra_link_args = None
@@ -42,49 +41,6 @@
4241
# some solutions in creating this file come from
4342
# https://github.com/Turbo87/py-xcsoar/blob/master/setup.py
4443

45-
# code to find if a CDF library is already installed in default locations
46-
47-
48-
def find_CDF_base(lib_name):
49-
# try environment variables
50-
cdf_base = os.getenv('CDF_BASE')
51-
if cdf_base is not None:
52-
# check
53-
if os.path.exists(cdf_base):
54-
return cdf_base
55-
56-
# that didn't work
57-
# look in default locations
58-
platform = sys.platform
59-
user_dir = os.path.expanduser('~')
60-
if platform == 'darwin':
61-
defaults = ['/Applications/', user_dir]
62-
elif (platform == 'linux') | (platform == 'linux2'):
63-
defaults = ['/usr/local/', user_dir]
64-
elif platform == 'win32':
65-
# Don't use NASA binaries on windows, not compatible
66-
defaults = ['C:/CDF_Distribution/']
67-
else:
68-
raise ValueError('Unknown platform, set CDF library in setup.py.')
69-
70-
# collect a list of posible directories to search in
71-
# grab all dirs, select those that start with cdf
72-
search_dir = []
73-
for default in defaults:
74-
sub_dirs = os.listdir(default)
75-
for sub in sub_dirs:
76-
# print(sub)
77-
if sub[0:3].lower() == 'cdf':
78-
search_dir.append(sub)
79-
search_dir = np.sort(search_dir)
80-
for test_dir in search_dir[::-1]:
81-
test_path = os.path.join(default, test_dir, 'lib', lib_name)
82-
if os.path.exists(test_path):
83-
return os.path.join(default, test_dir)
84-
85-
raise ValueError('Could not find CDF library, please set base directory in setup.py.')
86-
87-
8844
# get system parameters
8945
platform = sys.platform
9046
if platform == 'darwin':
@@ -112,35 +68,12 @@ def find_CDF_base(lib_name):
11268
or (env_name is None) or (extra_link_args is None))):
11369
raise ValueError('Unknown platform, please set setup.py parameters manually.')
11470

115-
# CDF directory hasn't been specified by user, see if an installation can be found
116-
# Use of system CDF libraries disabled for compatibility reasons
117-
# if base_cdf is None:
118-
if False:
119-
try:
120-
base_cdf = find_CDF_base(lib_name)
121-
print(' '.join(('Found CDF installation at', base_cdf)))
122-
except ValueError:
123-
print('Unable to find CDF installation in default location.')
124-
base_cdf = None
125-
126-
# Use of system CDF libraries disabled for compatibility reasons
127-
# if base_cdf is None:
128-
if True:
129-
build_cdf_flag = True
130-
# library not provided, build library included with pysatCDF
131-
else:
132-
build_cdf_flag = False
133-
# raise NotImplementedError
134-
if not os.path.isdir(base_cdf):
135-
raise ValueError('CDF directory supplied is not an actual directory.')
136-
if (lib_name is None):
137-
raise ValueError('Attempting to use pre-installed CDF library as directed.'
138-
'Please set setup.py parameters manually.')
13971

14072

14173
BASEPATH = os.path.dirname(os.path.abspath(__file__))
14274
CDF_PATH = os.path.join(BASEPATH, 'cdf36_3-dist')
14375

76+
# print (BASEPATH, CDF_PATH)
14477

14578
class CDFBuild(build):
14679
def run(self):
@@ -159,7 +92,7 @@ def CDF_build(self, ppath):
15992
# print (' ')
16093
# print ("In CDF_build ", build_path, CDF_PATH, ppath)
16194
# print(' ')
162-
# print (' ')
95+
# print(' ')
16396

16497
# check if library already exists
16598
if (not os.path.isfile(os.path.join(self.build_lib,
@@ -178,7 +111,7 @@ def CDF_build(self, ppath):
178111
cmd2 = ['make',
179112
# 'INSTALLDIR='+build_path,
180113
'INSTALLDIR=' + build_path,
181-
'install', ]
114+
'install', '>/dev/null 2>&1']
182115

183116
# clean any previous attempts
184117
def compile0():
@@ -226,7 +159,7 @@ def run(self):
226159
lib_path = os.path.abspath(os.path.join(self.build_lib, 'pysatCDF'))
227160
# set directories for the CDF library installed with pysatCDF
228161
self.extensions[0].include_dirs = [os.path.join(lib_path, 'include')]
229-
self.extensions[0].f2py_options = ['--include-paths', os.path.join(lib_path, 'include')]
162+
self.extensions[0].f2py_options = ['--include-paths', os.path.join(lib_path, 'include'), '--quiet']
230163
self.extensions[0].extra_objects = [os.path.join(lib_path, 'lib', lib_name)]
231164
# add shared library, if provided
232165
if shared_lib_name is not None:
@@ -257,7 +190,7 @@ def run(self):
257190
name='pysatCDF.fortran_cdf',
258191
sources=[os.path.join('pysatCDF', 'fortran_cdf.f')],
259192
include_dirs=[f2py_cdf_include_path],
260-
f2py_options=['--include-paths', f2py_cdf_include_path], # '--Wall', 'n', '--Wno-tabs', 'n'],
193+
f2py_options=['--quiet', '--include-paths', f2py_cdf_include_path], # '--Wall', 'n', '--Wno-tabs', 'n'],
261194
extra_objects=[f2py_cdf_lib_path],
262195
extra_link_args=extra_link_args)
263196

@@ -288,7 +221,7 @@ def run(self):
288221
# 3 - Alpha
289222
# 4 - Beta
290223
# 5 - Production/Stable
291-
'Development Status :: 3 - Alpha',
224+
'Development Status :: 4 - Beta',
292225

293226
# Indicate who your project is intended for
294227
'Intended Audience :: Science/Research',

0 commit comments

Comments
 (0)