All Projects → claudiodsf → nllgrid

claudiodsf / nllgrid

Licence: other
Python class for reading and writing NLLoc grid files.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to nllgrid

etas
calibrate ETAS, simulate using ETAS, estimate completeness magnitude & magnitude frequency distribution
Stars: ✭ 37 (+60.87%)
Mutual labels:  seismology, earthquakes
QuakeMigrate
A Python package for automatic earthquake detection and location using waveform migration and stacking.
Stars: ✭ 101 (+339.13%)
Mutual labels:  research, seismology
Lazylyst
Lazylyst is a GUI created for time series review, using a flexible framework for new workflows
Stars: ✭ 16 (-30.43%)
Mutual labels:  seismology, earthquakes
WalkTheWeb
WalkTheWeb 3D Internet - Metaverse - Multiverse - Host your own multiplayer Metaverse of 3D Games, 3D Shopping, and 3D Scenes!
Stars: ✭ 28 (+21.74%)
Mutual labels:  3d-models
SeisNoise.jl
Ambient Noise Cross-Correlation in Julia
Stars: ✭ 43 (+86.96%)
Mutual labels:  seismology
alchemy
Experiments logging & visualization
Stars: ✭ 49 (+113.04%)
Mutual labels:  research
manifold mixup
Tensorflow implementation of the Manifold Mixup machine learning research paper
Stars: ✭ 24 (+4.35%)
Mutual labels:  research
SOMns
SOMns: A Newspeak for Concurrency Research
Stars: ✭ 62 (+169.57%)
Mutual labels:  research
assembly improvement
Improve the quality of a denovo assembly by scaffolding and gap filling
Stars: ✭ 46 (+100%)
Mutual labels:  research
Manifest
Manifest is an investigative toolkit intended for researchers, journalists, students, and scholars interested in visualizing, analyzing, and documenting supply chains, production lines, and trade networks.
Stars: ✭ 12 (-47.83%)
Mutual labels:  research
sl2influxdb
Fetch seedlink data and store them into InfluxDB
Stars: ✭ 28 (+21.74%)
Mutual labels:  seismology
WebGL-Hole-Filling
Master project. Read a 3D model in a format like OBJ, display it per WebGL and provide tools to fill holes in the model.
Stars: ✭ 18 (-21.74%)
Mutual labels:  3d-models
lightning-hydra-template
PyTorch Lightning + Hydra. A very user-friendly template for rapid and reproducible ML experimentation with best practices. ⚡🔥⚡
Stars: ✭ 1,905 (+8182.61%)
Mutual labels:  research
mcthings
A Python framework for creating 3D scenes in Minecraft and Minetest
Stars: ✭ 44 (+91.3%)
Mutual labels:  3d-models
day2night
Image2Image Translation Research
Stars: ✭ 46 (+100%)
Mutual labels:  research
aws-greengrass-mini-fulfillment
An example of AWS Greengrass used in a miniature fulfillment center.
Stars: ✭ 45 (+95.65%)
Mutual labels:  3d-models
showstopper
ShowStopper is a tool for helping malware researchers explore and test anti-debug techniques or verify debugger plugins or other solutions that clash with standard anti-debug methods.
Stars: ✭ 132 (+473.91%)
Mutual labels:  research
covid19 scenarios data
Data preprocessing scripts and preprocessed data storage for COVID-19 Scenarios project
Stars: ✭ 43 (+86.96%)
Mutual labels:  research
vasaro
Vasaro let you create 3d printable vases in a snap.
Stars: ✭ 30 (+30.43%)
Mutual labels:  3d-models
portfoliolab
PortfolioLab is a python library that enables traders to take advantage of the latest portfolio optimisation algorithms used by professionals in the industry.
Stars: ✭ 104 (+352.17%)
Mutual labels:  research

NLLGrid

Python class for reading and writing NonLinLoc grid files.

(c) 2015-2022 Claudio Satriano, Natalia Poiata

cf-badge PyPI-badge license-badge

Installation

Using Anaconda

If you use Anaconda, the latest release of nllgrid is available via conda-forge.

To install, simply run:

conda install -c conda-forge nllgrid

Using pip and PyPI

The latest release of nllgrid is available on the Python Package Index.

You can install it easily through pip:

pip install nllgrid

From nllgrid GitHub releases

Download the latest release from the releases page, in zip or tar.gz format, then:

pip install nllgrid-X.Y.zip

or

pip install nllgrid-X.Y.tar.gz

Where, X.Y is the version number (e.g., 1.3). You don't need to uncompress the release files yourself.

From nllgrid GitHub repository

If you need a recent feature that is not in the latest release (see the unreleased section in CHANGELOG), you want to use the source code from the nllgrid GitHub repository.

For that, clone the project:

git clone https://github.com/claudiodsf/nllgrid.git

(avoid using the "Download ZIP" option from the green "Code" button, since version number is lost), then install the code from within the nllgrid main directory by running:

pip install .

(use pip install -e . to install in developer mode).

Getting Started

Reading a NLL grid

A NLL grid is composed of two files (.hdr and .buf).

To read a NLL grid, do:

>>> from nllgrid import NLLGrid
>>> grd = NLLGrid('somegrid.hdr')

or, using the .buf filename:

>>> grd = NLLGrid('somegrid.buf')

or even without any extension:

>>> grd = NLLGrid('somegrid')

A grid description can be obtained by:

>>> print(grd)

The grid data array is accessed by grd.array. The grid can be plotted doing:

>>> grd.plot()

Use Python introspection (e.g. dir(grd)) to see all the available methods and attributes.

Creating a NLL grid

Suppose that you have a 3D data array stored into a NumPy array called mydata.

First, create an empty NLL grid object:

>>> from nllgrid import NLLGrid
>>> grd = NLLGrid()

then, add the data array and information on grid sampling and grid origin, e.g.:

>>> grd.array = mydata
>>> grd.dx = 0.5  #km
>>> grd.dy = 0.5  #km
>>> grd.dz = 0.5  #km
>>> grd.x_orig = -10  #km
>>> grd.y_orig = -20. #km
>>> grd.z_orig = -1.  #km

Optionally, add a grid type and/or a geographic transformation:

>>> grd.type = 'VELOCITY'
>>> grd.orig_lat = 40.63
>>> grd.orig_lon = 15.80
>>> grd.proj_name = 'LAMBERT'
>>> grd.first_std_paral = 38.
>>> grd.second_std_paral = 42.
>>> grd.proj_ellipsoid = 'WGS-84'

Finally, give a basename and write to disk:

>>> grd.basename = 'mygrid'
>>> grd.write_hdr_file()
>>> grd.write_buf_file()

This will create the two files mygrid.hdr and mygrid.buf.

If you want to save your grid in double precision (required for instance by NLDiffLoc), change grd.float_type to 'DOUBLE' before saving the grid (default is 'FLOAT'):

>>> grd.float_type = 'DOUBLE'

Note that if you want to use your grid as input for NonLinLoc Grid2Time code, the grid type has to be SLOW_LEN and your grid array has to be transformed into slowness (in s/km) and multiplied by the grid step (in km).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].