Skip to content

Let events plot more complicated symbols via meca, velo, etc. #4866

Closed

Description

@PaulWessel

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:

  1. 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).
  2. 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.
  3. 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.
  4. 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:

  1. 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.
  2. 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.
  3. 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

  1. added
    feature request
    on Feb 27, 2021
  2. PaulWessel commented on Mar 2, 2021

    @PaulWessel
    ContributorAuthor

    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.

  3. PaulWessel commented on Mar 5, 2021

    @PaulWessel
    ContributorAuthor

    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.

  4. PaulWessel commented on Mar 8, 2021

    @PaulWessel
    ContributorAuthor

    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
  5. PaulWessel commented on Mar 14, 2021

    @PaulWessel
    ContributorAuthor

    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:

    1. We keep this a a hidden special feature only triggered by events, and thus can use some undocumented way of telling these modules to expect and use a scale column. I can do this via an internal API variable or invent some undocumented option like -\ that these modules can parse. I would lean towards to first mechanism since it cannot accidentally be involved by a typo.
    2. Alternatively, this is a useful feature in these modules (but especially for plot and plot3d) and then it becomes a question how to allow for this feature to be triggered. Examining these 5 modules the only available common letter is -H which back in GMT 4 and earlier had to do with header records. Those are now -h and have been for a long time. We already have recycled -H and using it in psconvert for instance.

    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!

  6. PaulWessel commented on Mar 14, 2021

    @PaulWessel
    ContributorAuthor

    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.

  7. PaulWessel commented on Mar 15, 2021

    @PaulWessel
    ContributorAuthor

    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.

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

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions