Giter Site home page Giter Site logo

Comments (4)

davidhassell avatar davidhassell commented on September 26, 2024 1

Note - Whilst cfdm never said or trapped otherwise, this only ever really worked when all list indices (when there are at least two) were strictly monotonically increasing. This is because this code was back-ported from cf-python, which prior to v3.14 did insist on this (it was a LAMA thing). There is no need for this restriction in cf-python>=3.14, nor in cfdm.

from cfdm.

sadielbartholomew avatar sadielbartholomew commented on September 26, 2024

@davidhassell: whilst I am reviewing the associated PR, I just wanted to ask for clarity of describing the bug here: the first and second examples seems a bit confusing and contradictory to me, I am wondering if you wrote down quite what you meant? Namely, did you mean to put that the second example is 'OK' rather than 'NOT OK' since it seems to set the elements to -1 as asked? And then the first example says is covers all lists strictly monotonically increasing but the indices aren't in that case?

I was thinking the following were more like what I am understanding you want to refer to:

Example 1 (all lists strictly monotonically increasing)

In [4]: d[[0, 3, 4], [1, 6, 7]].array
Out[4]: 
array([[0.034, 0.024, 0.029],
       [0.059, 0.009, 0.017],
       [0.036, 0.034, 0.013]])

In [5]: d[[0, 3, 4], [1, 6, 7]] = -1

In [6]: d[[0, 3, 4], [1, 6, 7]].array  # OK!
Out[6]: 
array([[-1., -1., -1.],
       [-1., -1., -1.],
       [-1., -1., -1.]])

Example 2 (one list not strictly monotonically increasing, but in this case it works)

In [7]: d = cfdm.example_field(0).data

In [8]: d[[0, 3, 4], [1, 7, 6]].array
Out[8]: 
array([[0.034, 0.029, 0.024],
       [0.059, 0.017, 0.009],
       [0.036, 0.013, 0.034]])

In [9]: d[[0, 3, 4], [1, 7, 6]] = -1

In [10]: d[[0, 3, 4], [1, 7, 6]].array  # OK!
Out[10]: 
array([[-1., -1., -1.],
       [-1., -1., -1.],
       [-1., -1., -1.]])

from cfdm.

davidhassell avatar davidhassell commented on September 26, 2024

Good spot! Your right, and I'll edit the original post.

from cfdm.

sadielbartholomew avatar sadielbartholomew commented on September 26, 2024

Good spot! Your right, and I'll edit the original post.

Thanks for checking. It helps to know I am understanding correctly the issue I am meant to be reviewing on 🙂

from cfdm.

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.