Comments (6)
You should rename it to the previous name, plus the operation applied.
from dimensionaldata.jl.
Broadcasting is a huge use case of DimArray
and arrays generally in Julia. Its how everything works internally in Rasters.jl - DiskArrays.jl has lazy broadcasting over big data so we leverage this.
We could (should) allow you to specify the name in broadcast_dims
which we own - but it doesn't have the nice syntax of base broadcasting.
This is just a hard problem.
We want the best generic native julia syntax, and we want names to propagate intelligently.
from dimensionaldata.jl.
Yeah, there are for and against for this. I think the question isnt about broadcast but if similar
keeps the name or not.
Often the name says something about the data that the broadcast totally changes. And raw similar
contains no data and is completely uninitialised. So having a name is a bit odd.
But IDK, I also see your point. Im open to changing it. Maybe try a PR changing similar
and see what breaks.
from dimensionaldata.jl.
You should rename it to the previous name, plus the operation applied.
The use-case that prompted this issue was converting digital numbers into reflectance for satellite imagery. For example, calculating the surface-reflectance for Sentinel 2 imagery is done as follows:
sentinel .* 0.0001f0
In this case, if a layer has the name :B04
, I would like it to retain this after converting it to reflectance. Otherwise, downstream code that depends on the band name will break. The current solution is to rely on rebuild
to restore the original name, but this can be quite tedious in practice and is easy to forget about. Layer names could also get long after applying multiple operations in sequence, such as (landsat .* 0.0000275f0) .+ -0.2f0
.
from dimensionaldata.jl.
This is the problem, what to do in this case:
mycustomfunction.(sentinel .* 0.0001f0 .* some_other_dim_array.^2) ./ yet_another_dim_array
Its a broadcast just like yours, and at the level of similar
we cant tell which is which.
Doing what you want probably requires putting name rules into our broadcast mechanisms. Its possible, but not easy.
(Or we can let precedence win, maybe that will be predictable enough that users can rearrange their functions so the right name "wins" but even so should this still be called :B04
?)
from dimensionaldata.jl.
I suppose that one could use modify
in such cases, which will retain the name of the desired array. You could also extract the data of all arrays whose name you don't want to retain, so that only one operand is a DimArray
.
Perhaps we should consider that broadcasting directly over a DimArray
is a bad idea? As you pointed out, it can be difficult to determine the identity of the output array based solely on the input. It might be better to provide a method that requires users to specify the name of the output.
from dimensionaldata.jl.
Related Issues (20)
- Would it be useful to have Not() as a selector? HOT 4
- Makie extension throws StackOverflowError when dimensions have Unitful units HOT 4
- Dimensions of Observable(dd) are ignored in Makie 0.21 HOT 10
- Displaying one-dimensional `DimArray` does not quite work in Pluto HOT 8
- Performance of `broadcast_dims` on `DimStack` vs `DimArray` HOT 1
- Remove if VERSION checks HOT 1
- Plotting deprecations in tests
- Reduce number of warnings in tests HOT 1
- How can I create a 2D array using broadcasting? HOT 1
- MethodError: no method matching `copy(::X{LinRange{Float64, Int64}})`
- Selection of multiple surrounding pixels around a position HOT 3
- Add CodeCov upload token to fix codecov HOT 4
- friction in dimension-specific `mean` of a `groupby` HOT 4
- FR: Make `broadcast_dims` work with `DimArray`s and `Dimension`s HOT 3
- `mapslices` on `DimStack` HOT 3
- add `name` etc keywords to `DimArray` `similar` HOT 1
- Support `replace!` for `DimStack`s HOT 2
- typos HOT 6
- Explain difference of Interval and Range for Indexing HOT 1
- Weighted mean from `StatsBase` does not work on DimArray HOT 3
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 dimensionaldata.jl.