Dear NCO-experts, I want to remove gridpoints in a netcdf file above a certain threshold. For example, I just to retain all points with rainfall below 20mm.
I have not found any one line command in the nco example page. Is this possible in NCO?
I found this: http://nco.sourceforge.net/nco.html#Mask-condition
but it is accompanied by an ncwa command. I am not going to perform a weighted average.
I'll appreciate any help.
I do it like this:
ncap2 -O -s 'where(rainfall>=20)rainfall=-9999' in.nc out.nc
This assumes that your variable is named 'rainfall' and that the _FillValue attribute for it is set to -9999.
Many Thanks Sir John for the help!
Log in to post a comment.
Dear NCO-experts,
I want to remove gridpoints in a netcdf file above a certain threshold.
For example, I just to retain all points with rainfall below 20mm.
I have not found any one line command in the nco example page. Is this possible in NCO?
I found this:
http://nco.sourceforge.net/nco.html#Mask-condition
but it is accompanied by an ncwa command. I am not going to perform a weighted average.
I'll appreciate any help.
Last edit: Lyndon Mark Olaguera 2017-06-28
I do it like this:
ncap2 -O -s 'where(rainfall>=20)rainfall=-9999' in.nc out.nc
This assumes that your variable is named 'rainfall' and that the _FillValue attribute for it is set to -9999.
Last edit: John 2017-06-28
Many Thanks Sir John for the help!