From b59da9b1443055a0a0cdcd60e625d95d2c726eab Mon Sep 17 00:00:00 2001 From: marius Date: Mon, 20 Nov 2017 14:30:54 +0100 Subject: [PATCH 1/3] upd --- doc/update-gh-pages.sh | 23 ----------------------- setup.py | 4 +++- src/__init__.py | 2 +- 3 files changed, 4 insertions(+), 25 deletions(-) delete mode 100755 doc/update-gh-pages.sh diff --git a/doc/update-gh-pages.sh b/doc/update-gh-pages.sh deleted file mode 100755 index 21d1807..0000000 --- a/doc/update-gh-pages.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e -if [ ! -f update-gh-pages.sh ] ; then - echo "must be run from kite/doc directory!" - exit 1 -fi - -if [ ! -d gh-pages ] ; then - git clone -b gh-pages -n git@github.com:pyrocko/kite.git gh-pages -fi -cd gh-pages -git pull origin gh-pages -cd .. -make clean; make html - -cp -R build/html/* gh-pages - -COMMIT_MSG="Update kite docs, $(date)" -cd gh-pages -git add *; git commit -m "($COMMIT_MSG)"; -git push origin gh-pages - -cd .. diff --git a/setup.py b/setup.py index da8ab1a..fd53b2a 100644 --- a/setup.py +++ b/setup.py @@ -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. @@ -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)', diff --git a/src/__init__.py b/src/__init__.py index 40fa9db..00ef9bf 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -7,4 +7,4 @@ from .sandbox_scene import SandboxScene, TestSandboxScene # noqa -__version__ = '0.2' +__version__ = '2017.11' From 44ff74ccc5190c08263aab93de4ae644217de01b Mon Sep 17 00:00:00 2001 From: marius Date: Mon, 20 Nov 2017 14:37:01 +0100 Subject: [PATCH 2/3] Added maintenance stuff --- maintenance/anaconda/Vagrantfile | 74 ++++++++++++++++++++++++++++ maintenance/anaconda/build.sh | 2 + maintenance/anaconda/deploy.sh | 44 +++++++++++++++++ maintenance/anaconda/meta.yaml | 37 ++++++++++++++ maintenance/deploy-anaconda_linux.sh | 17 +++++++ maintenance/deploy-docs.sh | 32 ++++++++++++ 6 files changed, 206 insertions(+) create mode 100644 maintenance/anaconda/Vagrantfile create mode 100644 maintenance/anaconda/build.sh create mode 100755 maintenance/anaconda/deploy.sh create mode 100644 maintenance/anaconda/meta.yaml create mode 100755 maintenance/deploy-anaconda_linux.sh create mode 100755 maintenance/deploy-docs.sh diff --git a/maintenance/anaconda/Vagrantfile b/maintenance/anaconda/Vagrantfile new file mode 100644 index 0000000..5ef7725 --- /dev/null +++ b/maintenance/anaconda/Vagrantfile @@ -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 diff --git a/maintenance/anaconda/build.sh b/maintenance/anaconda/build.sh new file mode 100644 index 0000000..9ec263e --- /dev/null +++ b/maintenance/anaconda/build.sh @@ -0,0 +1,2 @@ +# To be run from conda build +$PYTHON setup.py install diff --git a/maintenance/anaconda/deploy.sh b/maintenance/anaconda/deploy.sh new file mode 100755 index 0000000..f25a2ee --- /dev/null +++ b/maintenance/anaconda/deploy.sh @@ -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 diff --git a/maintenance/anaconda/meta.yaml b/maintenance/anaconda/meta.yaml new file mode 100644 index 0000000..b14fac0 --- /dev/null +++ b/maintenance/anaconda/meta.yaml @@ -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 diff --git a/maintenance/deploy-anaconda_linux.sh b/maintenance/deploy-anaconda_linux.sh new file mode 100755 index 0000000..b61ba38 --- /dev/null +++ b/maintenance/deploy-anaconda_linux.sh @@ -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 diff --git a/maintenance/deploy-docs.sh b/maintenance/deploy-docs.sh new file mode 100755 index 0000000..5be02a9 --- /dev/null +++ b/maintenance/deploy-docs.sh @@ -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 .. From 29f56da3ffc49a5bd89bc2c755d38de2e4afe82f Mon Sep 17 00:00:00 2001 From: hvasbath Date: Tue, 2 Jan 2018 16:04:58 +0100 Subject: [PATCH 3/3] added rotate flag option to MatlabIO class --- src/scene_io.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/scene_io.py b/src/scene_io.py index 00412c6..d5346c9 100644 --- a/src/scene_io.py +++ b/src/scene_io.py @@ -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 @@ -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: