You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
using coupe to map focal mechanism, don't move beach ball location when providing a new coordinates. #7777
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
Expected outcome
i want to move the beach ball to the new location(400,200)
👋 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!
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?
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.
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?
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?
/* 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 */
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?
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.
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.
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?
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.
Activity
welcome commentedon Sep 2, 2023
👋 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.
PaulWessel commentedon Sep 2, 2023
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?
seisman commentedon Sep 2, 2023
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:
Since GMT 6.0, the
coupedocs started to say:It's because we incorrectly use the same file
explain_meca_-S.rst_in bothmecaandcoupedocs.In my opinion, giving alternative long/lat doesn't make sense in
coupe. It should always be in the projected coordinates.PaulWessel commentedon Sep 2, 2023
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?
seisman commentedon Sep 2, 2023
Do you mean adding a modifier so that newX/newY can be:
PaulWessel commentedon Sep 2, 2023
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?
PaulWessel commentedon Sep 2, 2023
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.
PaulWessel commentedon Sep 2, 2023
Comments in pscoupe.c:
PaulWessel commentedon Sep 2, 2023
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
Maybe modifier +d would mean add offset to projected position (to complement absolute position from lower left?
seisman commentedon Sep 2, 2023
Please note that
mecaprovides 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
coupewill need similar modifiers to draw the line and the circle after offsetting. On the other hand,mecawill also be more flexible if can read Cartesian coordinates. So we may want to extendmeca's-Aoption and use the same code incoupe(the option flag can't be-Aincoupe).Yes, so it means the "+p" modifier you proposed is not necessary.
I think it makes more sense if +c means the offsets relative to the original coordinates.
seisman commentedon Sep 2, 2023
Here are my thoughts. For
meca, we can add a new modifier (e.g.,+o) to the-Aoption:+pdraws the line connecting the original and new location and+sdraws a circle at the original locationFor
coupe, because-Ais already used, we can use-Dwith the same modifiers.PaulWessel commentedon Sep 2, 2023
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.
PaulWessel commentedon Sep 2, 2023
Sorry, was writing and did not notice your post. I guess -A+c is not desired.
seisman commentedon Sep 2, 2023
Looks good.
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.
PaulWessel commentedon Sep 2, 2023
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?
seisman commentedon Sep 2, 2023
OK, I can work on the docs in the next few days.
PaulWessel commentedon Sep 2, 2023
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._
seisman commentedon Sep 2, 2023
Sounds good
Enhance meca and coupe w.r.t. adjusting positions and connecting with…
PaulWessel commentedon Sep 2, 2023
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?
seisman commentedon Sep 2, 2023
Sounds good.
Enhance meca and coupe w.r.t. adjusting positions and connecting with…
seisman commentedon Sep 11, 2023
Closed by #7778.