Closed timhenstock closed 3 days ago
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!
Please make sure you read our Contributing Guide and abide by our Code of Conduct.
Hi Tim,
Thanks for finding this. I have applied your suggestion in the PR (Pull Request) #8631
Description of the problem gmt segy2grd discards 1st character of the number following -M gmt segy2grd -M16000 expected behaviour is to read 16000 traces but it reads 6000 instead gmt segy2grd -M016000 reads 16000 traces
gmt pssegy works as expected so -M16000 plots 16000 traces.
6.3.0 does not have this bug. 6.5.0 running on Rocky8 using the binaries from the recommended repository does have this bug. 6.5.0 compiled from source on Rocky8 also shows this bug. 6.5.0 compiled from source on Ubuntu 22.04 does have this bug. Comparing the source code I can see 2 differences in 6.5.0 source: 1 Where the parameters are defined pssegy uses uint32_t and segy2grd unsigned int 2 Where the parameters are parsed segy2grd.c
pssegy.c
When I dig in gmt_get_required_uint, it is clear that &opt->arg[1] in segy2grd.c means that the first character of the parameter for the argument is discarded. Corrected code is either:
or
Same incorrect outcomes and code error in the -L option parsing.
Full script that generated the error
Full error message
Actual outcome
Reads 1 trace. -Vd reports segy2grd [INFORMATION]: Number of traces in header is 1
Expected outcome
Reads 20000 traces -Vd reports segy2grd [INFORMATION]: Number of traces in header is 20000
Both of these are correctly produced with my code suggestion above.
System information
gmt --version
):