diff --git a/.travis.yml b/.travis.yml index d212b5723c..5110aac88e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ install: - source activate test # CORE DEPENDENCIES - - if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION pytest pip Cython; fi + - if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION pytest pip Cython jinja2; fi - if [[ $SETUP_CMD != egg_info ]]; then $PIP_INSTALL pytest-xdist; fi # ASTROPY diff --git a/pvextractor/geometry/poly_slices.py b/pvextractor/geometry/poly_slices.py index 6fb00dfcdf..a91afc0353 100644 --- a/pvextractor/geometry/poly_slices.py +++ b/pvextractor/geometry/poly_slices.py @@ -41,8 +41,11 @@ def extract_poly_slice(cube, polygons): polygon.x, polygon.y) if area > 0: - total_slice[:, i] += cube[:, ymin, xmin] * area - total_area[:, i] += area + dataslice = cube[:, ymin, xmin] + good_values = np.isfinite(dataslice) + if np.any(good_values): + total_slice[good_values, i] += dataslice[good_values] * area + total_area[good_values, i] += area total_slice[total_area == 0.] = np.nan total_slice[total_area > 0.] /= total_area[total_area > 0.] diff --git a/pvextractor/tests/test_slicer.py b/pvextractor/tests/test_slicer.py index d6df8859da..e51ec01e85 100644 --- a/pvextractor/tests/test_slicer.py +++ b/pvextractor/tests/test_slicer.py @@ -74,7 +74,6 @@ LONPOLE = 180.0 / [deg] Native longitude of celestial pole LATPOLE = 30.5765277962 / [deg] Native latitude of celestial pole RESTFRQ = 1420405718.41 / [Hz] Line rest frequency -EQUINOX = 2000.0 / [yr] Equinox of equatorial coordinates SPECSYS = 'BARYCENT' / Reference frame of spectral coordinates MJD-OBS = 50982.687794 / [d] MJD of observation matching DATE-OBS DATE-OBS= '1998-06-18T16:30:25.4' / ISO-8601 observation date matching MJD-OBS