Open megies opened 7 years ago
I am interested in helping with this feature request. A few questions (as I've not looked too deeply into the obspy-scan
script):
Is this to show data availablity? Is the goal mainly to have timeseries plots that show, like obspy-scan
, something like red bars over ranges that don't correspond to an active epoch? Do we want to have a marker for the boundary of two contiguous epochs? Do we want to also demarcate gaps in traces where no data has been collected?
Not really to show data availability (as it would be based purely on station metadata) but to plot the start and end times of the networks, stations, and channel epochs in that inventory. StationXML files might have an additional data availability tag that could also be overlayed somehow. I did not give this too much thought yet but I envision something like a gant chart that shows when each entity in the inventory objects claims to be active.
Quick mockup:
Something like this graph that appears just before the linked section? http://earthpy.org/tag/matplotlib.html#Visualizing-Data (there's no nearby anchor except this one right after the plot I mean)
That is indeed very nice :)
We could group all channels of a station by not using a line plot for the station level but rather a rectangle with colored fill and only plot the channels as lines (or fine rectangles) on top of it..
I like this grouping idea. Would we want to do something similar to group all the stations in a network, or would it be better to make separate plots for them?
i think it should be one plot for everything (in one Inventory).
and, not sure myself, channel level as lines (or thin rectangles) seems pretty clear, otherwise we could use alpha
d rectangles for all of the higher levels, but i guess we'd need to try it out, how it looks..
Dunno.. I guess the "group by background shading" really only works for one level, either network or station.. or maybe we could use the colored shade for station level and use a thick box outline for network level?
I have a basic example of this in my fork under the epoch_plots branch. I have not written any tests for it yet. The code consists of functions that collect epoch data whenever it is defined, and builds a dictionary keyed by the y-axis value that a piece of inventory will be plotted on, with the entry being a tuple of the form (epoch start, epoch end, height (used to define the rectangle height for encompassing station & network objects), and y-tick-label (the object's code)). Since I'll be out until the Monday after next I wanted to get this done before I left for the day and made sure people were aware of it.
Again, currently untested and may not work correctly.
As another note, for stations where a start date is defined but an end date isn't, I set the end date to be the time that the report was generated. We may want to use a different way of identifying active epochs than this, but this was an easy thing to code.
I would set the end-date to None (also for far future dates). Then during the plotting the max time (right side) should probably be either the time the report was generated at or the latest actually set end time. For all epochs that don't have an end time maybe just put a "still active" label there?
Can you paste a picture of how this looks? I could not get your code to run.
I was finishing this up pretty close to the end of my day right before taking a week (and a half, with Thanksgiving) off, so it may be it still doesn't run. I've got other projects to take care of but I should be able to give this some attention this week in order to make sure it actually runs.
This will take a bit more work than I expected, mainly because I was not aware the inventory separated epochs of a given station, channel into separate entries. The resulting plot will have epochs grouped (vertically) by matching SNC
I now have working plot code. I'm not sure what a suitable (automated) test for this code would be. I have a simple script I made that just runs the plot code for the default inventory for testing that appears to look right now.
It looks like this didn't get into version 1.20, but it would be very useful and a pity to wait until 1.3.0 (or let it die on the vine). What is missing?
I think there were some instances of metadata in which the code would error out. Unfortunately it's been a while since I touched this so I don't remember what the data in question was.
Is there an example of the code I can look at fairly easily to test and see if I can fix something?
Cheers Wayne
Wayne Crawford CNRS Researcher Institut de Physique du Globe de Paris 1, rue Jussieu 75238 Paris Cedex 05 +33 6 5151 1054
On 27 April 2020 at 16:32:09, amkearns-usgs (notifications@github.com) wrote:
I think there were some instances of metadata in which the code would error out. Unfortunately it's been a while since I touched this so I don't remember what the data in question was.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
The individual metadata objects (network, station, location, channel) all had a public method to generate the plot and a private method to enumerate all the epochs of their child objects. The resulting objects then had the enumerated epochs actually turned into a plot by use of a method to generate the plot in the util.py class.
See, for example, here at the station level: https://github.com/amkearns-usgs/obspy/blob/86fcf6e9e3f25e9de0afaaacb862e552394c8c73/obspy/core/inventory/station.py#L511
And here for the methods in util.py: https://github.com/amkearns-usgs/obspy/blob/86fcf6e9e3f25e9de0afaaacb862e552394c8c73/obspy/core/inventory/util.py#L866
Inventory
andNetwork
(and maybeStation
) should have a plot option likeobspy-scan
, basically showing the station/channel epochs defined in the metadata.