David
David

Reputation: 835

ncdump - How do I convert .nc to text without including nodata values?

I have a .nc file that I convert to text using the following command :

ncdump in.nc > out.txt

However, this particular file has thousands of "-999" values (for nodata). Is there a way to stop ncdump from adding these to the output?

Upvotes: 0

Views: 840

Answers (1)

Charlie Zender
Charlie Zender

Reputation: 6352

Use sed, e.g.,

ncdump in.nc | sed -e 's/ -999,//g' > out.txt
ncks in.nc | sed -e 's/_, //g' -e 's/ -999,//g' > out.txt

Add -e commands until all unwanted patterns disappear.

Upvotes: 2

Related Questions