Giter VIP home page Giter VIP logo

nllgrid's People

Contributors

claudiodsf avatar filefolder 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nllgrid's Issues

hdr file not being read properly

Hiya Claudio, nice to see you at work on this lately

I think there is a minor glitch in NLLGrid because I can no longer read the .hdr files properly, reading the file (e.g. grd = nllgrid.NLLGrid('P.mod')) outputs the default values instead of the actual ones.

~ line 203

    def __init__(self,
                 basename=None,
                 nx=1, ny=1, nz=1,
                 x_orig=0., y_orig=0., z_orig=0.,
                 dx=1., dy=1., dz=1.):
        """
        Initialize a NLLGrid object.

        If `basename` is not `None`, `read_hdr_file` and `read_buf_file`
        methods are called.
        """
        if basename is not None:
            self.basename = self.remove_extension(basename)
            self.read_hdr_file()
            self.read_buf_file()
        else:
            self.basename = None
        self.nx = nx
        self.ny = ny
        self.nz = nz
        self.x_orig = x_orig
        self.y_orig = y_orig
        self.z_orig = z_orig
        self.dx = dx
        self.dy = dy
        self.dz = dz

Seems like the last 9 lines need to be indented under the else clause because otherwise they will always output 1, 1, 1, 0, 0 etc even if basename is not None

Some recommendations for improvements

Hi @claudiodsf, nice helper project!

Here's some initial observations for potential improvements in the future:

  • with very large models it can be problematic to read the full file into memory, maybe using something like numpy memmap might be a good idea, to only always read those data needed to plot the 2D slices?
  • the plot() parameter slice_index is a bit awkward, I think, why not make it possible to directly specify coordinates (x, y and z) instead of indices (that you have to compute first from the coordinates and grid spacing) to use for the slices (e.g. to specify the x/y coordinates of a station, to plot the model slices going through that station)
  • maybe add an option to plot SLOW_LEN (model) grids as seismic velocity instead?

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.