Skip to content
Snippets Groups Projects
Commit 43e343a6 authored by jlaura's avatar jlaura Committed by GitHub
Browse files

Fixes failing tests (#113)

* Fixes failing tests

* removes python 3.5 support

* Skips conda upload if a PR
parent 3a2219eb
Branches
Tags
No related merge requests found
...@@ -10,11 +10,10 @@ os: ...@@ -10,11 +10,10 @@ os:
- osx - osx
env: env:
- PYTHON_VERSION=3.5 HAS_GDAL=true
- PYTHON_VERSION=3.6 HAS_GDAL=true - PYTHON_VERSION=3.6 HAS_GDAL=true
- PYTHON_VERSION=3.5 HAS_GDAL=false
- PYTHON_VERSION=3.6 HAS_GDAL=false - PYTHON_VERSION=3.6 HAS_GDAL=false
- PYTHON_VERSION=3.7 HAS_GDAL=true
- PYTHON_VERSION=3.7 HAS_GDAL=false
before_install: before_install:
# We do this conditionally because it saves us some downloading if the # We do this conditionally because it saves us some downloading if the
# version is the same. # version is the same.
...@@ -56,7 +55,10 @@ after_success: ...@@ -56,7 +55,10 @@ after_success:
- conda config --set anaconda_upload no - conda config --set anaconda_upload no
- conda build recipe -q - conda build recipe -q
- builddir=(`conda build recipe --output`) - builddir=(`conda build recipe --output`)
- anaconda -t="$CONDA_UPLOAD_TOKEN" upload $builddir --label dev --force; - |
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
anaconda -t="$CONDA_UPLOAD_TOKEN" upload $builddir --force;
fi
# Docs to gh-pages # Docs to gh-pages
- source activate test # Reactivate the env to have all deps installed. - source activate test # Reactivate the env to have all deps installed.
......
...@@ -3,8 +3,8 @@ channels: ...@@ -3,8 +3,8 @@ channels:
- conda-forge - conda-forge
- usgs-astrogeology - usgs-astrogeology
dependencies: dependencies:
- libgdal - libgdal < 3
- gdal - gdal < 3
- numpy - numpy
- pyproj - pyproj
- h5py - h5py
......
...@@ -191,6 +191,7 @@ class GeoDataset(object): ...@@ -191,6 +191,7 @@ class GeoDataset(object):
@property @property
def forward_affine(self): def forward_affine(self):
print(self.geotransform)
self._fa = affine.Affine.from_gdal(*self.geotransform) self._fa = affine.Affine.from_gdal(*self.geotransform)
return self._fa return self._fa
...@@ -460,6 +461,7 @@ class GeoDataset(object): ...@@ -460,6 +461,7 @@ class GeoDataset(object):
(Latitude, Longitude) corresponding to the given (x,y). (Latitude, Longitude) corresponding to the given (x,y).
""" """
lon, lat = self.forward_affine * (x,y) lon, lat = self.forward_affine * (x,y)
lon, lat, _ = self.coordinate_transformation.TransformPoint(lon, lat) lon, lat, _ = self.coordinate_transformation.TransformPoint(lon, lat)
return lat, lon return lat, lon
......
...@@ -17,7 +17,7 @@ def read_yaml(inputfile): ...@@ -17,7 +17,7 @@ def read_yaml(inputfile):
""" """
try: try:
with open(inputfile, 'r') as f: with open(inputfile, 'r') as f:
ydict = yaml.load(f) ydict = yaml.safe_load(f)
except: # pragma: no cover except: # pragma: no cover
raise IOError('Unable to load YAML file.') raise IOError('Unable to load YAML file.')
return ydict return ydict
...@@ -62,7 +62,9 @@ class TestMercator(unittest.TestCase): ...@@ -62,7 +62,9 @@ class TestMercator(unittest.TestCase):
def test_spheroid(self): def test_spheroid(self):
sphere = self.dataset.spheroid sphere = self.dataset.spheroid
self.assertAlmostEqual(sphere[0], 3396190.0, 6) self.assertAlmostEqual(sphere[0], 3396190.0, 6)
self.assertEqual(self.dataset.spheroid, (3396190.0, 3376200.0, 169.8944472236118)) self.assertAlmostEqual(self.dataset.spheroid[0], 3396190.0)
self.assertAlmostEqual(self.dataset.spheroid[1], 3376200.0)
self.assertAlmostEqual(self.dataset.spheroid[2], 169.8944472236118)
self.assertAlmostEqual(sphere[1], 3376200.0, 6) self.assertAlmostEqual(sphere[1], 3376200.0, 6)
self.assertAlmostEqual(sphere[2], 169.8944472236118, 6) self.assertAlmostEqual(sphere[2], 169.8944472236118, 6)
......
...@@ -52,7 +52,8 @@ def test_export_to_proj4(srs_mars): ...@@ -52,7 +52,8 @@ def test_export_to_proj4(srs_mars):
Check that proj4 is not supporting Moon2000_Mercator Check that proj4 is not supporting Moon2000_Mercator
""" """
proj4 = srs_mars.ExportToProj4() proj4 = srs_mars.ExportToProj4()
assert proj4 == '+proj=merc +lon_0=180 +lat_ts=0 +x_0=0 +y_0=0 +a=1737400 +b=1737400 +units=m +no_defs ' for element in '+proj=merc +lon_0=180 +lat_ts=0 +x_0=0 +y_0=0 +a=1737400 +b=1737400 +units=m +no_defs'.split():
assert element in proj4
@pytest.mark.skipif(gdal is None, reason="GDAL not installed") @pytest.mark.skipif(gdal is None, reason="GDAL not installed")
def test_scale_factor(srs_mars): def test_scale_factor(srs_mars):
......
...@@ -32,7 +32,7 @@ def setup_logging(path=get_path('logging.json'), ...@@ -32,7 +32,7 @@ def setup_logging(path=get_path('logging.json'),
config = json.load(f) config = json.load(f)
elif logtype == '.yaml': elif logtype == '.yaml':
import yaml import yaml
config = yaml.load(f.read()) config = yaml.safe_load(f.read())
logging.config.dictConfig(config) logging.config.dictConfig(config)
else: else:
logging.basicConfig(level=level) logging.basicConfig(level=level)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment