Closed kerrybardot closed 3 weeks ago
I think an option to plot cell centers or vertices should not be hard to add, since PlotCrossSection
already sets them as attributes for internal use at init time: xcenters
/xvertices
/yvertices
(note the absence of ycenters
, xcenters
can be x or y depending on the projection).
Maybe centers
/vertices
switches on plot_grid()
?
For consistency we might offer the same on PlotMapView
?
@jlarsen-usgs
Maybe we should add separate methods, plot_nodes
and plot_vertices
, to both PlotMapView
and PlotCrossSection
? If we add them as separate methods, then we can send back the plotting object for further user manipulation?
Sounds good to me Chris.
From: langevin-usgs @.> Sent: Tuesday, September 3, 2024 10:52 PM To: modflowpy/flopy @.> Cc: Kerry Bardot @.>; Author @.> Subject: Re: [modflowpy/flopy] feature: flopy.plot.crosssection plot cell centres (DISU) (Issue #2299)
Maybe we should add separate methods, plot_nodes and plot_vertices, to both PlotMapView and PlotCrossSection? If we add them as separate methods, then we can send back the plotting object for further user manipulation?
- Reply to this email directly, view it on GitHubhttps://github.com/modflowpy/flopy/issues/2299#issuecomment-2326732358, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APRPR4JVGBB36FZ6A2BIRYTZUXEI3AVCNFSM6AAAAABNQOVW66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRWG4ZTEMZVHA. You are receiving this because you authored the thread.Message ID: @.**@.>>
I think that plotting cell centers shouldn't be too difficult to implement for cross sections and map view plots. For cross sections, there are a couple of considerations/calculations that need to be made. A standard cross section plots the distance along the provided cross section line on the x-axis. To get the location of the actual cell center, we will need to calculate that distance using the same/similar intersection routine as we currently do to draw cross sections. More or less, we'll need to calculate where the cross sectional line cross the cell center plane for a given view ("x" or "y" dimension). Unfortunately it's not quite as simple as plotting a point in the center of the cell if we want to represent the location correctly.
As far as the geographic coordinate plotting in cross section and in map view, we can just grab the cell centers from the modelgrid and plot those.
I think it would also be worthwhile to add an optional array to a plot_centers()
method, so the user can represent additional data on the scatter plot.
I looked into this for a few minutes this afternoon, and it should be relatively easy to implement using some of the existing methods in flopy's geometry utility that are primarily used for plotting particle locations and paths in cross section. @wpbonelli I can put together an initial PR to add this enhancement to the plotting routines.
I appreciate the plotting utilities in flopy - flopy.plot.crosssection
I use the plot_array and plot_grid.. but the plot_grid only plots the lines - would be nice if there was an option to plot cell centres (and be able to change the marker size/color).
I can extract the grid xyz cell centres gwf.modelgrid.xcellcenters - but it's not obvious how to plot cell centres on DISU cross-sections (Unless I have missed something...)
Thanks!