I was doing some basic data validation after reformatting some text data (fewer decimal places, omit records with values of zero, …), expecting that the range of values in my reformatted files would match the range of non-zero values in the original data. However, it seems like gmt info
misses the smallest non-zero value(s) if I tell it to ignore records with a value of 0 (-di0.0
, which I think replaces data values equal to 0.0 with NaN).
cat << EOD >> test.csv
-133.0,48.0,0e0
-140.5,47.2,1e-17
-140.6,47.3,1e-16
-132.9,48.0,1e-15
-132.9,48.0,1.1e-15
-132.9,48.0,1.2e-15
-132.9,48.0,2e-15
-132.9,48.0,3e-15
-130.2,50.6,1e-14
-130.2,50.6,1e-1
EOD
gmt info test.csv
# test.csv: N = 10 <-140.6/-130.2> <47.2/50.6> <0/0.1>
# don't exclude zeros - OK
gmt info test.csv -di0.0
# test.csv: N = 10 <-140.6/-130.2> <47.2/50.6> <1.2e-15/0.1>
# misses all non-zero values below 1.2e-15
awk -F, '$3>0{print}' test.csv | gmt info
# <Standard Input>: N = 9 <-140.6/-130.2> <47.2/50.6> <1e-17/0.1>
# if zeros are omitted first, we get the actual minimum non-zero value
The -di0.0
seems to filter out any values below about 1.2e-15 (somewhere between 1.1e-15 and 1.2e-15). Trying negative numbers suggests that -di0.0
filters out values with an absolute value less than 1.2e-15. What’s going on here?
Thanks!