Git Product home page Git Product logo

Comments (2)

lucduron avatar lucduron commented on May 30, 2024

Dear Keith,

We developed some years ago a CLI script to extract a specific layer or compute the max/min/mean over the vertical:
https://github.com/CNR-Engineering/PyTelTools/blob/01335992e76c1c0be71ec37a6d0774e4c7ccf5e9/cli/slf_3d_to_2d.py

In pyteltools/slf/misc.py there is the computation of the weights for the mean:

# Compute dimensionless layer ponderations for mean operation
weight = None
if self.operation == MEAN:
diff_upper = z - np.roll(z, 1, axis=0)
diff_upper[0, :] = 0.0
diff_lower = np.roll(z, -1, axis=0) - z
diff_lower[-1, :] = 0.0
diff = (diff_upper + diff_lower) / 2
diff_sum = diff.sum(axis=0)
with np.errstate(divide='ignore', invalid='ignore'):
weight = diff / diff_sum
# weight.shape = (nb_planes, nb_nodes_2d)
# weight.sum(axis=0) = array([ 1., 1., 1., ..., 1., 1., 1.], dtype=float32)

The depth-averaged is then computed as:

var_3d = weight * computed_values[var]
vars_2d[i, :] = var_3d.sum(axis=0)

Hope it helps,
Luc

from pyteltools.

krober10nd avatar krober10nd commented on May 30, 2024

Thanks! That worked

from pyteltools.

Related Issues (20)

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.