Repository navigation
Description
Description of the desired feature
I believe @Esteban82 asked this on the forum some time ago: How to make movies using events to plot focal mechanisms? I have an interest in getting this feature implemented as well and here are some thoughts on how this could work. First, a brief overview of how regular symbols are plotted. These are simple (circle, star, etc) so only one parameter. In contrast, focal mechanisms plotted via gmt meca may take 7+ parameters. Here is the workflow:
- Input data need 1-2 extra columns appended at the end: The time of the event (required) and the optional duration of it (if variable. If constant then we can set it via -L).
- Given the current frame time and the various parameters set via -E, -M, -L, determine which symbols should be visible (we skip the rest) and determine the individual symbol scale, color intensity and transparency for each one of them.
- Write a temporary data file with all the events that must be plotted, and append the three extra columns setting symbol scale, color intensity, and transparency.
- Call gmt plot on this temporary file
To "generalize" this workflow to apply to more complicated symbols via meca and others, I think this may be the path forward:
First, modules like meca and velo will need new options to allow the passing via extra data columns of symbol size (or more like an overall scale), color intensity, and transparency. This could be achieve this way:
- Symbol size/scale: Since these modules have their own -S option to set many aspects of the symbol type and size, we can add another modifier that basically means "then scale the final symbol size by the factor in the first extra data column". Let's call this modifier +z.
- Intensity: All of these modules can be given the same -I[intens] option found in plot and then use the second extra column for an intensity value to modify the present color.
- Transparency: I believe the modules already have an appropriate -t option since it is a common option but I will need to see if it actually works the same way as in plot (-t without arg means read transparency from last column).
With those changes the modules will be capable of issuing the correct plot code when driven by events as well as when run independently.
The second challenge is to tell events you want one of these symbols. I think it is better not to clutter the present -S option (standard symbols) but instead use -Z to select these more advanced symbols. Because meca, velo, coupe etc take many options and they are not all identical, it is not a simple thing to do, especially the many data formats and conventions allowed. My preferred solution to this goes like this:
Let -Z be an option that takes the core command we need, e.g. -Z"meca -Sm6c -T0" or -Z"velo -A+pthicker+ea -Se600c/0+f8p". These strings will form the core of the final gmt command call to these modules, but events will add options and modifiers as needed (such as passing along any -Ccpt -Gfill -Wpen and -N options given to events as well as adding the extra -I -t and append +z to their -S option).
This scheme does assume that any such module accepts these options: -Ccpt to color the symbol based on an extra column value, -Gfill to set a constant color for symbols, -N to not clip them at the border, and -Wpen to set an outline pen. These are all available but I notice coupe uses -Zcpt. I think a backwards compatible upgrade is in order there - I think we actually discussed this earlier but maybe we forgot - it seems like an obvious anomaly.
Would be helpful if real seismologists like @seisman could comment on any shortcomings of this proposal.
Note: I may decide to not use -Z after all and go with -S since we are running low on option letters in events and it may be good to save -Z for the future.
Activity
PaulWessel commentedon Mar 2, 2021
Just an update: The recent string of PRs discussed in #4869 have now prepared the stage for implementing events -Z. Meanwhile, side-discussions with users of velo is happing to learn how best to implement -Ccpt for that tool before we give it the -I, -t, and variable scale treatment needed to play in events.
PaulWessel commentedon Mar 5, 2021
Another update: Via PRs #4909, #4908 etc I have brought velo up to speed and I am now ready to work on the implementation in events for how to access these tools in animations.
PaulWessel commentedon Mar 8, 2021
Yet another update after the merging of the above PRs. Branch events-geodesy-seis is almost ready for review as the basic functionality seems to work. Here is a lame movie of a single event at 2020-02-01T14 with an exaggerated 1-day raise time, plateau, decay and coda. The coda changes the intensity instantly and not over time so I am still looking into that.
mv.mp4
PaulWessel commentedon Mar 14, 2021
After this implementation I am learning that one weakness of the whole events animation scheme is that while symbol sizes are correctly scaled according to the rules set by -E and -M, the pen thickness used for such symbols are fixed and does not scale with the symbol size. This gives strange behaviors when the size change is large, with the pen dominating a small symbol. This surely needs fixing, and it will affect plot, plot3d, as well as meca, coupe, and velo in a similar way.
The general input to plot for symbol is given by this order, with optional items in brackets and controlled by options:
x y [z] [size] [other symbol columns] [intensity] [transparency] [trailing text]where -Ccpt triggers the z-column, a missing size in -S triggers the size column, some symbols require more than just a size (e.g., ellipses, error bars) and events adds the intensity and transparency columns and passes the -I and -t options. However, what is missing is the capability of passing a simple scale that should be multiplied by the current size and current pen width. That is not the size column which may give legitimately varying symbol sizes, or the symbol size may be a constant given by -S and hence there is no size column. Obviously, being giving a size column does not allow us to compute pen thicknesses since we do not have a reference size to compare to - hence the need for a non-dimensional scale. I think the solution is to allow for a scale column for all these modules:
x y [z] [size] [other symbol columns] [scale] [intensity] [transparency] [trailing text]There are two ways to deal with this:
So, give me your thoughts if you think a scale column is generally useful outside the animation domain and that we should consider implementing this feature via a more general -H option instead of a hidden thing. I could start coding up with plan A and if we decide -H is the way then it is a simple switch to do that instead. Pinging @joa-quim, @seisman, @meghanrjones on this - it is OK to let me know if you have no opinion on this. I clearly have!
PaulWessel commentedon Mar 14, 2021
The more I think of this I think -H is the way to go. This is a legitimate enhancement separate from its usage in animations.
PaulWessel commentedon Mar 15, 2021
I am doing this and it is simple, so a good feature to have. I will make a test script as well for plot, then move onto the other modules.