Exemplo n.º 1
0
    def plot_datacoverage(self,
                          depth,
                          name='Megavolume',
                          filter='rff2',
                          conversion='EU60',
                          factor=2.):

        fig = plt.figure(figsize=(6, 6))
        d = np.argmin(np.abs(self.VOL.grid_depth - depth))
        slice = self.VOL.volumeweight[:, :, d].copy()

        xx, yy = np.meshgrid(self.VOL.grid_lon, self.VOL.grid_lat)

        m = Basemap(projection='merc',
                    llcrnrlat=np.min(self.VOL.grid_lat),
                    urcrnrlat=np.max(self.VOL.grid_lat),
                    llcrnrlon=np.min(self.VOL.grid_lon),
                    urcrnrlon=np.max(self.VOL.grid_lon),
                    lat_ts=20,
                    resolution='i')
        m.drawparallels(np.arange(self.VOL.latmin, self.VOL.latmax, 2.),
                        labels=[1, 0, 0, 1],
                        linewidth=0.5,
                        dashes=[4, 2],
                        labelstyle='+/-',
                        fontsize=10)
        m.drawmeridians(np.arange(self.VOL.lonmin, self.VOL.lonmax, 2.),
                        labels=[1, 0, 0, 1],
                        linewidth=0.5,
                        dashes=[4, 2],
                        labelstyle='+/-',
                        fontsize=10)
        m.drawcountries()
        coasts = m.drawcoastlines(zorder=2, color='k', linewidth=1)

        m.drawmapboundary(fill_color=[1.0, 1.0, 1.0])

        x, y = m(xx, yy)

        contours = [1., 15, 1.e2, 1.e3, 1.e4]  #[1.e0,1.e1,1.e2,1.e3,1.e4]
        im = plt.contourf(x, y, slice.T, contours, norm=LogNorm(), zorder=1)

        fig.subplots_adjust(bottom=.2)
        cbar_ax = fig.add_axes([0.2, 0.1, 0.6, 0.05])
        cb = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')
        cb.set_label('Sum of weights at ' + str(depth) + ' km')
Exemplo n.º 2
0
    def plot_mtzwidth_write(self,
                            name='Megavolume',
                            filter='rff2',
                            conversion='EU60',
                            factor=2.):

        #This routine is also used to make a txt file with the significant depths of the 410 and the 660
        #depth410660 = open('/raid3/annemijn/scripts/CCP/mincov40MTZ_'+conversion+'_'+filter+'_'+str(int(factor))+'.txt', 'w')
        depth410660 = open(
            '/raid1/annemijn/scripts/CCP/MTZsign_mincov40_' + conversion +
            '_' + filter + '_' + str(int(factor)) + '.txt', 'w')

        plt.figure(figsize=(18, 8))
        depths = self.VOL.grid_depth
        l410 = [
            x for x in range(len(depths))
            if depths[x] > 380 and depths[x] < 430
        ]
        l660 = [
            x for x in range(len(depths))
            if depths[x] > 630 and depths[x] < 700
        ]

        thickness1D = np.empty(
            (len(self.VOL.grid_lon), len(self.VOL.grid_lat)))
        d4101D = np.empty((len(self.VOL.grid_lon), len(self.VOL.grid_lat)))
        d6601D = np.empty((len(self.VOL.grid_lon), len(self.VOL.grid_lat)))
        for i in range(len(self.VOL.grid_lon)):
            for j in range(len(self.VOL.grid_lat)):

                RF = self.VOL.volume[i, j, :] / self.VOL.volumeweight[i, j, :]
                std = 1.96 * np.sqrt(self.VOL.volumesigma[i, j, :] /
                                     (self.VOL.volumeweight[i, j, :] *
                                      self.VOL.volumeweight[i, j, :]))
                max410 = np.argmax(RF[l410])
                max660 = np.argmax(RF[l660])
                maxamp410 = np.max(RF[l410])
                maxamp660 = np.max(RF[l660])

                # If both picks are significant, store thickness
                if RF[l410[max410]] > std[l410[max410]] and RF[
                        l660[max660]] > std[l660[max660]]:
                    d4101D[i, j] = depths[l410[max410]]
                    d6601D[i, j] = depths[l660[max660]]
                    thickness1D[i, j] = (depths[l660[max660]] -
                                         depths[l410[max410]])

                    if self.VOL.volumeweight[i, j, l410[max410]] >= 40:

                        #This routine is also used to make a txt file with the depth of the 410 and the 660
                        depth410660.write(str(self.VOL.grid_lat[j]) + '\t')
                        depth410660.write(str(self.VOL.grid_lon[i]) + '\t')
                        depth410660.write(str(depths[l410[max410]]) + '\t')
                        depth410660.write(str(depths[l660[max660]]) + '\t')
                        depth410660.write(str(maxamp410) + '\t')
                        depth410660.write(str(maxamp660) + '\n')

        # Prepare map
        m = Basemap(projection='merc',
                    llcrnrlat=np.min(self.VOL.grid_lat),
                    urcrnrlat=np.max(self.VOL.grid_lat),
                    llcrnrlon=np.min(self.VOL.grid_lon),
                    urcrnrlon=np.max(self.VOL.grid_lon),
                    lat_ts=20,
                    resolution='i')
        m.drawparallels(np.arange(np.min(self.VOL.grid_lat),
                                  np.max(self.VOL.grid_lat), 10.),
                        labels=[0, 0, 0, 0])  #[1,0,0,1])
        m.drawmeridians(np.arange(np.min(self.VOL.grid_lon),
                                  np.max(self.VOL.grid_lon), 10.),
                        labels=[0, 0, 0, 0])  #[1,0,0,1])
        m.drawcoastlines(color='k')
        m.drawcountries(color='k')
        m.drawmapboundary(fill_color=[1.0, 1.0, 1.0])

        xx, yy = np.meshgrid(self.VOL.grid_lon, self.VOL.grid_lat)
        x, y = m(xx, yy)
        cs = plt.contourf(x,
                          y,
                          thickness1D.T,
                          levels=np.linspace(220., 300., 81.),
                          cmap=cm.gist_earth_r)
        cs.cmap.set_under('w')
        cs.cmap.set_over('w')

        plt.colorbar()
        plt.title('MTZ width')

        #This routine is also used to make a txt file with the depth of the 410 and the 660
        depth410660.close()
Exemplo n.º 3
0
    def plot_datacoverage(self,
                          depth,
                          name='Megavolume',
                          filter='rff2',
                          conversion='EU60',
                          factor=2.):

        fig = plt.figure(figsize=(6, 6))
        d = np.argmin(np.abs(self.VOL.grid_depth - depth))
        slice = self.VOL.volumeweight[:, :, d].copy()

        xx, yy = np.meshgrid(self.VOL.grid_lon, self.VOL.grid_lat)

        m = Basemap(projection='merc',
                    llcrnrlat=np.min(self.VOL.grid_lat),
                    urcrnrlat=np.max(self.VOL.grid_lat),
                    llcrnrlon=np.min(self.VOL.grid_lon),
                    urcrnrlon=np.max(self.VOL.grid_lon),
                    lat_ts=20,
                    resolution='i')
        m.drawparallels(np.arange(0, 80, 10.),
                        labels=[1, 0, 0, 1],
                        linewidth=0.5,
                        dashes=[4, 2],
                        labelstyle='+/-',
                        fontsize=22)
        m.drawmeridians(np.arange(-160, -130, 20.),
                        labels=[1, 0, 0, 1],
                        linewidth=0.5,
                        dashes=[4, 2],
                        labelstyle='+/-',
                        fontsize=22)
        m.drawcountries()
        coasts = m.drawcoastlines(zorder=2, color='k', linewidth=1)

        m.drawmapboundary(fill_color=[1.0, 1.0, 1.0])
        x, y = m(xx, yy)

        contours = [1., 1.e1, 1.e2, 1.e3, 1.e4]  #[1.e0,1.e1,1.e2,1.e3,1.e4]
        im = plt.contourf(x, y, slice.T, contours, norm=LogNorm(), zorder=1)

        lonmin = -157
        lonmax = -143
        latmin = 58
        latmax = 67
        #plot_line (m,lonmin,lonmax,latmin,latmax,col="Black")

        lonmin = -159
        lonmax = -131
        latmin = 59.5
        latmax = 66.5
        plot_line(m, lonmin, lonmax, latmin, latmax, col="Black")  #BB

        lonmin = -160
        lonmax = -142
        latmin = 58
        latmax = 63
        plot_line(m, lonmin, lonmax, latmin, latmax, col="Black")  #CC

        lonmin = -157
        lonmax = -140
        latmin = 57
        latmax = 69
        plot_line(m, lonmin, lonmax, latmin, latmax, col="Black")  #AA

        lonmin = -164
        lonmax = -154
        latmin = 56.5
        latmax = 60.5
        plot_line(m, lonmin, lonmax, latmin, latmax, col="Black")  #DD

        lonmin = -155.5
        lonmax = -152
        latmin = 66
        latmax = 68
        #plot_rectangle(m, lonmin,lonmax,latmin,latmax, col="Black")

        lonmin = -154
        lonmax = -148.5
        latmin = 58
        latmax = 60.5
        #plot_rectangle(m, lonmin,lonmax,latmin,latmax, col="Black")

        fig.subplots_adjust(bottom=.2)
        cbar_ax = fig.add_axes([0.2, 0.1, 0.6, 0.05])
        cb = fig.colorbar(im, cax=cbar_ax, orientation='horizontal')
        cb.set_label('Sum of weights at ' + str(depth) + ' km', fontsize=36)
Exemplo n.º 4
0
    def plot_crosssection_any(self,
                              lon1,
                              lon2,
                              lat1,
                              lat2,
                              numpoints=200,
                              amplify=1.,
                              name='Megavolume',
                              filter='rff2',
                              conversion='EU60',
                              factor=2.,
                              zoom=False,
                              mincoverage=10.):
        # set volume lats and lons

        inv = geo.WGS84.Inverse(lat1, lon1, lat2, lon2)
        points = np.linspace(0, inv['s12'], numpoints)
        line = geo.WGS84.Line(lat1, lon1, inv['azi1'])

        lats = []
        lons = []
        for i in range(len(points)):
            lats.append(line.Position(points[i])['lat2'])
            lons.append(line.Position(points[i])['lon2'])

        lats = np.array(lats)
        lons = np.array(lons)

        crossec = []
        vol_sig = []
        w = []

        dist = []
        for i in range(len(lats)):
            dist.append(
                haversine(lats[0], lons[0], [lats[i]], [lons[i]]) / 111194.)

        # pixelize lon and lat
        row = (lons - np.min(self.VOL.grid_lon)) / (self.VOL.grid_lon[1] -
                                                    self.VOL.grid_lon[0])
        for i in range(len(row)):
            if row[i] < 0:
                row[i] = row[i] + len(self.lon)
        col = (lats - np.min(self.VOL.grid_lat)) / (self.VOL.grid_lat[1] -
                                                    self.VOL.grid_lat[0])

        for dp in range(len(self.VOL.grid_depth)):
            crossec.append(
                scipy.ndimage.map_coordinates(self.VOL.volume[:, :, dp],
                                              np.vstack((row, col))))
            vol_sig.append(
                scipy.ndimage.map_coordinates(self.VOL.volumesigma[:, :, dp],
                                              np.vstack((row, col))))
            w.append(
                scipy.ndimage.map_coordinates(self.VOL.volumeweight[:, :, dp],
                                              np.vstack((row, col))))

        crossec = np.array(crossec)
        vol_sig = np.array(vol_sig)
        w = np.array(w)

        xaxis = self.VOL.grid_lat
        xlabel = 'latitude (dg)'
        xends = [lon1, lon2]
        yends = [lat1, lat2]

        depths = self.VOL.grid_depth

        # normalize
        for i in range(np.shape(w)[0]):
            for j in range(np.shape(w)[1]):
                if w[i, j] > mincoverage:

                    crossec[i, j] = crossec[i, j] / w[i, j]
                    if crossec[i, j] > 0:
                        vol_sig[i, j] = crossec[i, j] - 1.96 * np.sqrt(
                            vol_sig[i, j] / (w[i, j] * w[i, j]))
                        if vol_sig[i, j] < 0:
                            vol_sig[i, j] = 0.
                    if crossec[i, j] < 0:
                        vol_sig[i, j] = crossec[i, j] + 1.96 * np.sqrt(
                            vol_sig[i, j] / (w[i, j] * w[i, j]))
                        if vol_sig[i, j] > 0:
                            vol_sig[i, j] = 0.

                else:
                    crossec[i, j] = 100.

        plt.subplot(2, 2, 2)
        m = Basemap(projection='merc',
                    llcrnrlat=self.VOL.latmin,
                    urcrnrlat=self.VOL.latmax,
                    llcrnrlon=self.VOL.lonmin,
                    urcrnrlon=self.VOL.lonmax,
                    lat_ts=20,
                    resolution='i')
        m.drawparallels(np.arange(0, 90, 10.),
                        labels=[1, 0, 0, 1],
                        labelstyle='+/-',
                        fontsize=10)
        m.drawmeridians(np.arange(-180, 60, 10.),
                        labels=[1, 0, 0, 1],
                        labelstyle='+/-',
                        fontsize=10)

        m.drawcoastlines()
        m.drawcountries()

        m.drawmapboundary(fill_color=[1.0, 1.0, 1.0])
        x1, y1 = m(xends[0], yends[0])
        x2, y2 = m(xends[1], yends[1])
        m.plot([x1, x2], [y1, y2], color='r', linewidth=1, zorder=1)

        plt.subplot(2, 2, 1)
        xx, yy = np.meshgrid(dist, depths)

        cs = plt.pcolor(xx,
                        yy,
                        crossec,
                        vmin=-0.15,
                        vmax=0.15,
                        rasterized=True,
                        cmap=cm.coolwarm)
        plt.colorbar()
        cs.cmap.set_over([0.8, 0.8, 0.8])
        if zoom:
            plt.ylim([200, 900])
        else:
            plt.ylim([min(depths), max(depths)])
        plt.gca().invert_yaxis()

        # corrected by 3D model
        # normalize

        norm = 0.2 / amplify  #np.max(np.max(np.abs(crossec_3D)))/amplify

        ax = plt.subplot(2, 1, 2)
        pos1 = ax.get_position()  # get the original position
        pos2 = [pos1.x0, pos1.y0, pos1.width / 14 * 8, pos1.height]
        pos2 = [pos1.x0, pos1.y0, pos1.width, pos1.height]
        print(pos1, pos2)
        ax.set_position(pos2)  # set a new position
        print(ax.get_position())  #

        print(ax.get_position())

        # plot

        for t in np.arange(0, len(dist), 1):

            lx = [
                x for x in range(len(depths))
                if (np.abs(w[x, t]) > mincoverage)
            ]  # and np.abs(vol_sig[x,t])>std[x,t]/1.96)]
            RF = vol_sig[lx, t] / norm + dist[t]
            RFfull = crossec[lx, t] / norm + dist[t]

            plt.fill_betweenx(depths[lx],
                              RFfull,
                              dist[t],
                              where=RFfull >= dist[t],
                              facecolor='k',
                              rasterized=True)
            plt.fill_betweenx(depths[lx],
                              RFfull,
                              dist[t],
                              where=dist[t] >= RFfull,
                              facecolor='k',
                              rasterized=True)
            plt.fill_betweenx(depths[lx],
                              RF,
                              dist[t],
                              where=RF >= dist[t],
                              facecolor=[1.0, 0., 0.],
                              rasterized=True)
            plt.fill_betweenx(depths[lx],
                              RF,
                              dist[t],
                              where=dist[t] >= RF,
                              facecolor=[0.0, 0.0, 1.],
                              rasterized=True)
            RF2 = crossec[lx, t] / norm
            l410 = [
                x for x in range(len(depths[lx]))
                if depths[lx[x]] > 366 and depths[lx[x]] < 454
            ]
            l660 = [
                x for x in range(len(depths[lx]))
                if depths[lx[x]] > 616 and depths[lx[x]] < 704
            ]
            if len(l410) > 20:
                max410 = np.argmax(RF2[l410])
                ind = lx[l410[max410]]
                plt.plot([dist[t] + 0.1, 0.5 * RF2[l410[max410]] + dist[t]],
                         [depths[ind], depths[ind]],
                         'y',
                         linewidth=2)
            if len(l660) > 20:
                max660 = np.argmax(RF2[l660])
                ind = lx[l660[max660]]
                plt.plot([dist[t] + 0.1, 0.5 * RF2[l660[max660]] + dist[t]],
                         [depths[ind], depths[ind]],
                         'y',
                         linewidth=2)

        plt.ylabel('Depth (km)', fontsize=28)
        plt.xlabel('Angular distance (dg)', fontsize=28)
        plt.xlim([min(dist), max(dist)])
        plt.plot([-5, 40], [410, 410], '--k', linewidth=2)
        plt.plot([-5, 40], [660, 660], '--k', linewidth=2)
        if zoom:
            plt.ylim([200, 800])
        else:
            plt.ylim([min(depths), max(depths)])
        plt.gca().invert_yaxis()
        print(ax.get_position())
Exemplo n.º 5
0
    def plot_crosssection(self,
                          direction,
                          lonorlat,
                          amplify=1.,
                          name='Megavolume',
                          filter='rff2',
                          conversion='EU60',
                          factor=2.,
                          zoom=False,
                          mincoverage=10):
        # set volume lats and lons

        if direction == 'NS':
            lon = lonorlat
            n = np.argmin(np.abs(self.VOL.grid_lon - lon))
            crossec = self.VOL.volume[n, :, :].T.copy()
            vol_sig = self.VOL.volumesigma[n, :, :].T.copy()
            w = self.VOL.volumeweight[n, :, :].T

            xaxis = self.VOL.grid_lat
            xlabel = 'latitude (dg)'
            yends = [lon, lon]
            xends = [self.VOL.latmin, self.VOL.latmax]

            lons = lon * np.ones_like(xaxis)
            lats = xaxis

        if direction == 'EW':
            lat = lonorlat
            n = np.argmin(np.abs(self.VOL.grid_lat - lat))
            crossec = self.VOL.volume[:, n, :].T.copy()
            vol_sig = self.VOL.volumesigma[:, n, :].T.copy()
            w = self.VOL.volumeweight[:, n, :].T
            xaxis = self.VOL.grid_lon
            xlabel = 'longitude (dg)'
            xends = [self.VOL.lonmin, self.VOL.lonmax]
            yends = [lat, lat]
            lons = xaxis
            lats = lat * np.ones_like(xaxis)

        depths = self.VOL.grid_depth

        # normalize
        for i in range(np.shape(w)[0]):
            for j in range(np.shape(w)[1]):
                if w[i, j] > mincoverage:

                    crossec[i, j] = crossec[i, j] / w[i, j]
                    if crossec[i, j] > 0:
                        vol_sig[i, j] = crossec[i, j] - 1.96 * np.sqrt(
                            vol_sig[i, j] / (w[i, j] * w[i, j]))
                        if vol_sig[i, j] < 0:
                            vol_sig[i, j] = 0.
                    if crossec[i, j] < 0:
                        vol_sig[i, j] = crossec[i, j] + 1.96 * np.sqrt(
                            vol_sig[i, j] / (w[i, j] * w[i, j]))
                        if vol_sig[i, j] > 0:
                            vol_sig[i, j] = 0.

                else:
                    crossec[i, j] = 1000.

        plt.figure(figsize=(14, 8))

        plt.subplot(2, 2, 2)
        m = Basemap(projection='merc',
                    llcrnrlat=self.VOL.latmin,
                    urcrnrlat=self.VOL.latmax,
                    llcrnrlon=self.VOL.lonmin,
                    urcrnrlon=self.VOL.lonmax,
                    lat_ts=20,
                    resolution='i')
        m.drawparallels(np.arange(0, 70, 10.),
                        labels=[1, 0, 0, 1],
                        labelstyle='+/-',
                        fontsize=10)
        m.drawmeridians(np.arange(-10, 60, 10.),
                        labels=[1, 0, 0, 1],
                        labelstyle='+/-',
                        fontsize=10)

        m.drawcoastlines()
        m.drawcountries()

        m.drawmapboundary(fill_color=[1.0, 1.0, 1.0])
        if direction == 'NS':
            x1, y1 = m(yends[0], xends[0])
            x2, y2 = m(yends[1], xends[1])
            m.plot([x1, x2], [y1, y2], color='r', linewidth=1, zorder=1)

            x3, y3 = m(lon * np.ones(len(xaxis), ),
                       np.round(xaxis / 10.) * 10.)
            m.scatter(x3, y3, 80, xaxis, zorder=2)
        if direction == 'EW':
            x1, y1 = m(xends[0], yends[0])
            x2, y2 = m(xends[1], yends[1])
            m.plot([x1, x2], [y1, y2], color='r', linewidth=1, zorder=1)
            x3, y3 = m(np.round(xaxis / 10.) * 10, lat * np.ones(len(xaxis), ))
            m.scatter(x3, y3, 80, xaxis, zorder=2)

        norm = 0.2 / amplify

        # plot

        plt.subplot(2, 2, 1)

        xx, yy = np.meshgrid(xaxis, depths)
        print(xx)

        cs = plt.pcolor(xx,
                        yy,
                        crossec,
                        vmin=-0.3,
                        vmax=0.3,
                        rasterized=True,
                        cmap=cm.coolwarm)

        #cs = plt.pcolor(xx, yy, crossec, vmin=-0.15, vmax=0.15, rasterized=True,cmap=cm.coolwarm)
        plt.colorbar()
        cs.cmap.set_over([0.8, 0.8, 0.8])
        if zoom:
            plt.ylim([300, 800])
        else:
            plt.ylim([min(depths), max(depths)])
        plt.gca().invert_yaxis()
        plt.xlim(xends)

        plt.subplot(2, 1, 2)

        for t in np.arange(0, len(xaxis), 1):

            lx = [
                x for x in range(0, len(depths))
                if (np.abs(w[x, t]) > mincoverage)
            ]  # and np.abs(vol_sig[x,t])>std[x,t]/1.96)]
            RF = vol_sig[lx, t] / norm + xaxis[t]
            RFfull = crossec[lx, t] / norm + xaxis[t]

            plt.fill_betweenx(depths[lx],
                              RFfull,
                              xaxis[t],
                              where=RFfull >= xaxis[t],
                              facecolor='k',
                              rasterized=True)
            plt.fill_betweenx(depths[lx],
                              RFfull,
                              xaxis[t],
                              where=xaxis[t] >= RFfull,
                              facecolor='k',
                              rasterized=True)
            plt.fill_betweenx(depths[lx],
                              RF,
                              xaxis[t],
                              where=RF >= xaxis[t],
                              facecolor=[1.0, 0., 0.],
                              rasterized=True)
            plt.fill_betweenx(depths[lx],
                              RF,
                              xaxis[t],
                              where=xaxis[t] >= RF,
                              facecolor=[0.0, 0.0, 1.],
                              rasterized=True)
        plt.scatter(np.round(xaxis / 10.) * 10.,
                    80. * np.ones(len(xaxis), ),
                    80,
                    xaxis,
                    rasterized=True)
        plt.plot([-180, 140], [410, 410], '--k', linewidth=2)
        #plt.plot([-180, 140], [520, 520], '--k', linewidth=2)
        plt.plot([-180, 140], [660, 660], '--k', linewidth=2)
        plt.ylabel('Depth (km)')
        plt.xlabel(xlabel, fontsize=12)
        plt.xlim([min(xaxis), max(xaxis)])

        if zoom:
            plt.ylim([300, 800])
        else:
            plt.ylim([min(depths), max(depths)])
        plt.gca().invert_yaxis()
        print(min(depths))
Exemplo n.º 6
0
    def plot_mtzwidth(self,
                      name='Megavolume',
                      filter='rff2',
                      conversion='prem',
                      factor=2.,
                      Max_Thickness=290,
                      Min_Thickness=230):
        plt.figure(figsize=(18, 8))
        depths = self.VOL.grid_depth
        l410 = [
            x for x in range(len(depths))
            if depths[x] > 370 and depths[x] < 460
        ]  # limit between 370 and 460
        l660 = [
            x for x in range(len(depths))
            if depths[x] > 630 and depths[x] < 710
        ]  # limit between 630 and 710
        thickness1D = np.empty(
            (len(self.VOL.grid_lon), len(self.VOL.grid_lat)
             ))  # create grids the size of the box to plot the data into
        d4101D = np.empty((len(self.VOL.grid_lon), len(self.VOL.grid_lat)))
        d6601D = np.empty((len(self.VOL.grid_lon), len(self.VOL.grid_lat)))
        with open(
                root + 'CCP_Stack/MTZ_' + conversion + '_' + filter + '_' +
                str(int(factor)) + '.txt', 'w') as output:
            for i in range(len(self.VOL.grid_lon)):
                for j in range(len(self.VOL.grid_lat)):
                    RF = self.VOL.volume[i, j, :] / self.VOL.volumeweight[i,
                                                                          j, :]
                    std = 1.96 * np.sqrt(self.VOL.volumesigma[i, j, :] /
                                         (self.VOL.volumeweight[i, j, :] *
                                          self.VOL.volumeweight[i, j, :]))
                    max410 = np.argmax(RF[l410])
                    max660 = np.argmax(RF[l660])
                    # If both picks are significant, store thickness
                    if RF[l410[max410]] > std[l410[max410]] and RF[
                            l660[max660]] > std[l660[max660]]:
                        d4101D[i, j] = depths[l410[max410]]
                        d6601D[i, j] = depths[l660[max660]]
                        thickness1D[i, j] = (depths[l660[max660]] -
                                             depths[l410[max410]])
                        output.write(
                            str(depths[l410[max410]]) + '\t' +
                            str(depths[l660[max660]]) + '\n')
            output.close()
        # Prepare map
        m = Basemap(projection='merc',
                    llcrnrlat=np.min(self.VOL.grid_lat),
                    urcrnrlat=np.max(self.VOL.grid_lat),
                    llcrnrlon=np.min(self.VOL.grid_lon),
                    urcrnrlon=np.max(self.VOL.grid_lon),
                    lat_ts=20,
                    resolution='i')
        m.drawparallels(np.arange(np.min(self.VOL.grid_lat),
                                  np.max(self.VOL.grid_lat), 5.),
                        labels=[1, 0, 0, 1])
        m.drawmeridians(np.arange(np.min(self.VOL.grid_lon),
                                  np.max(self.VOL.grid_lon), 5.),
                        labels=[1, 0, 0, 1])
        m.drawcoastlines(color='k')
        m.drawcountries(color='k')
        m.drawstates()
        m.drawmapboundary(fill_color=[1.0, 1.0, 1.0])
        xx, yy = np.meshgrid(self.VOL.grid_lon, self.VOL.grid_lat)
        x, y = m(xx, yy)
        cs = plt.contourf(x,
                          y,
                          thickness1D.T,
                          levels=np.linspace(Min_Thickness, Max_Thickness,
                                             81.),
                          cmap=cm.RdYlBu)
        cs.cmap.set_under('w')  #Max_Thickness = 290, Min_Thickness=230
        cs.cmap.set_over('w')

        plt.colorbar()
        plt.title('MTZ width')