Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nomissing function #56

Closed
ctroupin opened this issue Jan 16, 2020 · 1 comment
Closed

nomissing function #56

ctroupin opened this issue Jan 16, 2020 · 1 comment

Comments

@ctroupin
Copy link
Member

In the docstring of nomissing:

a = nomissing(da)

Retun the values of the array da of type Array{Union{T,Missing},N} (potentially containing missing values) as a regular Julia array a of the same element type and checks that no missing values are present.

a = nomissing(da,value)

Retun the values of the array da of type Array{Union{T,Missing},N} as a regular Julia array a by replacing all missing value by value.

  1. I'm not sure 'checks that no missing values are present.' is clear. Maybe we should say return an error if the array contains at least one missing value
  2. Typo: Retun → Return
  3. Typo: arrays contains missing values...
    array contains missing values...
  4. replacing all missing value → values

Also note that the function coalesce is available in Base, we could use it

  • remove the missing values (if there are some) or
  • turn the array of type Array{Union{T,Missing},N} into a type Array{T,N} if there are no missing value.
@Alexander-Barth
Copy link
Member

I corrected the docs of NCDatasets, thanks! But I prefer to keep the function nomissing for now because it handles better the case where the data array is Float32 and the user uses a Float64 NaN.
The end-goal, is to be able to use missing everywhere (and in PyPlot in particular, JuliaPy/PyCall.jl#616)

julia> nomissing([1.0f0,2.0f0,missing],NaN)
3-element Array{Float32,1}:
   1.0
   2.0
 NaN  

julia> coalesce.([1.0f0,2.0f0,missing],NaN)
3-element Array{AbstractFloat,1}:
   1.0f0
   2.0f0
 NaN    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants