Beispiel #1
0
 def plot_magnetic_picks(self, m, facecolors='none'):
     for i in range(1, 5):
         m.readshapefile(magnetic_picks_output_basename + '_{}'.format(i),
                         'magnetic_{}'.format(i),
                         drawbounds=False,
                         color='w')
         import hashlib
         colors = []
         for s in getattr(m, 'magnetic_{}_info'.format(i)):
             if all(k in s for k in ['Chron', 'AnomalyEnd']):
                 #not really colouring by plate id. In fact, it is colouring by Chron+AnomalyEnd
                 colors.append(
                     plate_tectonic_utils.get_colour_by_plateid(
                         int(
                             hashlib.sha1(s['Chron'] +
                                          s['AnomalyEnd']).hexdigest(),
                             16)))
             else:
                 colors.append(
                     plate_tectonic_utils.get_colour_by_plateid(0))
         m.scatter(
             [x for (x, y) in getattr(m, 'magnetic_{}'.format(i))],
             [y for (x, y) in getattr(m, 'magnetic_{}'.format(i))],
             facecolors='none',
             edgecolor=colors,
             #s=.1,
             zorder=99)
Beispiel #2
0
    def plot_magnetic_picks(self, ax, facecolors='none'):
        for i in range(1, 5):
            reader = Reader(f'{magnetic_picks_output_basename}_{i}')
            #m.readshapefile(magnetic_picks_output_basename+'_{}'.format(i) ,'magnetic_{}'.format(i),drawbounds=False,color='w')
            import hashlib
            colors = []
            lons = []
            lats = []
            for s in reader.records():
                if all(k in s.attributes for k in ['Chron', 'AnomalyEnd']):
                    #not really colouring by plate id. In fact, it is colouring by Chron+AnomalyEnd
                    colors.append(
                        plate_tectonic_utils.get_colour_by_plateid(
                            int(
                                hashlib.sha1((s.attributes['Chron'] +
                                              s.attributes['AnomalyEnd']
                                              ).encode('utf-8')).hexdigest(),
                                16)))
                else:
                    colors.append(
                        plate_tectonic_utils.get_colour_by_plateid(0))
                lons.append(s.geometry.x)
                lats.append(s.geometry.y)

            ax.scatter(
                lons,
                lats,
                facecolors='none',
                edgecolor=colors,
                transform=ccrs.PlateCarree(),
                #s=.1,
                zorder=99)
Beispiel #3
0
    def plot_continent_ocean_boundaries(self, m, color='default'):
        #plot the fracture zones
        m.readshapefile(cob_output_basename,
                        'cob',
                        drawbounds=False,
                        color='b')
        for s in zip(m.cob, m.cob_info):
            fc = color
            if color == 'default':
                fc = plate_tectonic_utils.get_colour_by_plateid(
                    int(s[1]['PLATEID1']))

            m.plot([x for (x, y) in s[0]], [y for (x, y) in s[0]], color=fc)
Beispiel #4
0
    def plot_fracture_zones(self, m, color='default'):
        #plot the fracture zones
        print 'Plotting fracture zones...'
        m.readshapefile(fracture_zones_output_basename,
                        'fracture',
                        drawbounds=False,
                        color='b')
        for s in zip(m.fracture, m.fracture_info):
            fc = color
            if color == 'default':
                fc = plate_tectonic_utils.get_colour_by_plateid(
                    int(s[1]['PLATEID1']))

            m.plot([x for (x, y) in s[0]], [y for (x, y) in s[0]], color=fc)
Beispiel #5
0
    def plot_continent_ocean_boundaries(self, ax, color='default'):
        #plot the continent_ocean_boundaries

        for record in Reader(cob_output_basename).records():
            #print(record.geometry)
            c = color
            if color == 'default':
                c = plate_tectonic_utils.get_colour_by_plateid(
                    int(record.attributes['PLATEID1']))

            if type(record.geometry) is MultiLineString:
                for line in record.geometry:
                    lon, lat = line.xy
                    ax.plot(lon, lat, transform=ccrs.Geodetic(), color=c)
            else:
                lon, lat = record.geometry.xy
                ax.plot(lon, lat, transform=ccrs.Geodetic(), color=c)
Beispiel #6
0
    def plot_fracture_zones(self, ax, color='default'):
        #plot the fracture zones
        print('Plotting fracture zones...')

        for record in Reader(fracture_zones_output_basename).records():
            #print(record.geometry)
            c = color
            if color == 'default':
                c = plate_tectonic_utils.get_colour_by_plateid(
                    int(record.attributes['PLATEID1']))

            if type(record.geometry) is MultiLineString:
                for line in record.geometry:
                    lon, lat = line.xy
                    ax.plot(lon, lat, transform=ccrs.Geodetic(), color=c)
            else:
                lon, lat = record.geometry.xy
                ax.plot(lon, lat, transform=ccrs.Geodetic(), color=c)
Beispiel #7
0
    def plot_topologies(self,
                        ax,
                        facecolor='default',
                        edgecolor='w',
                        alpha=0.2):
        print('Plotting topologies...')

        for record in Reader(topology_output_basename).records():
            #print(record.attributes)
            fc = facecolor
            if facecolor == 'default':
                fc = plate_tectonic_utils.get_colour_by_plateid(
                    int(record.attributes['PLATEID1']))

            shape_feature = ShapelyFeature([record.geometry],
                                           ccrs.PlateCarree(),
                                           edgecolor=edgecolor)
            ax.add_feature(shape_feature, facecolor=fc, alpha=alpha)
Beispiel #8
0
    def plot_topologies(self,
                        m,
                        facecolor='default',
                        edgecolor='w',
                        alpha=0.2):
        print 'Plotting topologies...'
        m.readshapefile(topology_output_basename,
                        'topologies',
                        drawbounds=False,
                        color='w')
        for s in zip(m.topologies, m.topologies_info):
            fc = facecolor
            if facecolor == 'default':
                fc = plate_tectonic_utils.get_colour_by_plateid(
                    int(s[1]['PLATEID1']))

            poly = Polygon(s[0],
                           facecolor=fc,
                           edgecolor=edgecolor,
                           alpha=alpha)
            plt.gca().add_patch(poly)