Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added rotate flag option to MatlabIO class #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions doc/update-gh-pages.sh

This file was deleted.

74 changes: 74 additions & 0 deletions maintenance/anaconda/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "jhcook/macos-sierra"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.

# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.synced_folder ".", "/Users/vagrant/anaconda",
type: "rsync",
rsync__chown: false
config.vm.provision "shell", inline: <<-SHELL
sudo chown -R vagrant:staff anaconda
rm -rf anaconda/pyrocko.git/.git
./anaconda/deploy.sh -u
SHELL
end
2 changes: 2 additions & 0 deletions maintenance/anaconda/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# To be run from conda build
$PYTHON setup.py install
44 changes: 44 additions & 0 deletions maintenance/anaconda/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# To return a failure if any commands inside fail
# More: https://conda.io/docs/user-guide/tutorials/build-pkgs.html
set -e
MINICONDA_URL="https://repo.continuum.io/miniconda"
CONDA_PREFIX="$HOME/miniconda3"
BUILD_DIR=`dirname $0`
export PATH=$PATH:$CONDA_PREFIX/bin

if [ `uname` == "Darwin" ]; then
MINICONDA_FILE="Miniconda3-latest-MacOSX-x86_64.sh"
else
MINICONDA_FILE="Miniconda3-latest-Linux-x86_64.sh"
fi

# Install Miniconda
read -r -p "Do you want to download and install $MINICONDA_FILE [y/N]?" resp
case $resp in
[yY][eE][sS]|[yY] )
curl "$MINICONDA_URL/$MINICONDA_FILE" -o "$BUILD_DIR/miniconda.sh";
chmod +x "$BUILD_DIR/miniconda.sh"
./$BUILD_DIR/miniconda.sh -b -u
conda install -y conda-build anaconda-client
;;
*)
;;
esac

# Install Anaconda client and build tools
read -r -p "Do you want to upload pyrocko to Anaconda (https://anaconda.org/pyrocko/pyrocko) [y/N]?" resp
case $resp in
[yY][eE][sS]|[yY] )
anaconda logout;
anaconda login --username pyrocko --password $ANACONDA_PASSWORD;
conda config --set anaconda_upload yes;
;;
* ) conda config --set anaconda_upload no;
;;
esac
conda-build $BUILD_DIR

# Workaround for https://github.com/travis-ci/travis-ci/issues/6522
# Turn off exit on failure.
set +e
37 changes: 37 additions & 0 deletions maintenance/anaconda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% set data = load_setup_py_data() %}

package:
name: pyrocko-kite
version: {{ data.get('version') }}

source:
path: kite.git/
# git-url: https://github.com/pyrocko/kite

requirements:
build:
- python
- numpy
run:
- numpy
- scipy
- matplotlib
- pyqt
- pyyaml
- future
- requests

test:
requires:
- nose
script_files:
- kite.git/test
commands:
- nosetests --verbosity=2 --detailed-errors test

about:
home: https://pyrocko.org
license: GPL3
license-family: GPL
summary: A versatile seismology toolkit for Python.
doc_url: https://pyrocko.org/docs/kite
17 changes: 17 additions & 0 deletions maintenance/deploy-anaconda_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
if [ ! -f deploy-anaconda_linux.sh ] ; then
echo "must be run from kite's maintenance directory"
exit 1
fi

branch="$1"
if [ -z "$branch" ]; then
branch=master
fi

echo "Building pyrocko-kite for Anaconda on branch $branch"
rm -rf "anaconda/kite.git"
git clone -b $branch "../" "anaconda/kite.git"
rm -rf "anaconda/kite.git/maintenance/anaconda/meta.yaml"

anaconda/deploy.sh $1
32 changes: 32 additions & 0 deletions maintenance/deploy-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e
VERSION=v`python -c "import kite; print(kite.__version__);"`

if [ ! -f maintenance/deploy-docs.sh ] ; then
echo "must be run from pyrocko's toplevel directory"
exit 1
fi

cd doc
rm -rf build/$VERSION
make clean; make html $1
cp -r build/html build/$VERSION

read -r -p "Are your sure to update live docs at http://pyrocko.org/docs/kite/$VERSION [y/N]?" resp
case $resp in
[yY][eE][sS]|[yY] )
rsync -av build/$VERSION pyrocko@hive:/var/www/pyrocko.org/docs/kite/;
;;
* ) ;;
esac

read -r -p "Do you want to link 'current' to the just uploaded version $VERSION [y/N]?" resp
case $resp in
[yY][eE][sS]|[yY] )
echo "Linking docs/kite/$VERSION to docs/kite/current";
ssh pyrocko@hive "rm -rf /var/www/pyrocko.org/docs/kite/current; ln -s /var/www/pyrocko.org/docs/$VERSION /var/www/pyrocko.org/docs/current";
;;
* ) ;;
esac

cd ..
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def __init__(self):
def get_include(self):
return ''

version = '2017.11'


def _check_for_openmp():
"""Check whether the default compiler supports OpenMP.
Expand Down Expand Up @@ -91,7 +93,7 @@ def _check_for_openmp():

setup(
name='kite',
version='0.0.2',
version=version,
description='Handle SAR displacement data towards pyrocko',
author='Marius P. Isken, Henriette Sudhaus;'
'BriDGes Emmily Noether-Programm (DFG)',
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
from .sandbox_scene import SandboxScene, TestSandboxScene # noqa


__version__ = '0.2'
__version__ = '2017.11'
14 changes: 12 additions & 2 deletions src/scene_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def validate(self, filename, **kwargs):
return False

def read(self, filename, **kwargs):
rotate = kwargs.pop('rotate', True)

import utm
c = self.container

Expand All @@ -133,9 +135,17 @@ def read(self, filename, **kwargs):
for mat_k, v in mat.iteritems():
for io_k in c.iterkeys():
if io_k in mat_k:
c[io_k] = num.rot90(mat[mat_k])
if rotate:
c[io_k] = num.rot90(mat[mat_k])
else:
c[io_k] = mat[mat_k]

elif 'ig_' in mat_k:
c['displacement'] = num.rot90(mat[mat_k])
if rotate:
c['displacement'] = num.rot90(mat[mat_k])
else:
c['displacement'] = mat[mat_k]

elif 'xx' in mat_k:
utm_e = mat[mat_k].flatten()
elif 'yy' in mat_k:
Expand Down