Skip to content

Commit

Permalink
Fix ungridded collocation points (#28)
Browse files Browse the repository at this point in the history
* Minor fix to accomodate updated Pandas Series interface

* Minor test fix due to Pandas interface change

* Release changes. Removing 2.7 tests which are unable to resolve dependencies now.
  • Loading branch information
duncanwp authored Sep 14, 2020
1 parent cde6809 commit f863369
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sudo: false
# - 3.6

env:
- TEST_TARGET=unit PYTHON_TARGET=2.7
# - TEST_TARGET=unit PYTHON_TARGET=2.7
- TEST_TARGET=unit PYTHON_TARGET=3.6
- TEST_TARGET=unit PYTHON_TARGET=3.7
# - TEST_TARGET=integration
Expand Down
2 changes: 1 addition & 1 deletion cis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
ungridded, but not a mix. For ungridded data lists it is assumed that all objects share the same coordinates.
"""
__author__ = "David Michel, Daniel Wallis, Duncan Watson-Parris, Richard Wilkinson, Ian Bush, Matt Kendall, John Holt"
__version__ = "1.7.1"
__version__ = "1.7.2"
__status__ = "Stable"
__website__ = "http://www.cistools.net/"

Expand Down
4 changes: 2 additions & 2 deletions cis/collocation/col_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ def __init__(self, h_sep=None, a_sep=None, p_sep=None, t_sep=None):
self.checks.append(self.time_constraint)

def time_constraint(self, points, ref_point):
return np.nonzero(np.abs(points.time - ref_point.time) < self.t_sep)[0]
return (np.abs(points.time - ref_point.time) < self.t_sep).to_numpy().nonzero()[0]

def alt_constraint(self, points, ref_point):
return np.nonzero(np.abs(points.altitude - ref_point.altitude) < self.a_sep)[0]
return (np.abs(points.altitude - ref_point.altitude) < self.a_sep).to_numpy().nonzero()[0]

def pressure_constraint(self, points, ref_point):
greater_pressures = np.nonzero(((points.air_pressure.values / ref_point.air_pressure) < self.p_sep) &
Expand Down
2 changes: 1 addition & 1 deletion cis/test/unit/test_io/test_ungridded_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_GIVEN_ungridded_data_WHEN_call_as_data_frame_THEN_returns_valid_data_fr

assert_that(df['rainfall_flux'][5] == 6)
assert_that(df['latitude'][17] == 0)
assert_that(df['latitude'].ix[datetime(1984,8,31)][0] == 10)
assert_that(df.loc[datetime(1984,8,31), 'latitude'][0] == 10)
assert_that(df['rainfall_flux'].median() == 25.5)

@skip_pandas
Expand Down
6 changes: 6 additions & 0 deletions doc/whats_new_1.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ CIS 1.7.1 fixes
===============
* Fixed an issue where interpolation would unmask masked source arrays
* Support for Pandas 0.24

CIS 1.7.2 fixes
===============
* We no-longer officially support Python 2.7. We won't yet explicitly remove Python 2.7 features but we no longer
test against Python 2 and won't fix issues relating to it.
* Support for Pandas 1.1

0 comments on commit f863369

Please sign in to comment.