Compare commits

...

5 Commits

Author SHA1 Message Date
Sebastian Heimann 0e9dde7bf1 get coverage working in drone 10 months ago
Sebastian Heimann 2de1c68daa wip 10 months ago
Sebastian Heimann 855e8ee65f wip 10 months ago
Sebastian Heimann bff37f64f4 flake8 10 months ago
Sebastian Heimann 2a857f0834 wip 10 months ago
  1. 2
      .coveragerc
  2. 17
      .drone.yml
  3. 2
      setup.py
  4. 2
      src/apps/grond.py
  5. 1
      src/environment.py
  6. 8
      src/meta.py
  7. 4
      src/problems/plot.py
  8. 2
      src/targets/gnss_campaign/plot.py
  9. 16
      src/targets/satellite/plot.py
  10. 3
      src/targets/waveform_phase_ratio/target.py
  11. 4
      test/__init__.py
  12. 4
      test/common.py

2
.coveragerc

@ -0,0 +1,2 @@
[run]
source = grond

17
.drone.yml

@ -1,3 +1,4 @@
kind: pipeline
type: docker
name: flake8
@ -89,7 +90,7 @@ trigger:
steps:
- name: sdist-pip
image: grond-nest
image: grond-fat-aux
pull: never
commands:
- python setup.py sdist
@ -102,20 +103,24 @@ steps:
exclude:
- release
commands:
- rm -f test/data
- ln -s /grond-test-data test/data
- pip3 install pyrocko nose
- pip3 install utm
- pip3 install git+https://github.com/pyrocko/kite
- pip3 install -f dist --no-index --no-deps grond
- python3 -m nose test
- name: test-mixed-pip-manylinux1_x86_64
image: grond-nest
- name: test-mixed-pip
image: grond-fat-nest
pull: never
when:
branch:
exclude:
- release
commands:
- rm -f test/data
- ln -s /grond-test-data test/data
- pip3 install -f dist --no-index --no-deps grond
- python3 -m nose test
@ -169,9 +174,10 @@ name: tests-base
steps:
- name: tests-base
image: grond-nest
image: grond-fat-nest
pull: never
commands:
- ln -s /grond-test-data test/data
- python3 setup.py install
- python3 -m coverage run --parallel-mode -m nose test
- for x in .coverage.* ; do mv $x $${x#.} ; done
@ -197,9 +203,6 @@ name: coverage
depends_on:
- tests-base
- tests-gf
- tests-examples
- tests-gui
steps:
- name: build

2
setup.py

@ -71,6 +71,7 @@ installed_date = %s
with open(outfile, 'w') as f:
f.write(module_code)
class CustomBuildPyCommand(build_py):
def run(self):
@ -99,6 +100,7 @@ class CustomDevelopCommand(develop):
make_info_module('grond', version, outfile)
super().run()
setup(
cmdclass={
'build_py': CustomBuildPyCommand,

2
src/apps/grond.py

@ -551,7 +551,7 @@ def command_init(args):
sys.stdout.write(config+'\n\n')
logger.info('Hint: To create a project, use: grond init <example> '
'<projectdir>'.format(c=Color, example=args[0]))
'<projectdir>')
elif op.exists(op.abspath(args[1])) and not options.force:
help_and_die(

1
src/environment.py

@ -2,7 +2,6 @@ import time
import logging
import shutil
import os
from contextlib import contextmanager
from grond.config import read_config, write_config
from grond import meta, run_info

8
src/meta.py

@ -61,9 +61,9 @@ def nextpow2(i):
return 2**int(math.ceil(math.log(i) / math.log(2.)))
def gather(l, key, sort=None, filter=None):
def gather(seq, key, sort=None, filter=None):
d = {}
for x in l:
for x in seq:
if filter is not None and not filter(x):
continue
@ -316,8 +316,8 @@ def nslc_to_pattern(s):
raise GrondError('Invalid net.sta.loc.cha pattern: %s' % s)
def nslcs_to_patterns(l):
return [nslc_to_pattern(s) for s in l]
def nslcs_to_patterns(seq):
return [nslc_to_pattern(s) for s in seq]
class SelectionError(GrondError):

4
src/problems/plot.py

@ -709,8 +709,8 @@ class MTLocationPlot(SectionPlotConfig):
default='dc')
normalisation_gamma = Float.T(
default=3.,
help='Normalisation of colors and alpha as :math:`x^\gamma`.'
'A linear colormap/alpha with :math:`\gamma=1`.')
help='Normalisation of colors and alpha as :math:`x^\\gamma`.'
'A linear colormap/alpha with :math:`\\gamma=1`.')
def make(self, environ):
environ.setup_modelling()

2
src/targets/gnss_campaign/plot.py

@ -8,7 +8,7 @@ from pyrocko import orthodrome as od
from grond.plot.config import PlotConfig
from grond.plot.collection import PlotItem
from grond.problems import CMTProblem, RectangularProblem, \
VolumePointProblem, VLVDProblem
VLVDProblem
from ..plot import StationDistributionPlot

16
src/targets/satellite/plot.py

@ -234,8 +234,8 @@ edge marking the upper fault edge. Complete data extent is shown.
arr = num.full_like(scene.displacement, fill_value=num.nan)
qt = scene.quadtree
for syn_v, l in zip(displacements, qt.leaves):
arr[l._slice_rows, l._slice_cols] = syn_v
for syn_v, leaf in zip(displacements, qt.leaves):
arr[leaf._slice_rows, leaf._slice_cols] = syn_v
arr[scene.displacement_mask] = num.nan
@ -313,11 +313,11 @@ edge marking the upper fault edge. Complete data extent is shown.
off_e = source.effective_lon - target.scene.frame.llLon
turE, turN, tllE, tllN = zip(
*[(l.gridE.max()-off_e,
l.gridN.max()-off_n,
l.gridE.min()-off_e,
l.gridN.min()-off_n)
for l in target.scene.quadtree.leaves])
*[(leaf.gridE.max()-off_e,
leaf.gridN.max()-off_n,
leaf.gridE.min()-off_e,
leaf.gridN.min()-off_n)
for leaf in target.scene.quadtree.leaves])
turE, turN = map(max, (turE, turN))
tllE, tllN = map(min, (tllE, tllN))
@ -345,7 +345,7 @@ edge marking the upper fault edge. Complete data extent is shown.
Surface displacements derived from satellite data.
(Left) the input data, (center) the modelled
data and (right) the model residual.
'''.format(meta=scene.meta))
''')
stat_obs = result.statics_obs
stat_syn = result.statics_syn['displacement.los']

3
src/targets/waveform_phase_ratio/target.py

@ -11,8 +11,7 @@ from . import measure as fm
from grond import dataset
from grond.meta import has_get_plot_classes
from ..waveform.target import StoreIDSelector, StoreIDSelectorError,\
Crust2StoreIDSelector, StationDictStoreIDSelector
from ..waveform.target import StoreIDSelector
guts_prefix = 'grond'
logger = logging.getLogger('grond.targets.waveform_phase_ratio.target')

4
test/__init__.py

@ -1,8 +1,8 @@
import matplotlib
matplotlib.use('Agg')
from pyrocko import util
from pyrocko import util # noqa
util.force_dummy_progressbar = True
util.setup_logging('grondtest', 'info')
import warnings
import warnings # noqa
warnings.simplefilter(action='ignore', category=FutureWarning)

4
test/common.py

@ -80,8 +80,8 @@ class Capture(object):
self.orig_stdout.write(data)
def writelines(self, lines):
for l in lines:
self.write(l)
for line in lines:
self.write(line)
def flush(self):
self.file.flush()

Loading…
Cancel
Save