Setting all values except one to NaN
Added by Brendan DeTracey over 3 years ago
Hi everyone!
I am having difficulties with what should be a simple problem.
I want to convert my netcdf to a binary mask. I want to replace all values of mmask with NaN, except for 4. I then want to change all the 4 to 1. I am having difficulty thinking of the expr that will do this. :-(
| subsum_EM300_O2.nc (14.7 MB) subsum_EM300_O2.nc |
Replies (2)
RE: Setting all values except one to NaN - Added by Karin Meier-Fleischer over 3 years ago
Hi Brendan,
cdo -f nc -expr,'mmask = ((mmask == 4.0)) ? 1.0 : 0.0' subsum_EM300_O2.nc outfile.nc
RE: Setting all values except one to NaN - Added by Brendan DeTracey over 3 years ago
Danke, Karin! :)
The elusive double parenthisis parenthesis...