Giter Club home page Giter Club logo

kite's Introduction

Kite

Docs PyPI PyPI - Python Version CI Code style: black

Preparation of InSAR surface displacement maps for geophysical modelling

Installation

Install from pip:

pip install kite

With additional gdal dependency, used for GeoTIFF (GACOS and LiCSAR):

pip install kite[gdal]

Introduction

This framework is streamlining InSAR displacement processing routines for earthquake inversion through Pyrocko and Grond.

Kite features simple and efficient handling of displacement data:

  • Import InSAR displacement data from GAMMA, ISCE, GMTSAR, ROI_PAC, SARScape, COMET LiCSAR, SNAP and Matlab
  • Import of average timeseries from STAMPS and German BodenBewegungsDienst
  • Quadtree calculation for data reduction
  • Covariance estimation from data noise
  • APS removal from GACOS atmoshperic models and empirical elevation correlation

Citation

Recommended citation for Kite

Isken, Marius; Sudhaus, Henriette; Heimann, Sebastian; Steinberg, Andreas; Daout, Simon; Vasyura-Bathke, Hannes (2017): Kite - Software for Rapid Earthquake Source Optimisation from InSAR Surface Displacement. V. 0.1. GFZ Data Services. http://doi.org/10.5880/GFZ.2.1.2017.002

DOI

Documentation

Find the documentation at https://pyrocko.org/kite/docs/current/.

Short Example

from kite import Scene

# Import Matlab container to kite
scene = Scene.load('SNAP_data/')
scene.spool()  # start the GUI for data inspection and Quadtree parametrisation

Visual parametrisation of the quadtree and spatial covariance for SLC and InSAR time-series.

L'Aquila earthquake unwrapped displacement data

kite's People

Contributors

emolch avatar hsudha avatar hvasbath avatar janrid avatar miili avatar rokuwaki avatar shaharkadmiel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kite's Issues

PyQt5 issue

Dear all,
I have a problem regarding PyQt as far as I understood,
I really appreciate it if you can help me to solve this issue?

spool dsc
Traceback (most recent call last):
  File "/raid-manaslu/maref/Software/anaconda3/envs/mintpyc/bin/spool", line 5, in <module>
    from kite.spool.main import main
  File "/raid-manaslu/maref/Software/anaconda3/envs/mintpyc/lib/python3.8/site-packages/kite/spool/init.py", line 2, in <module>
    from .spool import Spool, spool
  File "/raid-manaslu/maref/Software/anaconda3/envs/mintpyc/lib/python3.8/site-packages/kite/spool/spool.py", line 10, in <module>
    from kite.qt_utils import loadUi, validateFilename, SceneLog, QRangeSlider
  File "/raid-manaslu/maref/Software/anaconda3/envs/mintpyc/lib/python3.8/site-packages/kite/qt_utils.py", line 98, in <module>
    class SliderWidget(QtGui.QWidget):
AttributeError: module 'PyQt5.QtGui' has no attribute 'QWidget'

Talpa programmatic start

Following script adapted from your example

from kite import SandboxScene
from kite.sources import EllipsoidSource
from kite.talpa import Talpa

fn = '/tmp/sandbox_scene.yml'
km = 1e3

sandbox = SandboxScene()

ellipsoid_source = EllipsoidSource(
    northing=40*km,
    easting=40*km,
    depth=4*km,
    length_x=100,
    length_y=200,
    length_z=350,
    rotation_x=42.)
sandbox.addSource(ellipsoid_source)

sandbox.save(fn)

Talpa(filename=fn)

raises following error on python 3.6 using Ubuntu 18.04.

INFO:TalpaConfig:Loading config from /home/vasyurhm/.config/kite/talpa_config.yml...
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/kite-2018.2.26-py3.6-linux-x86_64.egg/kite/util.py", line 220, in unsubscribe
    self._listeners.remove(listener)
ValueError: list.remove(x): x not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "talpa_test.py", line 22, in <module>
    Talpa(filename=fn)
  File "/usr/local/lib/python3.6/dist-packages/kite-2018.2.26-py3.6-linux-x86_64.egg/kite/talpa/talpa.py", line 30, in __init__
    self.talpa_win = TalpaMainWindow(filename=filename)
  File "/usr/local/lib/python3.6/dist-packages/kite-2018.2.26-py3.6-linux-x86_64.egg/kite/talpa/talpa.py", line 85, in __init__
    self.loadModel(filename)
  File "/usr/local/lib/python3.6/dist-packages/kite-2018.2.26-py3.6-linux-x86_64.egg/kite/talpa/talpa.py", line 130, in loadModel
    self.sandbox.setModel(model)
  File "/usr/local/lib/python3.6/dist-packages/kite-2018.2.26-py3.6-linux-x86_64.egg/kite/talpa/sandbox_model.py", line 49, in setModel
    self.disconnectSlots()
  File "/usr/local/lib/python3.6/dist-packages/kite-2018.2.26-py3.6-linux-x86_64.egg/kite/talpa/sandbox_model.py", line 66, in disconnectSlots
    self.model.evModelUpdated.unsubscribe(self.sigModelUpdated.emit)
  File "/usr/local/lib/python3.6/dist-packages/kite-2018.2.26-py3.6-linux-x86_64.egg/kite/util.py", line 222, in unsubscribe
    raise AttributeError('%s was not subscribed!')
AttributeError: %s was not subscribed!

Image export from talpa/spool

The image export (save image function) for talpa and spool does not work on debian and ubuntu (14 and 16) systems, causes crash of export window.

Quadnode phi is Nan

Despite the num.nanmedian function phi maybe nan if all the pixels in the quad are nan. Why the quad does exists then is still unclear as it should have been removed if the nanallowed threshold is crossed.

FileNotFoundError test_covariance.py

It seems that a data file is missing...

pytest test/test_covariance.py 
/home/pierre/.pyenv/versions/3.7.1/lib/python3.7/site-packages/nbformat/notebooknode.py:4: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Mapping
/home/pierre/.pyenv/versions/3.7.1/lib/python3.7/site-packages/jsonschema/compat.py:6: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping, Sequence  # noqa
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.7.1, pytest-4.0.2, py-1.7.0, pluggy-0.8.0
rootdir: /home/pierre/tmp/kite, inifile:
plugins: xonsh-0.8.5, ipynb-1.1.0
collected 6 items                                                                                                                                                                                                 

test/test_covariance.py ..F...                                                                                                                                                                              [100%]

==================================================================================================== FAILURES =====================================================================================================
_____________________________________________________________________________________ TestCovariance.test_covariance_parallel _____________________________________________________________________________________

self = <test.test_covariance.TestCovariance testMethod=test_covariance_parallel>

    def test_covariance_parallel(self):
        self.sc.quadtree.epsilon = .07
        self.sc.quadtree.tile_size_max = 11000
    
        cov = self.sc.covariance
        cov.config.adaptive_subsampling = True
    
        @benchmark
        def calc_exp():
            return cov._calcCovarianceMatrix(method='full', nthreads=0)
    
        @benchmark
        def calc_exp_cos():
            cov.setModelFunction('exponential_cosine')
            return cov._calcCovarianceMatrix(method='full', nthreads=0)
    
        res = calc_exp()
>       ref = num.load('test/covariance_ref.npy')

test/test_covariance.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

file = 'test/covariance_ref.npy', mmap_mode = None, allow_pickle = True, fix_imports = True, encoding = 'ASCII'

    def load(file, mmap_mode=None, allow_pickle=True, fix_imports=True,
             encoding='ASCII'):
        """
        Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files.
    
        Parameters
        ----------
        file : file-like object, string, or pathlib.Path
            The file to read. File-like objects must support the
            ``seek()`` and ``read()`` methods. Pickled files require that the
            file-like object support the ``readline()`` method as well.
        mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional
            If not None, then memory-map the file, using the given mode (see
            `numpy.memmap` for a detailed description of the modes).  A
            memory-mapped array is kept on disk. However, it can be accessed
            and sliced like any ndarray.  Memory mapping is especially useful
            for accessing small fragments of large files without reading the
            entire file into memory.
        allow_pickle : bool, optional
            Allow loading pickled object arrays stored in npy files. Reasons for
            disallowing pickles include security, as loading pickled data can
            execute arbitrary code. If pickles are disallowed, loading object
            arrays will fail.
            Default: True
        fix_imports : bool, optional
            Only useful when loading Python 2 generated pickled files on Python 3,
            which includes npy/npz files containing object arrays. If `fix_imports`
            is True, pickle will try to map the old Python 2 names to the new names
            used in Python 3.
        encoding : str, optional
            What encoding to use when reading Python 2 strings. Only useful when
            loading Python 2 generated pickled files in Python 3, which includes
            npy/npz files containing object arrays. Values other than 'latin1',
            'ASCII', and 'bytes' are not allowed, as they can corrupt numerical
            data. Default: 'ASCII'
    
        Returns
        -------
        result : array, tuple, dict, etc.
            Data stored in the file. For ``.npz`` files, the returned instance
            of NpzFile class must be closed to avoid leaking file descriptors.
    
        Raises
        ------
        IOError
            If the input file does not exist or cannot be read.
        ValueError
            The file contains an object array, but allow_pickle=False given.
    
        See Also
        --------
        save, savez, savez_compressed, loadtxt
        memmap : Create a memory-map to an array stored in a file on disk.
        lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file.
    
        Notes
        -----
        - If the file contains pickle data, then whatever object is stored
          in the pickle is returned.
        - If the file is a ``.npy`` file, then a single array is returned.
        - If the file is a ``.npz`` file, then a dictionary-like object is
          returned, containing ``{filename: array}`` key-value pairs, one for
          each file in the archive.
        - If the file is a ``.npz`` file, the returned value supports the
          context manager protocol in a similar fashion to the open function::
    
            with load('foo.npz') as data:
                a = data['a']
    
          The underlying file descriptor is closed when exiting the 'with'
          block.
    
        Examples
        --------
        Store data to disk, and load it again:
    
        >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]]))
        >>> np.load('/tmp/123.npy')
        array([[1, 2, 3],
               [4, 5, 6]])
    
        Store compressed data to disk, and load it again:
    
        >>> a=np.array([[1, 2, 3], [4, 5, 6]])
        >>> b=np.array([1, 2])
        >>> np.savez('/tmp/123.npz', a=a, b=b)
        >>> data = np.load('/tmp/123.npz')
        >>> data['a']
        array([[1, 2, 3],
               [4, 5, 6]])
        >>> data['b']
        array([1, 2])
        >>> data.close()
    
        Mem-map the stored array, and then access the second row
        directly from disk:
    
        >>> X = np.load('/tmp/123.npy', mmap_mode='r')
        >>> X[1, :]
        memmap([4, 5, 6])
    
        """
        own_fid = False
        if isinstance(file, basestring):
>           fid = open(file, "rb")
E           FileNotFoundError: [Errno 2] No such file or directory: 'test/covariance_ref.npy'

../../.pyenv/versions/3.7.1/lib/python3.7/site-packages/numpy/lib/npyio.py:384: FileNotFoundError

Error loading SNAP Gamma exported files

spool --load unwrapped_ifg_dsp_TC.rslc.par
INFO:SceneIO/SNAP_Gamma:Found parameter file /home/vasyurhm/InSAR_course/proc/Galapagos2/KITE/unwrapped_ifg_dsp_TC_Abstracted_Metadata.txt
Traceback (most recent call last):
  File "/usr/local/bin/spool", line 11, in <module>
    load_entry_point('kite==1.4.0', 'console_scripts', 'spool')()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/__main__.py", line 95, in main
    spool(import_file=ns.load)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 405, in spool
    spool_app = Spool(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 48, in __init__
    self.importScene(import_file)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 64, in importScene
    self.spool_win.model.importFile(filename)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/scene_model.py", line 174, in importFile
    self.setScene(Scene.import_data(filename))
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/scene.py", line 494, in dynclassmethod
    return func(Scene(), *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/scene.py", line 1013, in _import_data
    data = module.read(path, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/scene_io.py", line 1278, in read
    displ = displ.reshape(nlines, ncols)
ValueError: cannot reshape array of size 6847 into shape (5391,6847)

Covariance tab crashes

If the polygon mask is this large that it disables all the pixels that are being used for the covariance estimation. One needs to move the green box of covariance esitmation in advance.

One usually clicks the Mask before entering the Covariance tab.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 174, in buildViews
    self.addView(v)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 191, in addView
    view = view(self)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/tab_covariance.py", line 61, in __init__
    self.param_covariance = KiteParamCovariance(model)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/tab_covariance.py", line 791, in __init__
    **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/base.py", line 484, in __init__
    self.updateValues()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/base.py", line 503, in updateValues
    value = getattr(model, param)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/covariance.py", line 1024, in covariance_model_rms
    cov, d = self.getCovariance()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/covariance.py", line 956, in getCovariance
    return self.covariance_spatial
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/util/__init__.py", line 142, in cache_return
    instance.__dict__[var_name] = func(instance)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/covariance.py", line 906, in covariance_spatial
    noise_data = self.noise_data.ravel()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/covariance.py", line 297, in noise_data
    self.noise_data = self.scene.displacement[slice_N, slice_E]
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/covariance.py", line 311, in noise_data
    data = derampMatrix(trimMatrix(data))
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/util/__init__.py", line 99, in trimMatrix
    raise ValueError('Displacement is all NaN.')
ValueError: Displacement is all NaN.

grond report Error

Hi

I have such an error message like the following message, I really appreciate if you can guide me on how to solve it? the log file is attached.
grond report runs/salta_insar_workshop.grun

grond report  runs/salta_insar_workshop.grun
grond:grond.report         - INFO     - Creating report entry for run "salta_insar_workshop"...
grond:grond.dataset        - INFO     - Loading events from /home/pyrocko/grond_project/data/events/salta/event.txt: 1 events found.
grond:grond.dataset        - INFO     - Loading kite InSAR scenes...
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/acceptance/default/acceptance.default.acceptance.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/acceptance/default/acceptance.default.acceptance_img.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/bootstrap/default/bootstrap.default.main.d100.png
grond:grond.targets.satellite.target - INFO     - Inverting scene covariance matrix (nthreads=1)...
grond:grond.targets.satellite.target - INFO     - Inverting scene covariance matrix done.
/usr/lib/python3/dist-packages/scipy/signal/_arraytools.py:45: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  b = a[a_slice]
/usr/lib/python3/dist-packages/scipy/signal/signaltools.py:1341: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  out_full[ind] += zi
/usr/lib/python3/dist-packages/scipy/signal/signaltools.py:1344: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  out = out_full[ind]
/usr/lib/python3/dist-packages/scipy/signal/signaltools.py:1350: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  zf = out_full[ind]
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/contributions/default/contributions.default.main.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.east_shift.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.north_shift.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.depth.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.length.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.width.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.slip.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.dip.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.rake.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.insar.Salta_dsc.offset.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.insar.Salta_dsc.ramp_north.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/histogram/default/histogram.default.insar.Salta_dsc.ramp_east.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/jointpar/default/jointpar.default.fig_0_0.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/jointpar/default/jointpar.default.fig_1_0.d100.png
grond:grond.plot.collection - INFO     - Figure saved: report/salta/salta_insar_workshop/plots/jointpar/default/jointpar.default.fig_1_1.d100.png
/usr/lib/python3/dist-packages/matplotlib/colors.py:512: RuntimeWarning: invalid value encountered in less
  xa[xa < 0] = -1
Killed

package structure makes editable installation fail

I noticed that certain ways of installing kite worked fine for me, others failed.
For example, when I clone the repo and try to install a development version with pip install -e .:

$ git clone https://github.com/pyrocko/kite && cd kite
$ pip install -e .

It fails to create a link to the right package, and actually tries to install a package named "src":

(mapping) [scott@lidar kite-test]$ python
Python 3.8.5 | packaged by conda-forge | (default, Aug 29 2020, 01:22:49)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import kite
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'kite'
>>> import src
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/scott/repos/kite/src/__init__.py", line 4, in <module>
    from .scene import Scene, TestScene, read  # noqa
  File "/home/scott/repos/kite/src/scene.py", line 17, in <module>
    from kite.quadtree import QuadtreeConfig
ModuleNotFoundError: No module named 'kite'

This is because the "kite.egg-link" file that it creates in the site-packages folder points to the repository root, and there's no "kite" folder to find.

(mapping) [scott@lidar ~]$ cat ~/miniconda3/envs/mapping/lib/python3.8/site-packages/kite.egg-link
/home/scott/repos/kite
.(mapping) [scott@lidar ~]$ ls /home/scott/repos/kite
build  CHANGELOG.md  docs  kite.egg-info  LICENSE.md  maintenance  README.md  requirements.txt  setup.cfg  setup.py  src  test

Some recent packaging guides suggest structuring the package like this one: https://github.com/pypa/sampleproject

<repository directory>
    /src/
        package_folder

i.e.

<repository directory>
    /src/
        kite/
           all the code that's currently in "src/"

https://packaging.python.org/tutorials/packaging-projects/#creating-the-package-files

while another (opinionated) guide suggests using the name of the package as the first-level folder https://docs.python-guide.org/writing/structure/#the-actual-module which would just involve renaming "src/" to "kite/"

<repository directory>
    /kite/
        all the code that's currently in "src/"

I tested this on my fork, and it only involves changing a couple lines from src/ to kite/ in the setup.py: https://github.com/scottstanie/kite/commit/ee3886b9eb3c8b015049d4a3abaf699fa6890a5c

$ python
Python 3.8.5 | packaged by conda-forge | (default, Aug 29 2020, 01:22:49)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import kite
>>>

How to transfer the manually corrected ISCE products

Hello everyone, Im currently using the ISCE product with Kite. I got a big problem here: Via this guide link: https://pyrocko.org/kite/docs/current/reference/kite.scene.html#kite.Scene Se have to select the reference point and transfer the radians to meters to meets the satisfaction of Spool tool. My question is how, I used to transfer it to the *.unw.geo -> netCDF format, but the -co SCHEME=BIL seems doesnt work, and I can`t transfer it back.
Will gdal_calc work?
Can anyone give me some suggestion please? thanks in advance!

LiCSAR import broken

Using the example from docs to download LiCSAR data fails:

python3 -m kite.clients http://gws-access.ceda.ac.uk/public/nceo_geohazards/LiCSAR_products/6/006D_05509_131313/products/20171107_20171201/20171107_20171201.geo.unw.tif .

spool --load=./20171107_20171201.geo.unw.tif
QApplication: invalid style override passed, ignoring it.
Traceback (most recent call last):
  File "/usr/local/bin/spool", line 11, in <module>
    load_entry_point('kite==1.3.0', 'console_scripts', 'spool')()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/spool/__main__.py", line 87, in main
    spool(import_file=ns.load)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 304, in spool
    spool_app = Spool(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 42, in __init__
    self.importScene(import_file)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 58, in importScene
    self.spool_win.model.importFile(filename)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/spool/scene_model.py", line 134, in importFile
    self.setScene(Scene.import_data(filename))
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/scene.py", line 431, in dynclassmethod
    return func(Scene(), *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/scene.py", line 907, in _import_data
    raise ImportError('Could not recognize format for %s' % path)
ImportError: Could not recognize format for ./20171107_20171201.geo.unw.tif

installation error of kite

i am getting following error while excuting the below command

sudo python3 setup.py install

building 'covariance_ext' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/python3.4m -c src/ext/covariance.c -o build/temp.linux-x86_64-3.4/src/ext/covariance.o -fopenmp
src/ext/covariance.c:5:20: fatal error: Python.h: No such file or directory
 #include "Python.h"
                    ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Talpa: Set refrence of scene frame

Setting a Lat/Lon refrence to the frame would be helpful for forward modelling. Also alternatively loading in a coord frame to set reference and spatial sampling could be helpful (apart from a full reference scene load in)

Talpa: LOS Vectors

The los vectors need to be changeable as parameter.
Maybe even having two or more output windows for several individually changeable los projections would be helpful. This would allow e.g. asc and dsc modelling at the same time in one view,

import bug

Hello.
I believe there is an import bug in the "covariance.py" code since fftpack is not an attribute of scipy but a subpackage.
import scipy.fftpack after the scipy import line fixed it for my python/scipy versions.
Regards,
R

scene reopening explotion of memory consumption

Current dev branch
First, used spool to load and configure, subsample, APS correction, covariance calculation etc everything worked fine and very smooth and fast! Saved that to a kite scene.

Second, reopening the same saved scene in spool again seems impossible at least on my machine.
The logger spams "applying APS to displacment" as it seems to be in some loop
Memory consumption goes up from 1.8GB above 8GB fills the swap of 2GB and I have to reset and restart my computer to get control again.

I am lost where the loop is occuring, in the plugin_init.apply it loops only over all the available plugins which is just four ... maybe it somehow loops over quadtree leaves?

APS correction and UTM Format scenes

Seems to be an issue that scenes in UTM coordinates are not associated correctly to SRTMGL3 tiles.

INFO:Scene.APS:Applying APS model to displacement
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/base.py", line 75, in run
    plot.model)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/tab_scene.py", line 93, in <lambda>
    ['Scene.displacement', lambda sp: sp.scene.displacement],
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/scene.py", line 815, in displacement
    plugin.apply(self._proc_displacement)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/aps.py", line 78, in apply
    elevation = scene.get_elevation()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/scene.py", line 697, in get_elevation
    'Region is outside of SRTMGL3 topo dataset')
AssertionError: Region is outside of SRTMGL3 topo dataset
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/tab_aps.py", line 168, in update
    elevation, displacement = aps.get_data()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/aps.py", line 59, in get_data
    elevation = self.get_elevation()[rowmin:rowmax, colmin:colmax]
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/aps.py", line 22, in get_elevation
    return self.scene.get_elevation()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/scene.py", line 697, in get_elevation
    'Region is outside of SRTMGL3 topo dataset')
AssertionError: Region is outside of SRTMGL3 topo dataset

flip of Easting and Northing in spool

Loading descending data sets from GAMMA input with spool, the easting and northing components get flipped. Looks like the same issue occurs with matlab input. E.g. also in the documentation figure of spool the Myanmar earthquake coordinates are flipped.

Error on Spool File Load Scene

Having a Scene open and trying to load another ....

Current Master
Using the File--> Load Scene

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/util/__init__.py", line 220, in unsubscribe
    self._listeners.remove(listener)
ValueError: list.remove(x): x not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 297, in onOpenScene
    self.model.loadFile(filename)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/scene_model.py", line 180, in loadFile
    self.setScene(Scene.load(filename))
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/scene_model.py", line 72, in setScene
    self.disconnectSlots()
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/spool/scene_model.py", line 91, in disconnectSlots
    self.sigSceneChanged.emit)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.4.0-py3.6-linux-x86_64.egg/kite/util/__init__.py", line 222, in unsubscribe
    raise AttributeError('%s was not subscribed!', listener.__name__)
AttributeError: ('%s was not subscribed!', 'emit')

scene load licsar

In which pyrocko branch is this supposed to be? I checked master, sparrow7 and dev

spool --load=./20171107_20171201.geo.unw.tif
Traceback (most recent call last):
  File "/usr/local/bin/spool", line 11, in <module>
    load_entry_point('kite==1.3.0', 'console_scripts', 'spool')()
  File "/home/vasyurhm/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/vasyurhm/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/home/vasyurhm/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/home/vasyurhm/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/spool/__init__.py", line 2, in <module>
    from .spool import Spool, spool
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/spool/spool.py", line 13, in <module>
    from .scene_model import SceneModel
  File "/usr/local/lib/python3.6/dist-packages/kite-1.3.0-py3.6-linux-x86_64.egg/kite/spool/scene_model.py", line 6, in <module>
    from pyrocko.dataset.util import set_download_callback as\
ModuleNotFoundError: No module named 'pyrocko.dataset.util'

test files

Hi,

I faced error when I run test files.The common.py is in the same folder.woudl you please guide me how to solve this problem

best,
Mohammad

earth@naranj:~/Software/pyrocko/kite/test$ python test_source_okada.py
Traceback (most recent call last):
  File "test_source_okada.py", line 9, in <module>
    from . import common
ValueError: Attempted relative import in non-package

Problems importing GMTSAR data

Hello,
I processed the image using GMTSAR, and after processing, converted the los.grd deformation to m, and generated the los.enu data. But after I import the data, the following problem occurs.

(grond) wang@K:/media/wang/dec2022/merge$ spool --load unwrap_ll.grd
Traceback (most recent call last):
  File "/home/wang/anaconda3/envs/grond/bin/spool", line 8, in <module>
    sys.exit(main())
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/kite/spool/__main__.py", line 95, in main
    spool(import_file=ns.load)
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/kite/spool/spool.py", line 405, in spool
    spool_app = Spool(*args, **kwargs)
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/kite/spool/spool.py", line 48, in __init__
    self.importScene(import_file)
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/kite/spool/spool.py", line 64, in importScene
    self.spool_win.model.importFile(filename)
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/kite/spool/scene_model.py", line 174, in importFile
    self.setScene(Scene.import_data(filename))
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/kite/scene.py", line 494, in dynclassmethod
    return func(Scene(), *args, **kwargs)
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/kite/scene.py", line 1013, in _import_data
    data = module.read(path, **kwargs)
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/kite/scene_io.py", line 815, in read
    grd = netcdf.netcdf_file(self._getDisplacementFile(path),
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/scipy/io/_netcdf.py", line 277, in __init__
    self._read()
  File "/home/wang/anaconda3/envs/grond/lib/python3.8/site-packages/scipy/io/_netcdf.py", line 598, in _read
    raise TypeError("Error: %s is not a valid NetCDF 3 file" %
TypeError: Error: /media/wang/WJY/menyuandec2022/merge/unwrap_ll.grd is not a valid NetCDF 3 file

How can I import the data?

Wrong geocoding of latitude of Gamma files

In kite, when importing a Gamma file, the the corner latitude is computed from the number of columns of the interferogram, but it should be the number of lines.

Line 439 in scene_io.py must read:

c.frame.llLat = params['corner_lat'] + params['post_lat'] * nlines

instead of

c.frame.llLat = params['corner_lat'] + params['post_lat'] * nrows

(and nrows could be renamed to ncols, for clarity)

Cheers Wasja

how to import kite python2 saved scenes to new python3

I am getting the error below, the scene tab shows correctly the data, but in the quadtree tab everything is Nan, the covariance tab does not exist- maybe didnt get loaded due to the error?
Any instructions on how to correctly import the old format? What did change significantly? I guess somewhat the frame?
I would really like to be able to reuse my old quadtree parameters.

WARNING:Scene.Frame:Importing an old kite format...
 Please check your pixel spacing - dE, dN!
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py", line 147, in buildViews
    self.addView(v)
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py", line 152, in addView
    view = view(self)
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/tab_covariance.py", line 51, in __init__
    KiteStructureFunction(covariance_plot),
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/tab_covariance.py", line 348, in __init__
    self.update()
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/tab_covariance.py", line 353, in update
    struc, dist = covariance.getStructure()
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/covariance.py", line 1004, in getStructure
    return self.structure_spatial
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/util.py", line 142, in cache_return
    instance.__dict__[var_name] = func(instance)
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/covariance.py", line 965, in structure_spatial
    self.covariance_spatial
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/util.py", line 142, in cache_return
    instance.__dict__[var_name] = func(instance)
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/covariance.py", line 857, in covariance_spatial
    noise_data = self.noise_data.ravel()
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/covariance.py", line 298, in noise_data
    self.noise_data = self.scene.displacement[slice_N, slice_E]
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/covariance.py", line 310, in noise_data
    data = derampMatrix(trimMatrix(data))
  File "/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/util.py", line 99, in trimMatrix
    raise ValueError('Displacement is all NaN.')
ValueError: Displacement is all NaN.

Kite Installation

Hello there! I have a little trouble trying to install Kite, so I installed kite using pip with:

sudo pip install git+https://github.com/pyrocko/kite.git

Apparently everything worked fine as we can see here:

screenshot

But when I try to call kite, i get the infamous error No module named 'kite' I suppose it has to do with the PATHS but I don´t know, all suggestions are welcome.

Thanks a lot!

Reader for ARIA standard product

Reader for ARIA standard InSAR product (GUNW)

Following on the earlier discussion we had on the https://git.pyrocko.org/pyrocko/pyrocko/issues/7. Probably the best would be to add a generic GDAL reader for unwrapped phase, incidence, azimuth angles with an option to detail perhaps the original data source such the sign convention of the product can be tracked. e.g. ISCE geocoded files are GDAL compatible with its vrt meta-data, GMTSAR .grd files are also GDAL compatible.

ARIA products and ARIA-tools are fully compatible with GDAL>=3, i.e. have no-data values, projection and transformation included. But where the sign conventions are:

  • Phase to be positive for upward motion
  • the azimuth angle is counter-clock wise positive from the east from the target to the satellite

Sample GUNW product for Ridgecrest EQ

Here is a link to the ARIA GUNW (netcdf4) product for the Ridgecrest earthquake:

wget https://aria-products.jpl.nasa.gov/search/dataset/grq_v2.0.2_s1-gunw-released/S1-GUNW-A-R-064-tops-20190803_20180703-015014-36885N_35006N-PP-d1bd-v2_0_2/S1-GUNW-A-R-064-tops-20190803_20180703-015014-36885N_35006N-PP-d1bd-v2_0_2.nc

Screen Shot 2019-08-29 at 7 11 51 PM

You need at least GDAL3 to recognize the file correctly as a netcdf.

gdalinfo S1-GUNW-A-R-064-tops-20190803_20180703-015014-36885N_35006N-PP-d1bd-v2_0_2.nc
Driver: netCDF/Network Common Data Format
Files: S1-GUNW-A-R-064-tops-20190803_20180703-015014-36885N_35006N-PP-d1bd-v2_0_2.nc

The file is a CF complied netcdf4. See the ARIA website for a full description of the formatting: https://aria.jpl.nasa.gov/node/97. Below summarizing the key points:

  1. The netcdf has various groups with in them the datasets.
  2. Unwrapped filtered phase, filtered coherence, interferogram amplitude, connected component are all provided at 3arcsec sampling and are 2D maps.
  3. baselines, incidence angles, azimuth angles are provided on a courser 0.1 degree sampling at fixed height levels for data-reduction purposes.

The example below shows how to extract for example the unwrapped filtered phase.

gdal_translate -of vrt NETCDF:"S1-GUNW-A-R-064-tops-20190803_20180703-015014-36885N_35006N-PP-d1bd-v2_0_2.nc":/science/grids/data/unwrappedPhase unwrappedPhase.vrt

To retrieve its projection and no-data from the vrt file

gdalinfo unwrappedPhase.vrt
Corner Coordinates:
Upper Left  (-119.4637500,  36.8854167) ( 36d53' 7.50"E,119d27'49.50"S)
Lower Left  (-119.4637500,  35.0054167) ( 35d 0'19.50"E,119d27'49.50"S)
Upper Right (-116.2145833,  36.8854167) ( 36d53' 7.50"E,116d12'52.50"S)
Lower Right (-116.2145833,  35.0054167) ( 35d 0'19.50"E,116d12'52.50"S)
Center      (-117.8391667,  35.9454167) ( 35d56'43.50"E,117d50'21.00"S)
Band 1 Block=128x128 Type=Float32, ColorInterp=Undefined
  NoData Value=0
  Unit Type: rad
  Metadata:
    description=Unwrapped phase
    grid_mapping=crs
    long_name=unwrappedPhase
    NETCDF_VARNAME=unwrappedPhase
    standard_name=unwrappedPhase
    units=rad
    _FillValue=0

This is consistent with doing it directly from the netcdf file:

gdalinfo NETCDF:"S1-GUNW-A-R-064-tops-20190803_20180703-015014-36885N_35006N-PP-d1bd-v2_0_2.nc":/science/grids/data/unwrappedPhase

ARIA-tools

We have developed a suite of codes (ARIA-tools, https://github.com/aria-tools/ARIA-tools) that can help with cropping/stitching of data and generation of 2D imagingGeometry layers etc. The ARIA-tools output is again a GDAL compatible file with projection, transformation and no-data being set, so as long as there is a native reader for GDAL and perhaps the options to specifiy a source product type for file convention then this should be fine.

Here is an example of a notebook contributed by @bbuzz31: https://nbviewer.jupyter.org/github/aria-tools/ARIA-tools-docs/blob/master/JupyterDocs/ariaExtract/ariaExtract_tutorial.ipynb

The following command would extract the 2D maps for "unwrappedPhase", "incidenceAngle", "azimuthAngle" , and will also generate a DEM and watermask at the same sampling.

 ariaExtract.py -l "unwrappedPhase,incidenceAngle,azimuthAngle" -d download -m download -f S1-GUNW-A-R-064-tops-20190803_20180703-015014-36885N_35006N-PP-d1bd-v2_0_2.nc
***Extract Product Function:***
All (1) GUNW products meet spatial bbox criteria.
Group GUNW products into spatiotemporally continuous interferograms.
All (1) interferograms are spatially continuous.
Thread count specified for gdal multiprocessing = 2
Downloaded 3 arc-sec SRTM DEM here: ./DEM/SRTM_3arcsec.dem
Generating: unwrappedPhase
STITCH Settings: Product overlap approach
Solver: Minimize overlap
MAPPING complete:
Input file size is 3776, 2239
Warning 6: PNG driver doesn't support data type Float32. Only eight bit (Byte) and sixteen bit (UInt16) bands supported. Defaulting to Byte

0...10...20...30...40...50...60...70...80...90...100 - done.
Generating: incidenceAngle
Generating: azimuthAngle

I send the files via email.

If you do a gdalinfo on these files you can find the projection, trnasformation and no-data being embedded as well.

gdalinfo azimuthAngle/20190803_20180703
Driver: ENVI/ENVI .hdr Labelled
Files: azimuthAngle/20190803_20180703
       azimuthAngle/20190803_20180703.aux.xml
       azimuthAngle/20190803_20180703.hdr
Size is 3776, 2239
Coordinate System is:
GEOGCRS["GCS_unknown",
    DATUM["D_unnamed",
        ELLIPSOID["Spheroid",6378137,298.257223563,
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["Degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["longitude",east,
            ORDER[1],
            ANGLEUNIT["Degree",0.0174532925199433]],
        AXIS["latitude",north,
            ORDER[2],
            ANGLEUNIT["Degree",0.0174532925199433]]]
Data axis to CRS axis mapping: 1,2
Origin = (-119.454043278716995,36.872286361692403)
Pixel Size = (0.000833343676269,-0.000833200513347)
Metadata:
  Band_1=Band 1
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-119.4540433,  36.8722864) (119d27'14.56"W, 36d52'20.23"N)
Lower Left  (-119.4540433,  35.0067504) (119d27'14.56"W, 35d 0'24.30"N)
Upper Right (-116.3073376,  36.8722864) (116d18'26.42"W, 36d52'20.23"N)
Lower Right (-116.3073376,  35.0067504) (116d18'26.42"W, 35d 0'24.30"N)
Center      (-117.8806904,  35.9395184) (117d52'50.49"W, 35d56'22.27"N)
Band 1 Block=3776x1 Type=Float32, ColorInterp=Undefined
  NoData Value=0

Using GDAL in Python

ARIA-tools-docs also has a notebook that demo's how to use GDAL in python for opening files, extracting meta-data including the no-data value. See this notebook contributed by @ehavazli. https://nbviewer.jupyter.org/github/aria-tools/ARIA-tools-docs/blob/master/JupyterDocs/GDAL_basics/GDAL_basics.ipynb

TypeError: object of type 'NoneType' has no len()

Hi
I am new in python.
I want to import my mat file but I encounter with the following error:

In [17]: scene = Scene.import_data('CSK20160614-20160625asc.mat')

TypeError Traceback (most recent call last)
in
----> 1 scene = Scene.import_data('CSK20160614-20160625asc.mat')

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/scene.py in dynclassmethod(*args, **kwargs)
403 return func(*args, **kwargs)
404 else:
--> 405 return func(Scene(), *args, **kwargs)
406
407 dynclassmethod.doc = func.doc

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/scene.py in _import_data(self, path, **kwargs)
797 scene._log.debug('Importing %s using %s module' %
798 (path, mod))
--> 799 data = module.read(path, **kwargs)
800 break
801 if data is None:

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/scene_io.py in read(self, filename, **kwargs)
168 theta0 = mat[mat_k].flatten()
169
--> 170 if len(theta0) == 1:
171 c.theta = num.ones(num.shape(c.displacement)) * theta0
172

TypeError: object of type 'NoneType' has no len()

Tool to click-mask a scene

Hi,

I have a little script to mask a kite scene, i.e. set the displacement to NaN where there are for example unwrapping errors, using a matplotlib window and a matplotlibs ginput() method.

I would like to make this a method of BaseScene but just wonder what would be the kite-way of doing so.

My idea is to add a method BaseScene.click_mask(). When the method is called, a matplotlib window opens, one clicks a polygon around the area to be masked, finishes with a double click and the Scene would be masked.

Now, when implementing this, I wonder whether I would directly set the displacement to NaN or rather set the displacement_mask to True? I'm right now doing the former, but would prefer the latter. However I don't understand why displacement_mask is implemented as it is. How would I set arbitrary elements to True without manipulating displacement?

importing unwrapped displacement with spool

Hi
I want to use kite and importing grd file and sent to spool, but the following error occurs:

In [5]: import gdal                                                             
In [6]: ds = gdal.Open('dataset',gdal.GA_ReadOnly)                              
ERROR 4: dataset: No such file or directory
In [7]: ds = gdal.Open('dataset.grd',gdal.GA_ReadOnly)                          
In [8]: ds_geo = ds.GetGeoTransform()                                           
In [9]: phs_band = ds.GetRasterBand(1)                                          
In [10]: los = phs_band.ReadAsArray(0, 0, ds.RasterXSize, ds.RasterYSize)       
In [11]: sc = Scene()                                                           
In [12]: sc.displacement = los                                                  
In [13]: sc.frame.llLat = ds_geo[3] + ds_geo[5] * ds.RasterYSize                
In [14]: sc.frame.llLon = ds_geo[0]                                             
In [15]: sc.frame.dN = -ds_geo[5]                                               
In [16]: sc.frame.dE = ds_geo[1]                                                
In [17]: sc.frame.spacing = 'degree'                                            
In [18]: sc.spool()                                                             
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py in buildViews(self)
    148             return
    149         for v in self.views:
--> 150             self.addView(v)
    151         self.model.sigProcessingStarted.connect(
    152             self.processingStarted,

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py in addView(self, view)
    155     def addView(self, view):
    156         self.sigLoadingModule.emit(view.title)
--> 157         view = view(self)
    158         QtCore.QCoreApplication.processEvents()
    159         self.tabs.addTab(view, view.title)

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/tab_scene.py in __init__(self, spool)
     21         model = spool.model
     22 
---> 23         scene_plot = KiteScenePlot(model)
     24         self.main_widget = scene_plot
     25         self.tools = {

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/tab_scene.py in __init__(self, model)
     79         self._component = 'displacement'
     80 
---> 81         KitePlot.__init__(self, model=model, los_arrow=True)
     82 
     83         model.sigFrameChanged.connect(self.onFrameChange)

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/base.py in __init__(self, model, los_arrow)
    173 
    174         if los_arrow:
--> 175             self.addLOSArrow()
    176 
    177         # self.addIsocurve()

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/base.py in addLOSArrow(self)
    179 
    180     def addLOSArrow(self):
--> 181         self.los_arrow = LOSArrow(self.model)
    182         self.los_arrow.setParentItem(self.graphicsItem())
    183         self.los_arrow.anchor(

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/base.py in __init__(self, model)
     70         #     "Helvetica", weight=QtGui.QFont.DemiBold))
     71 
---> 72         self.orientArrow()
     73         self.model.sigSceneChanged.connect(self.orientArrow)
     74         self.setFlag(self.ItemIgnoresTransformations)

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/base.py in orientArrow(self)
     76     @QtCore.pyqtSlot()
     77     def orientArrow(self):
---> 78         phi = num.nanmedian(self.model.scene.phi)
     79         theta = num.nanmedian(self.model.scene.theta)
     80 

/usr/local/lib/python3.5/dist-packages/numpy/lib/nanfunctions.py in nanmedian(a, axis, out, overwrite_input, keepdims)
   1020 
   1021     r, k = function_base._ureduce(a, func=_nanmedian, axis=axis, out=out,
-> 1022                                   overwrite_input=overwrite_input)
   1023     if keepdims and keepdims is not np._NoValue:
   1024         return r.reshape(k)

/usr/local/lib/python3.5/dist-packages/numpy/lib/function_base.py in _ureduce(a, func, **kwargs)
   3248         keepdim = (1,) * a.ndim
   3249 
-> 3250     r = func(a, **kwargs)
   3251     return r, keepdim
   3252 

/usr/local/lib/python3.5/dist-packages/numpy/lib/nanfunctions.py in _nanmedian(a, axis, out, overwrite_input)
    896         part = a.ravel()
    897         if out is None:
--> 898             return _nanmedian1d(part, overwrite_input)
    899         else:
    900             out[...] = _nanmedian1d(part, overwrite_input)

/usr/local/lib/python3.5/dist-packages/numpy/lib/nanfunctions.py in _nanmedian1d(arr1d, overwrite_input)
    879     """
    880     arr1d, overwrite_input = _remove_nan_1d(arr1d,
--> 881         overwrite_input=overwrite_input)
    882     if arr1d.size == 0:
    883         return np.nan

/usr/local/lib/python3.5/dist-packages/numpy/lib/nanfunctions.py in _remove_nan_1d(arr1d, overwrite_input)
    130     """
    131 
--> 132     c = np.isnan(arr1d)
    133     s = np.nonzero(c)[0]
    134     if s.size == arr1d.size:

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-18-e85825dda3ba> in <module>
----> 1 sc.spool()

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/scene.py in spool(self)
    684 
    685         from kite.spool import spool
--> 686         spool(scene=self)
    687 
    688     def _testImport(self):

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py in spool(*args, **kwargs)
    245 
    246 def spool(*args, **kwargs):
--> 247     spool_app = Spool(*args, **kwargs)
    248     spool_app.exec_()
    249     spool_app.quit()

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py in __init__(self, scene, import_file, load_file)
     38 
     39         if scene is not None:
---> 40             self.addScene(scene)
     41         elif import_file is not None:
     42             self.importScene(import_file)

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py in addScene(self, scene)
     53 
     54     def addScene(self, scene):
---> 55         self.spool_win.addScene(scene)
     56 
     57     def importScene(self, filename):

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py in addScene(self, scene)
    140     def addScene(self, scene):
    141         self.model.setScene(scene)
--> 142         self.buildViews()
    143 
    144     def buildViews(self):

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py in buildViews(self)
    148             return
    149         for v in self.views:
--> 150             self.addView(v)
    151         self.model.sigProcessingStarted.connect(
    152             self.processingStarted,

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/spool.py in addView(self, view)
    155     def addView(self, view):
    156         self.sigLoadingModule.emit(view.title)
--> 157         view = view(self)
    158         QtCore.QCoreApplication.processEvents()
    159         self.tabs.addTab(view, view.title)

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/tab_scene.py in __init__(self, spool)
     21         model = spool.model
     22 
---> 23         scene_plot = KiteScenePlot(model)
     24         self.main_widget = scene_plot
     25         self.tools = {

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/tab_scene.py in __init__(self, model)
     79         self._component = 'displacement'
     80 
---> 81         KitePlot.__init__(self, model=model, los_arrow=True)
     82 
     83         model.sigFrameChanged.connect(self.onFrameChange)

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/base.py in __init__(self, model, los_arrow)
    173 
    174         if los_arrow:
--> 175             self.addLOSArrow()
    176 
    177         # self.addIsocurve()

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/base.py in addLOSArrow(self)
    179 
    180     def addLOSArrow(self):
--> 181         self.los_arrow = LOSArrow(self.model)
    182         self.los_arrow.setParentItem(self.graphicsItem())
    183         self.los_arrow.anchor(

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/base.py in __init__(self, model)
     70         #     "Helvetica", weight=QtGui.QFont.DemiBold))
     71 
---> 72         self.orientArrow()
     73         self.model.sigSceneChanged.connect(self.orientArrow)
     74         self.setFlag(self.ItemIgnoresTransformations)

/usr/local/lib/python3.5/dist-packages/kite-2018.2.26-py3.5-linux-x86_64.egg/kite/spool/base.py in orientArrow(self)
     76     @QtCore.pyqtSlot()
     77     def orientArrow(self):
---> 78         phi = num.nanmedian(self.model.scene.phi)
     79         theta = num.nanmedian(self.model.scene.theta)
     80 

/usr/local/lib/python3.5/dist-packages/numpy/lib/nanfunctions.py in nanmedian(a, axis, out, overwrite_input, keepdims)
   1020 
   1021     r, k = function_base._ureduce(a, func=_nanmedian, axis=axis, out=out,
-> 1022                                   overwrite_input=overwrite_input)
   1023     if keepdims and keepdims is not np._NoValue:
   1024         return r.reshape(k)

/usr/local/lib/python3.5/dist-packages/numpy/lib/function_base.py in _ureduce(a, func, **kwargs)
   3248         keepdim = (1,) * a.ndim
   3249 
-> 3250     r = func(a, **kwargs)
   3251     return r, keepdim
   3252 

/usr/local/lib/python3.5/dist-packages/numpy/lib/nanfunctions.py in _nanmedian(a, axis, out, overwrite_input)
    896         part = a.ravel()
    897         if out is None:
--> 898             return _nanmedian1d(part, overwrite_input)
    899         else:
    900             out[...] = _nanmedian1d(part, overwrite_input)

/usr/local/lib/python3.5/dist-packages/numpy/lib/nanfunctions.py in _nanmedian1d(arr1d, overwrite_input)
    879     """
    880     arr1d, overwrite_input = _remove_nan_1d(arr1d,
--> 881         overwrite_input=overwrite_input)
    882     if arr1d.size == 0:
    883         return np.nan

/usr/local/lib/python3.5/dist-packages/numpy/lib/nanfunctions.py in _remove_nan_1d(arr1d, overwrite_input)
    130     """
    131 
--> 132     c = np.isnan(arr1d)
    133     s = np.nonzero(c)[0]
    134     if s.size == arr1d.size:

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

trouble installing - Symbol not found: _GOMP_parallel

I've cloned the repo and tried installing with python setup.py install, pip install -e ., pip install ..

Installation is successful but when I import kite I get:

ImportError                               Traceback (most recent call last)
<ipython-input-2-366e0b4292fe> in <module>
----> 1 import kite

~/miniconda3/lib/python3.7/site-packages/kite/__init__.py in <module>
      2 import pkg_resources
      3 
----> 4 from .scene import Scene, TestScene, read  # noqa
      5 from .quadtree import Quadtree  # noqa
      6 from .covariance import Covariance  # noqa

~/miniconda3/lib/python3.7/site-packages/kite/scene.py in <module>
     10 
     11 from kite.quadtree import QuadtreeConfig
---> 12 from kite.covariance import CovarianceConfig
     13 from kite.util import Subject, property_cached
     14 from kite import scene_io

~/miniconda3/lib/python3.7/site-packages/kite/covariance.py in <module>
      5 import time
      6 
----> 7 from kite import covariance_ext
      8 from pyrocko import guts
      9 from pyrocko.guts_array import Array

ImportError: dlopen(/Users/shahar/miniconda3/lib/python3.7/site-packages/kite/covariance_ext.cpython-37m-darwin.so, 2): Symbol not found: _GOMP_parallel
  Referenced from: /Users/shahar/miniconda3/lib/python3.7/site-packages/kite/covariance_ext.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Users/shahar/miniconda3/lib/python3.7/site-packages/kite/covariance_ext.cpython-37m-darwin.so

I am on macOSv10.12.6 with anaconda3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.