Comments (5)
@milankl great, thanks. Will add this to my current PRs. Feel free to close.
from speedyweather.jl.
Does it matter, it will be overwritten anyway? To initialise arrays as with NaNs we would need to do
julia> fill(convert(NF,NaN),2,3)
2×3 Matrix{Float16}:
NaN NaN NaN
NaN NaN NaN
for example, such that for ever NF<:AbstractFloat
there needs to a conversion from NaN to whatever NaN corresponds to in NF.
from speedyweather.jl.
Sometime is hard to distinguish unset or improperly used variables down at the bottom of the stack and for debugging and assertions having NaNs helps... If there is no difference in terms of performance etc, I think it would be safer to use NaNs where possible.
from speedyweather.jl.
No it's not a performance issue. In both cases memory is allocated and filled with bits. Doesn't matter what those are.
julia> using BenchmarkTools
julia> c = NaN
julia> @btime fill($c,1000,1000);
1.160 ms (2 allocations: 7.63 MiB)
julia> c = 0.0
julia> @btime fill($c,1000,1000);
1.163 ms (2 allocations: 7.63 MiB)
Note that in the dynamics we allocate with zeros, and I never had a debugging-related issue with this. Happy for you to convert the initialisation for ColumnVariables to init with NaN, if people prefer that. I would suggest to define
function nans(::Type{T},dims...) where T
return fill(convert(T,NaN),dims...)
end
in utility_functions.jl such that zeros(NF,...)
works as nans(NF,...)
julia> nans(Float16,2)
2-element Vector{Float16}:
NaN
NaN
julia> nans(Float32,2)
2-element Vector{Float32}:
NaN
NaN
from speedyweather.jl.
nans
has been added now ☝🏼
from speedyweather.jl.
Related Issues (20)
- [JOSS Review] questions + suggestions HOT 7
- [JOSS review] Zenodo archival HOT 5
- [JOSS Review] firstnames vs. initials in .bib file HOT 3
- Question about example in Docs/SpeedyTransforms/Geostrophy HOT 2
- Another simple radiation scheme HOT 14
- ☁️ Clouds? HOT 13
- Another not too simple radiation scheme
- Exoplanet context HOT 3
- Automatic performance testing HOT 9
- Precompilation Error HOT 2
- Add proper citations in Docs via DocumenterCitations.jl HOT 1
- JOSS review: text comments HOT 6
- Replace `PythonPlot` with a Julia-based plotting library in Docs HOT 2
- Verifying conserved quantities HOT 15
- Modified dynamics HOT 16
- PrimitiveDry and WetModel generation on Julia v1.9 hangs HOT 10
- The PrimitiveWetModel example fails HOT 10
- unbalanced initial condition for Galewsky Jet HOT 4
- ShallowWater dataset on PDEArena HOT 6
- Modularise netCDF output
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 speedyweather.jl.