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

replace_missing should just do nothing if missingval is allready missing #63

Closed
rafaqz opened this issue Sep 7, 2020 · 3 comments · Fixed by #102
Closed

replace_missing should just do nothing if missingval is allready missing #63

rafaqz opened this issue Sep 7, 2020 · 3 comments · Fixed by #102

Comments

@rafaqz
Copy link
Owner

rafaqz commented Sep 7, 2020

Currently this throws:

MethodError: Cannot `convert` an object of type Missing to an object of type Float64

Which makes no sense

@ayushpatnaikgit
Copy link

Hi, I have the following Raster:

julia> dc
84×155×1×123 Raster{Float32,4} unnamed with dimensions: 
  X Mapped Float64[72.7250001018, 72.72916676850001, …, 73.0666667712, 73.0708334379] ForwardOrdered Explicit Intervals crs: EPSG mappedcrs: EPSG,
  Y Mapped Float64[19.495832889299994, 19.491666222599996, …, 18.858332884200003, 18.8541662175] ReverseOrdered Explicit Intervals crs: EPSG mappedcrs: EPSG,
  Band Categorical Int64[1] ReverseOrdered,
  Ti Sampled Int64[201204, 201205, …, 202205, 202206] ForwardOrdered Irregular Points
with missingval: missing

I want to do something like:

dc[1,1,1,1] = missing

I wish to do this because the list of missing observations is provided in a separate file, and I have to manually mark the missing observations.

But get the error that you have mentioned above.
Any suggestions?

I feel if missingval is missing, the Raster should automatically be Union{Missing, something}

Apologies, if this issue wasn't the most suitable place to ask this question.

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 8, 2022

Thanks I just forgot about this! I thought it had been fixed by #102

Edit: sorry I misunderstood the issue. If the missingval is missing but the array eltype is not missing, we should change the array eltype in replace_missing. Probably it shouldn't ever get in that state either - the missingval in your case should be nothing. I'm guessing this has been saved as a netcdf file at some point?

Probably good to make a new issue, pointing to this one, showing how the fix for this problem created another problem.

Also: please include a MWE with your issue, I want to fix the root cause of this - which I think is during loading a netcdf from file.

@ayushpatnaikgit
Copy link

Thanks, Rafael,
I'll open a new issue and share the .nc file.

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

Successfully merging a pull request may close this issue.

2 participants