Skip to content
Snippets Groups Projects
Commit 932c3591 authored by jay's avatar jay
Browse files

Merge remote-tracking branch 'upstream/master' into win32

parents 369d308e 7aac3c31
No related branches found
No related tags found
No related merge requests found
......@@ -4,15 +4,30 @@ branches:
version: '0.1.0.{build}'
platform:
- x64
- x86
environment:
matrix:
- PYTHON: "C:\\Miniconda35-x64\\Scripts\\activate.bat"
PYTHON_VERSION: 3.5
- PYTHON: "C:\\Miniconda36-x64\\Scripts\\activate.bat"
PYTHON_VERSION: 3.6
- PYTHON: "C:\\Miniconda35\\Scripts\\activate.bat"
PYTHON_VERSION: 3.5
- PYTHON: "C:\\Miniconda36\\Scripts\\activate.bat"
platform:
- x64
matrix:
exclude:
- PYTHON: "C:\\Miniconda35-x64\\Scripts\\activate.bat"
platform: x86
- PYTHON: "C:\\Miniconda36-x64\\Scripts\\activate.bat"
platform: x86
- PYTHON: "C:\\Miniconda35\\Scripts\\activate.bat"
platform: x64
- PYTHON: "C:\\Miniconda36\\Scripts\\activate.bat"
platform: x64
configuration:
- Release
......@@ -21,19 +36,19 @@ install:
- cmd: call %PYTHON%
- cmd: conda config --set always_yes yes --set changeps1 no
- cmd: conda update -q conda
- cmd: conda install conda-build anaconda-client
- cmd: conda install conda-build anaconda-client
- cmd: conda create -q -n test_env python=%PYTHON_VERSION%
- cmd: activate test_env
- cmd: conda config --add channels conda-forge
- cmd: conda install -c conda-forge pvl protobuf gdal numpy pandas sqlalchemy pyyaml networkx affine h5py scipy
- cmd: conda install pytest-cov
- cmd: conda install -c conda-forge pytest pytest-cov
# https://pythonhosted.org/CodeChat/appveyor.yml.html
- cmd: python -m pip install -U pip
- cmd: python -m easy_install -U setuptools
build_script:
- cmd: python setup.py install
test_script:
- cmd: pytest plio/
......
This diff is collapsed.
<<<<<<< HEAD
import math
=======
>>>>>>> upstream/master
import numpy as np
import pandas as pd
......@@ -44,3 +47,49 @@ def read_gpf(input_data):
assert int(cnt) == len(df)
return df
<<<<<<< HEAD
=======
def save_gpf(df, output_file):
"""
Write a socet gpf file from a gpf-defined pandas dataframe
Parameters
----------
df : pd.DataFrame
Pandas DataFrame
output_file : str
path to the output data file
Returns
-------
int : success value
0 = success, 1 = errors
"""
# Check that file can be opened
try:
outGPF = open(output_file, 'w', newline='\r\n')
except:
print ('Unable to open output gpf file: {0}'.format(output_file))
return 1
#grab number of rows in pandas dataframe
numpts = len(df)
#Output gpf header
outGPF.write('GROUND POINT FILE\n')
outGPF.write('{0}\n'.format(numpts))
outGPF.write('point_id,stat,known,lat_Y_North,long_X_East,ht,sig(3),res(3)\n')
for index,row in df.iterrows():
#Output coordinates to gpf file
outGPF.write('{0} {1} {2}\n'.format(row['point_id'], row['stat'], row['known']))
outGPF.write('{0} {1} {2}\n'.format(row['lat_y_North'], row['long_X_East'], row['ht']))
outGPF.write('{0} {1} {2}\n'.format(row['sigma0'], row['sigma1'], row['sigma2']))
outGPF.write('{0} {1} {2}\n\n'.format(row['res0'], row['res1'], row['res2']))
outGPF.close()
return 0
>>>>>>> upstream/master
import filecmp
import numpy as np
import pandas as pd
from pandas.util.testing import assert_frame_equal
from plio.io.io_gpf import read_gpf
from plio.io.io_gpf import save_gpf
from plio.examples import get_path
import pytest
......@@ -10,8 +13,11 @@ import pytest
@pytest.fixture
def insight_gpf():
return get_path('InSightE08_XW.gpf')
@pytest.fixture
def out_insight_gpf():
return get_path('out_InSightE08_XW.gpf')
@pytest.fixture()
@pytest.fixture()
def insight_expected():
return pd.read_csv(get_path('InSightE08_XW.csv'))
......@@ -19,3 +25,9 @@ def insight_expected():
def test_read_gfp(gpf, expected):
df = read_gpf(gpf)
assert_frame_equal(df, expected)
@pytest.mark.parametrize('gpf, out_gpf', [(insight_gpf(),out_insight_gpf())])
def test_write_gfp(gpf, out_gpf):
df = read_gpf(gpf)
val = save_gpf(df, out_gpf)
assertTrue(filecmp.cmp(gpf, out_gpf, shallow=True), "save_gpf does not create an equal file.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment