Comments (4)
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.
@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.
Good spot! Your right, and I'll edit the original post.
from cfdm.
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)
- Subspaces of constructs can currently have one or more size 0 axes
- `Data.__str__` fails when the data contains date-times with the first element masked
- New "original filenames" methods
- Allow data to be omitted from netCDF files during `cfdm.write`
- Zero values reported by `repr` on fully-masked datetime arrays
- Slight change in `_FillValue` property value on write-read
- Creat new `SubsampledSubarray` subclass for the case of no standardised interpolation algorithm
- Document accepted argument types for `source` parameters
- (Document) rename of default branch from `master` to `main` HOT 1
- Relocate the call to `_customize_read_vars()` in `NetCDFRead.read`
- Improve source docstrings in `__init__` methods
- Prepare for v1.10.0.2 HOT 2
- New `ignore_properties` keyword to `cfdm.unique_constructs` HOT 1
- Incorrect `formula_terms` in output netCDF files in some cases
- External cell measure netCDF variable names are not always preserved by `cf.write`
- Allow file missing data indicator values to be stored on `NetCDFArray` instances
- Error from `Data.second_element` for some data shapes
- Make `cfdm.read` always return unicode strings from netCDF files HOT 1
- Error when writing to disk coordinates with a computed_standard_name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cfdm.