Skip to content

using coupe to map focal mechanism, don't move beach ball location when providing a new coordinates. #7777

Closed

Description

@dh4931

Description of the problem
using coupe to map focal mechanism, don't move beach ball location when providing a new coordinates.
using moment tensor to map focal mechanism and providing -A option, I want to the new location(400, 200), but the location of beach ball don't move.

Full script that generated the error

#!/bin/bash
gmt begin profile2
gmt coupe -JX15c/-6c -Sd0.8 -Aa130/43/140/36/90/100/0/700 -R0/600/0/900  -Gblack -Q -N << EOF
131.55 41.48 579  1.14 -0.10 -1.04 -0.51 -2.21 -0.99 26 400 200
EOF
gmt basemap -BWS -Byaf+l"Focal depth (km)" -Bxaf+l"Distance (km)"
gmt end show

Actual outcome

image

Expected outcome

i want to move the beach ball to the new location(400,200)

System information

  • Operating system: Ubuntu 20.04.6 LTS
  • GMT version (gmt --version): Version 6.2.0

Activity

  1. added
    bug
    on Sep 2, 2023
  2. welcome commented on Sep 2, 2023

    @welcome

    👋 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.

  3. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    The docs says give alternative long, lat, not projected km. But I can see it could be useful with a modifier that says “use those coordinates as already projected. @seisman?

  4. seisman commented on Sep 2, 2023

    @seisman
    Member

    Looking at the old GMT 4 (https://docs.generic-mapping-tools.org/4/gmt/html/man/pscoupe.html) and GMT 5 docs (https://docs.generic-mapping-tools.org/5.4/supplements/meca/pscoupe.html), they all say:

    these two columns are not used; can be 0 0; allows use of the psmeca file format

    Since GMT 6.0, the coupe docs started to say:

    8,9: longitude, latitude at which to place beachball if -C is used (optional). Using 0,0 in columns 8 and 9 will plot the beach ball at the longitude, latitude given in columns 1 and 2. The -: option will interchange the order of columns (1,2) and (8,9).

    It's because we incorrectly use the same file explain_meca_-S.rst_ in both meca and coupe docs.

    In my opinion, giving alternative long/lat doesn't make sense in coupe. It should always be in the projected coordinates.

  5. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    Agree, we will call it a bug. Please start a branch and I can do the C if you do the RST? So no possible use of a modifier to allow either geographical or Cartesian positioning then?

  6. seisman commented on Sep 2, 2023

    @seisman
    Member

    So no possible use of a modifier to allow either geographical or Cartesian positioning then?

    Do you mean adding a modifier so that newX/newY can be:

    • "400 200": placing the beachball at X=400 Y=200
    • "2 3": shift the beachball by 2 cm in X-direction and 3 cm in Y-direction?
  7. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    Sure, we aim to be "generic", so maybe a new option -D since the -S are full of modifiers already?

    -D Control positioning of beachball via the optional two coordinates in the input (See -S for which columns are used). By default we place the projected symbol via its coordinates projected onto the cross-section. Alternatively,
    +p Read projected coordinates and plot the beachball there instead
    +c Read Cartesian plot coordinates relative to lower left origin in plot units (c|i|p).

    Since I dont use coupe I am not sure if the default is to use those two coordinates unless they are 0,0?
    Any changes from what I proposed?

  8. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    Could be -D[lon/lat][+c|p] which only makes sense for a single earthquake and you can state the coordinates and type on the command line.

  9. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    Comments in pscoupe.c:

    /* Must examine the trailing text for optional columns: newX, newY and title */
    /* newX and newY are not used in pscoupe, but we promised psmeca and pscoupe can use the same input file */
    
  10. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    Also, the section that examines the trailing text for new, new, title is copied/pasted from meca and correctly processes geo coordinates but they are never used.

    Since you actually sue these tools, perhaps you should decide what should be done. Right now

    • any trailing text coordinates are ignored
    • No way to adjust where projected beachballs fall

    Maybe modifier +d would mean add offset to projected position (to complement absolute position from lower left?

  11. seisman commented on Sep 2, 2023

    @seisman
    Member

    Please note that meca provides the -A[+ppen][+ssize] option which can offset beachballs to the given long/lat and optionally draw the line connecting the two locations and a circle at the original location.

    I think coupe will need similar modifiers to draw the line and the circle after offsetting. On the other hand, meca will also be more flexible if can read Cartesian coordinates. So we may want to extend meca's -A option and use the same code in coupe (the option flag can't be -A in coupe).

    -D Control positioning of beachball via the optional two coordinates in the input (See -S for which columns are used). By default we place the projected symbol via its coordinates projected onto the cross-section. Alternatively, +p Read projected coordinates and plot the beachball there instead +c Read Cartesian plot coordinates relative to lower left origin in plot units (c|i|p).

    Since I dont use coupe I am not sure if the default is to use those two coordinates unless they are 0,0?

    Yes, so it means the "+p" modifier you proposed is not necessary.

    +c Read Cartesian plot coordinates relative to lower left origin in plot units (c|i|p).

    I think it makes more sense if +c means the offsets relative to the original coordinates.

  12. seisman commented on Sep 2, 2023

    @seisman
    Member

    Here are my thoughts. For meca, we can add a new modifier (e.g., +o) to the -A option:

    • Without -A: plotting beachballs at the original location
    • -A: plotting beachball at the newX/newY location (unless newX/newY are "0 0")
    • -A+o: newX and newY are interpreted as offset in X/Y direction relative to the original loaction
    • As before, +p draws the line connecting the original and new location and +s draws a circle at the original location

    For coupe, because -A is already used, we can use -D with the same modifiers.

  13. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    Perhaps we can do this. Start a new branch and work on the docs. It is OK that we must use -D in coupe since -A is used since the default coordinate types are different (lon,lat in mean and x,y in coupe).

    We use +o/ almost everywhere to offset a thing using plot distances so I prefer that.

    meca upgrade:
    -A[+ppen][+ssize][+c|o]
    +c Expect Cartesian coordinates relative to lower left corner to be in the alternative columns [geographic]
    +o Expect Cartesian offsets relative to beachball location to be in the alternative columns
    +p Specify pen used for line [0.25p]
    +s Draw circle of given diameter at original location [no circle]

    coupe upgrade:
    -D[+ppen][+ssize][+c|o]
    +c Expect Cartesian coordinates relative to lower left corner to be in the alternative columns [geographic]
    +o Expect Cartesian offsets relative to beachball location to be in the alternative columns
    +p Specify pen used for line [0.25p]
    +s Draw circle of given diameter at original location [no circle]

    Without -D no alternative coordinates are used regardless of current docs, so that is backwards compatible.
    If -D is used (as in -A for meca) then we would convert lon,lat to x,y, just to be consistent with meca, but presumably few will want to do that. But I like the idea of having basically the same option rather than switching the default to Cartesian (and then add +g to do the opposite?)

    Looks OK? I think start on the docs and then we mold the usage and code to that.

  14. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    Sorry, was writing and did not notice your post. I guess -A+c is not desired.

  15. seisman commented on Sep 2, 2023

    @seisman
    Member

    Looks good.

    Sorry, was writing and did not notice your post. I guess -A+c is not desired.

    It doesn't hurt to have the +c modifier, but I think it's less useful compared to +o, so may not be worth your coding time.

  16. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    OK, do you want to start the branch and get the docs to your skin, then add me as contributor so GitHub tells me when in the system?

  17. seisman commented on Sep 2, 2023

    @seisman
    Member

    OK, I can work on the docs in the next few days.

  18. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    Actually, since I have some time today and Sunday I might as well start the PR and you can add docs later (and I can modify if code fails the docs._

  19. seisman commented on Sep 2, 2023

    @seisman
    Member

    Sounds good

  20. PaulWessel commented on Sep 2, 2023

    @PaulWessel
    Contributor

    See #7778. A couple of book-keeping questions:

    We split the old meca supplement to seis and geodesy. However, there are lots of constants and internal functions that either use meca (e.g., utilmeca) and many constants are a bit short and unspecific, e.g., the 5 READ_PLANES-like constants, many structures (MOMENT) etc. I think it would be much cleaner and more readable if all the constants starts with SEIS_ (i.e., like my newly added ones), and the structs should have SEIS_ as well (SEIS_AXIS, SEIS_MOMENT), etc). And if we rename utilmeca to seislib.c then things like utilmeca_computed_dip1 becomes seismic_computed_dip1, etc.

    I think -A's new +c and +o can both be allowed::

    +o with no args implies +c, and that the two alternative columns contains offsets in plot units
    +odx/dy does not imply +c but allows it. It parses a fixed dx/dy that is added to the original or alternate point. In meca you can use it to move all beachball by the fixed dx/dy or if alternate point is given then it is computed and then added to.

    While +c makes less sense for coupe, the file format is the same so we keep the posing and capabilities the same.

    I take it PyGMT does not deal directly with utilmeca.? so the above is not an issue?

  21. seisman commented on Sep 2, 2023

    @seisman
    Member

    I think it would be much cleaner and more readable if all the constants starts with SEIS_ (i.e., like my newly added ones), and the structs should have SEIS_ as well (SEIS_AXIS, SEIS_MOMENT), etc). And if we rename utilmeca to seislib.c then things like utilmeca_computed_dip1 becomes seismic_computed_dip1, etc.

    Sounds good.

  22. seisman commented on Sep 11, 2023

    @seisman
    Member

    Closed by #7778.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions