Command string exceeds upper length of 320 characters

I haven’t seen this one before, in scripts I’ve run in the past.

My task is to run xyz2grd using the -di option to replace huge invalid values to NaNs. The invalid value has about 300 digits to it, so when I use the command:

gmt xyz2grd t1.bin -Gtg.grd -R-3950/3950/-3950/4350 -I25 -r -Z${zpr} -di${inval}

This warning is issued:

xyz2grd [WARNING]: Command string exceeds upper length of 320 characters (will be truncated in non-netCDF grid files)

It used to work…

In the past, any string longer than the fixed lengths in the GMT grid header would be truncated. We recently added extensions so that for netCDF grids (the default) we can have as long strings as we want. The Warning is just a warning. But, perhaps it should only be printed when NOT using netcdf output grids. I will see if that is possible.

Cannot easily prevent these warnings, but I think it is reasonable to warn when those strings exceed the standard grid definition. This only happens in extreme cases anyway.

The problem, here, is that the -di option isn’t doing it’s job. The values ~ 1.79769e+308 need to be turned into NaNs. And they’re getting through as non-NaN values when generating tg.grd.

Try this, with the attached .bin file, Paul:

inval=179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368. # h5 invalid value
zpr=BLd
gmt xyz2grd t1.bin -Gtg.grd -R-3950/3950/-3950/4350 -I25 -r -Z${zpr} -di${inval}

Thanks!

t1.bin.zip (188.1 KB)

It is a feature. By default -di applies to column 2 but you can change that with +c. Add +c0 for now. I think it is fair to say this is a bug when -Z is used since it implies a single input z column.

Aha. That works, my script never complained before! Thank you!

The issue is now fixed in master so that -di for -Z defaults to the first (and only) input column. Thanks for the example.