Skip to content

Commit 0e067eb

Browse files
authored
Merge branch 'master' into velocity_hourly
2 parents 8e99d5f + 2db741d commit 0e067eb

7 files changed

Lines changed: 33 additions & 8 deletions

File tree

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ python:
44
- "3.6"
55

66
install:
7-
- pip install -r requirements.txt
8-
- pip install coverage
7+
- pip install -r test_requirements.txt
8+
- pip install pytest-cov
99
- pip install codecov
1010

1111
script:
12-
- coverage run setup.py test
12+
- pytest --cov=./
1313

1414
after_success:
1515
- codecov

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ENV LANG C.UTF-8
77
ENV PATH /home/builder/.local/bin:$PATH
88

99
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
build-essential \
1011
ca-certificates \
1112
git \
1213
libxml2-dev \
@@ -26,6 +27,7 @@ RUN wget -q https://bootstrap.pypa.io/get-pip.py \
2627

2728
RUN pip install \
2829
Cython==0.29 \
30+
numpy>=1.13.0 \
2931
bump2version==0.5.10
3032

3133
RUN useradd --create-home --no-log-init --shell /bin/bash --uid $BUILDER_UID builder

Jenkinsfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ pipeline {
3434
}
3535
stage('test') {
3636
steps {
37-
sh 'python setup.py test'
37+
sh 'pip install --user -r test_requirements.txt'
38+
sh 'pytest'
3839
}
3940
}
4041
stage('package') {

aodntools/timeseries_products/aggregated_timeseries.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ def main_aggregator(files_to_agg, var_to_agg, site_code, input_dir='', output_di
310310
obs_int_template = {'datatype': np.int16, 'zlib': True, 'dimensions': ('OBSERVATION',)}
311311
inst_S256_template = {'datatype': 'S1', 'dimensions': ('INSTRUMENT', "strlen")}
312312
inst_float_template = {'datatype': np.float32, 'dimensions': ('INSTRUMENT',), "fill_value": 99999.0}
313+
inst_double_template = {'datatype': np.float64, 'dimensions': ('INSTRUMENT',), "fill_value": 99999.0}
313314

314315
agg_variable = ds.createVariable(varname=var_to_agg, **obs_float_template)
315316
agg_variable_qc = ds.createVariable(varname=var_to_agg + '_quality_control', **obs_byte_template)
@@ -325,8 +326,8 @@ def main_aggregator(files_to_agg, var_to_agg, site_code, input_dir='', output_di
325326

326327
source_file = ds.createVariable(varname='source_file', **inst_S256_template)
327328
instrument_id = ds.createVariable(varname='instrument_id', **inst_S256_template)
328-
LATITUDE = ds.createVariable(varname='LATITUDE', **obs_double_template)
329-
LONGITUDE = ds.createVariable(varname='LONGITUDE', **obs_double_template)
329+
LATITUDE = ds.createVariable(varname='LATITUDE', **inst_double_template)
330+
LONGITUDE = ds.createVariable(varname='LONGITUDE', **inst_double_template)
330331
NOMINAL_DEPTH = ds.createVariable(varname='NOMINAL_DEPTH', **inst_float_template)
331332

332333
## main loop

setup.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@
44
'jsonschema>=2.6.0,<3.0.0',
55
'numpy>=1.13.0',
66
'netCDF4>=1.5.3',
7-
'pandas>=0.24.2',
8-
'xarray>=0.11.3'
7+
'pandas>=0.24.2,<0.25.0',
8+
'xarray>=0.11.3,<0.14.0'
99
]
1010

11+
TESTS_REQUIRE = [
12+
'pytest'
13+
]
14+
15+
EXTRAS_REQUIRE = {
16+
'testing': TESTS_REQUIRE
17+
}
18+
1119
PACKAGE_DATA = {
1220
'aodntools.ncwriter': ['*.json'],
1321
'aodntools.timeseries_products': ['*.json']
@@ -29,6 +37,8 @@
2937
zip_safe=False,
3038
python_requires='>=3.5',
3139
install_requires=INSTALL_REQUIRES,
40+
tests_require=TESTS_REQUIRE,
41+
extras_require=EXTRAS_REQUIRE,
3242
test_suite='test_aodntools',
3343
classifiers=[
3444
'Development Status :: 5 - Production/Stable',

test_aodntools/timeseries_products/test_aggregated_timeseries.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def test_main_aggregator(self):
4444
for var in obs_vars:
4545
self.assertEqual(dataset.variables[var].dimensions, ('OBSERVATION',))
4646

47+
inst_vars = {'LATITUDE', 'LONGITUDE', 'NOMINAL_DEPTH'}
48+
for var in inst_vars:
49+
self.assertEqual(dataset.variables[var].dimensions, ('INSTRUMENT',))
50+
51+
string_vars = {'source_file', 'instrument_id'}
52+
for var in string_vars:
53+
self.assertEqual(dataset.variables[var].dimensions, ('INSTRUMENT', 'strlen'))
54+
4755
for f in chartostring(dataset['source_file'][:]):
4856
self.assertIn(f, INPUT_FILES)
4957

test_requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--index-url https://pypi.python.org/simple/
2+
-r requirements.txt
3+
-e .[testing]

0 commit comments

Comments
 (0)