#25 Minor patches

Open Andrew Moodie amoodie
Coverage Reach

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -769,7 +769,8 @@
Loading
769 769
    return coll.PatchCollection(pl, match_original=True)
770 770
771 771
772 -
def show_one_dimensional_trajectory_to_strata(e, dz=0.05, z=None, ax=None):
772 +
def show_one_dimensional_trajectory_to_strata(e, dz=0.05, z=None, ax=None,
773 +
                                              show_strata=True):
773 774
    """1d elevation to stratigraphy.
774 775
775 776
    This function creates and displays a one-dimensional elevation timeseries
@@ -803,6 +804,11 @@
Loading
803 804
    ax : :obj:`matplotlib.pyplot.axes`, optional
804 805
        Axes to plot into. A figure and axes is created, if not given.
805 806
807 +
    show_strata : :obj:`bool`, optional
808 +
        Whether to plot the resultant stratigraphy as a strip log on a second
809 +
        axis on the right side. This axis included numbers indicating the
810 +
        timestep for each voxel of preserved stratigraphy.
811 +
806 812
    Returns
807 813
    -------
808 814
    """
@@ -835,7 +841,7 @@
Loading
835 841
                                  y0=np.min(e), facecolor='0.8'))
836 842
    _ppc = ax.add_patch(ptch.Rectangle((0, 0), 0, 0, facecolor='0.8',
837 843
                                       label='psvd timesteps'))  # add for lgnd
838 -
    _ss = ax.hlines(e[p], 0, e.shape[0], linestyles='dashed', colors='0.7')
844 +
    _ss = ax.hlines(s[p], 0, e.shape[0], linestyles='dashed', colors='0.7')
839 845
    _l = ax.axvline(lst, c='k')
840 846
    _e = ax.step(t, e, where='post', label='elevation')
841 847
    _s = ax.step(t, s, linestyle='--', where='post', label='stratigraphy')
@@ -844,19 +850,21 @@
Loading
844 850
    ax.xaxis.set_minor_locator(matplotlib.ticker.MultipleLocator(1))
845 851
    ax.grid(which='both', axis='x')
846 852
847 -
    # boxy strata plot
848 -
    divider = axtk.make_axes_locatable(ax)
849 -
    ax_s = divider.append_axes("right", 0.5, pad=0.1, sharey=ax)
850 -
    ax_s.yaxis.tick_right()
851 -
    ax_s.xaxis.set_visible(False)
852 -
    __x, __y = np.meshgrid(np.array([0, 1]), z)
853 -
    _colmap = plt.cm.get_cmap('viridis', e.shape[0])
854 -
    _c = ax_s.pcolormesh(__x, __y, cp,
855 -
                         cmap=_colmap, vmin=0, vmax=e.shape[0], shading='auto')
856 -
    _ss2 = ax_s.hlines(e[p], 0, 1, linestyles='dashed', colors='gray')
857 -
    _cstr = [str(int(cc)) if np.isfinite(cc) else 'nan' for cc in c.flatten()]
858 -
    for i, __cstr in enumerate(_cstr):
859 -
        ax_s.text(0.3, z[i], str(__cstr), fontsize=8)
853 +
    if show_strata:
854 +
        # boxy strata plot
855 +
        divider = axtk.make_axes_locatable(ax)
856 +
        ax_s = divider.append_axes("right", 0.5, pad=0.1, sharey=ax)
857 +
        ax_s.yaxis.tick_right()
858 +
        ax_s.xaxis.set_visible(False)
859 +
        __x, __y = np.meshgrid(np.array([0, 1]), z)
860 +
        _colmap = plt.cm.get_cmap('viridis', e.shape[0])
861 +
        _c = ax_s.pcolormesh(__x, __y, cp,
862 +
                             cmap=_colmap, vmin=0, vmax=e.shape[0], shading='auto')
863 +
        _ss2 = ax_s.hlines(e[p], 0, 1, linestyles='dashed', colors='gray')
864 +
        _cstr = [str(int(cc)) if np.isfinite(cc) else 'nan' for cc in c.flatten()]
865 +
        ax_s.set_xlim(0, 1)
866 +
        for i, __cstr in enumerate(_cstr):
867 +
            ax_s.text(0.3, z[i], str(__cstr), fontsize=8)
860 868
861 869
    # adjust and add legend
862 870
    if np.any(e < 0):

@@ -561,7 +561,7 @@
Loading
561 561
        :include-source:
562 562
563 563
        >>> rcm8cube = dm.sample_data.cube.rcm8()
564 -
        >>> rcm8cube.register_section('path', section.PathSection(
564 +
        >>> rcm8cube.register_section('path', dm.section.PathSection(
565 565
        ...     path=np.array([[50, 3], [65, 17], [130, 10]])))
566 566
        >>>
567 567
        >>> # show the location and the "velocity" variable

@@ -8,6 +8,8 @@
Loading
8 8
from skimage import morphology
9 9
from skimage import measure
10 10
11 +
from . import utils
12 +
11 13
12 14
class BaseMask(object):
13 15
    """Low-level base class to be inherited by all mask objects."""
@@ -58,7 +60,7 @@
Loading
58 60
        """
59 61
        return self._mask
60 62
61 -
    def show(self, t=-1, **kwargs):
63 +
    def show(self, t=-1, ax=None, **kwargs):
62 64
        """Show the mask.
63 65
64 66
        Parameters
@@ -70,8 +72,9 @@
Loading
70 72
71 73
        Passes `**kwargs` to ``matplotlib.imshow``.
72 74
        """
75 +
        if not ax:
76 +
            ax = plt.gca()
73 77
        cmap = kwargs.pop('cmap', 'gray')
74 -
        fig, ax = plt.subplots()
75 78
        if hasattr(self, 'mask') and np.sum(self.mask) > 0:
76 79
            ax.imshow(self.mask[t, :, :], cmap=cmap, **kwargs)
77 80
            ax.set_title('A ' + self.mask_type + ' mask')
@@ -130,14 +133,7 @@
Loading
130 133
131 134
        # loop through the time dimension
132 135
        for tval in range(0, self.data.shape[0]):
133 -
            # use the first column to trim the land_width
134 -
            # (or, can we assume access to the DeltaRCM variable `L0`?)
135 -
            i = 0
136 -
            delt = 10
137 -
            while i < self.data.shape[1] and delt != 0:
138 -
                delt = self.data[tval, i, 0] - self.data[tval, i+1, 0]
139 -
                i += 1
140 -
            trim_idx = i - 1  # assign the trimming index
136 +
            trim_idx = utils.guess_land_width_from_land(self.data[tval, :, 0])
141 137
            data_trim = self.data[tval, trim_idx:, :]
142 138
            # use topo_threshold to identify oceanmap
143 139
            omap = (data_trim < self.topo_threshold) * 1.

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
deltametrics -0.01% 91.02%
Project Totals (8 files) 91.02%
Loading