Skip to content

Greenspline. Add tab in Misfit evaluation #8158

Closed

Description

@Esteban82

I want to plot the misfit evaluation of a grid made with greenspline in a graph.

gmt greenspline Perfiles?.txt -i0,1,4 -R$R -I$inc -Sc -V -Z1 -Ggsplines.nc -Emisfit.txt 2> misfit_stderr.txt

So, first I use -Emisfit.txt 2> misfit_stderr.txt to save the info of the whole grid into in a file.

Then I use grep:

grep "Misfit evaluation" misfit_stderr.txt
greenspline [INFORMATION]: Misfit evaluation: N = 217	Mean = -7.35372e-15	Std.dev = 3.84514e-14	RMS = 3.90611e-14

With this command I can plot the Mean info (i.e. Mean = -7.35372e-15) in the graph. So far so good.

grep "Misfit evaluation" misfit_stderr.txt | cut -f 2 | gmt text -F+cTL+f9p -Dj0.1c/18p

Issue

My problem is when I want to plot "N = 217" in the graph. With -f 1 doesn't work

grep "Misfit evaluation" misfit_stderr.txt | cut -f 1
greenspline [INFORMATION]: Misfit evaluation: N = 217

Also try:

grep "Misfit evaluation" misfit_stderr.txt | cut -d" " -f5-7
N = 217 Mean

Solution?

So, I think that this could be solve if I add a \t before "N" in the lines 2533 and 2535 of https://github.com/GenericMappingTools/gmt/blob/master/src/greenspline.c

		`GMT_Report (API, GMT_MSG_INFORMATION, "Misfit evaluation: N = %u\tMean = %g\tStd.dev = %g\tRMS = %g\n", nm, mean, std, rms);`

Is my solution ok? Should I make a PR?

Activity

  1. added
    feature request
    on Dec 7, 2023
  2. self-assigned this
    on Dec 7, 2023
  3. PaulWessel commented on Dec 7, 2023

    @PaulWessel
    Contributor

    Sure, you can add that tab.

  4. joa-quim commented on Dec 7, 2023

    @joa-quim
    Member

    I don't understand this. A tab or a space are sufficient to separate two fields. Why is need to be a tab? (it looks weird to me to have `"evaluation: \tN"``)

  5. Esteban82 commented on Dec 7, 2023

    @Esteban82
    MemberAuthor

    I proposed a tab because the other values (mean, std, rms) are separated by tabs. Meanwhile N is separated (at the beginnig) by a spac. Maybe we could change every tab by spaces.

  6. joa-quim commented on Dec 7, 2023

    @joa-quim
    Member

    We normally separate second and on with tabs in an attempt to align columns vertically. With spaces that's very difficult, but ofc this makes no difference for a single plot line.

  7. Esteban82 commented on Dec 8, 2023

    @Esteban82
    MemberAuthor

    It is not very clear if I should put space or tabs. I would prefer tabs.

  8. PaulWessel commented on Dec 8, 2023

    @PaulWessel
    Contributor

    Maybe we should add an option to write those message to a file instead? Please append your misfit file so I an have a look.

  9. joa-quim commented on Dec 12, 2023

    @joa-quim
    Member

    Fixed by a new option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions