Пример #1
0
    def plot_peak_altitude(self, ax=None, true_color='k',
            apparent_color='grey'):
        if ax is None:
            ax = plt.gca()
        plt.sca(ax)

        for d in self.digitization_list:
            if d.is_invertible():
                if d.altitude.size == 0:
                    try:
                        d.invert(substitute_fp=ais_code.ne_to_fp(4.))
                    except BaseException as e:
                        print(e)
                        continue

                if apparent_color:
                    plt.plot(d.time, d.altitude[-1], marker='.',
                        ms=self.marker_size, color=apparent_color)
                alt = mex.iau_pgr_alt_lat_lon_position(float(d.time))[0]
                plt.plot(d.time,
                alt - d.traced_delay[-1] * ais_code.speed_of_light_kms / 2.,
                        marker='.', color=true_color,
                        ms=self.marker_size)
        celsius.ylabel(r'$h_{max} / km$')
        plt.ylim(0o1, 249)
Пример #2
0
    def plot_peak_density(self, fmt='k.', labels=True, ax=None, **kwargs):
        if ax is None:
            ax = plt.gca()
        plt.sca(ax)

        for d in self.digitization_list:
            if d.is_invertible():
                if d.altitude.size == 0:
                    try:
                        d.invert(substitute_fp=ais_code.ne_to_fp(4.))
                    except BaseException as e:
                        print(e)
                        continue
                plt.plot(d.time, d.density[-1], fmt, **kwargs)

        if labels:
            celsius.ylabel(r'$n_{e,max} / cm^{-3}$')
        ax.set_yscale('log')
        plt.ylim(1E4, 5E5)
Пример #3
0
    def plot_profiles_delta(self, ax=None):
        if ax is None:
            ax = plt.gca()
        plt.sca(ax)
        ax.set_axis_bgcolor("gray")

        n_profiles = int((self.extent[1] - self.extent[0]) / ais_code.ais_spacing_seconds) + 1
        ranges = np.arange(80., 300., 1.)
        times  = np.arange(self.extent[0], self.extent[1], ais_code.ais_spacing_seconds)
        img = np.zeros((len(times), len(ranges))) + np.nan

        for i, d in enumerate(self.digitization_list):
            if d.is_invertible():
                d.invert(substitute_fp=ais_code.ne_to_fp(4.))
                if d.altitude.size:
                    # as it comes from invert, local values are first, peaks are last
                    ii = round((float(d.time) - times[0]) / ais_code.ais_spacing_seconds)
                    img[ii,:] = np.interp(ranges, d.altitude[::-1],
                                            np.log10(d.density[::-1]),
                                            right=np.nan, left=np.nan)[::-1]

                    # This gives departures from the curve defined by the extrapolation to the first reflection point
                    # h = -1. * (d.altitude[0] - d.altitude[1]) / (np.log(d.density[0]/d.density[1]))
                    # img[ii, :] = np.log10(10.**img[ii,:] - d.density[1] * np.exp(-1. * (ranges - d.altitude[1]) / h))

                    # This gives departures from the Morgan et al model
                    sza = np.interp(d.time, self.t, self.sza)
                    # if sza < 90.:
                    # chap = mars.ChapmanLayer()
                    # # inx, = np.where(np.isfinite(img[ii,:]))
                    # # chap.fit(ranges[inx], 10**img[ii,inx[::-1]], sza)
                    # try:
                    #     chap.fit(d.altitude[::-1], d.density[::-1], np.deg2rad(sza))
                    #     model_densities = chap(ranges, np.deg2rad(sza))
                    #     print chap
                    #     print 'peak:', d.altitude[-1], d.density[-1], sza
                    # except ValueError, e:
                    #     print e
                    #     continue

                    model_densities = self.ionosphere_model(ranges, np.deg2rad(sza))
                    # img[ii, :] = np.log10(10.**img[ii,:] - model_densities)
                    img[ii, :] = 10.**img[ii,:] - model_densities[::-1]

                    # if True:
                    #      ax = plt.gca()
                    #      plt.figure()
                    #      plt.plot(np.log10(d.density), d.altitude,'k-')
                    #      if sza < 90.:
                    #          plt.plot(np.log10(model_densities), ranges,'r-')
                    #          # plt.plot(np.log10(chap(ranges)), ranges, 'r', ls='dotted')
                    #          # plt.plot(np.log10(self.ionosphere_model(ranges, np.deg2rad(sza))), ranges, 'b-')
                    #          # plt.plot(np.log10(self.ionosphere_model(ranges)), ranges, 'b', ls='dotted')
                    #      plt.xlim(2,6)
                    #      plt.sca(ax)

        extent = (self.extent[0], self.extent[1], np.nanmin(ranges), np.nanmax(ranges))
        plt.imshow(img.T, interpolation='Nearest', extent=extent,
                origin='upper',aspect='auto', cmap=matplotlib.cm.RdBu_r, vmin=-1E5,vmax=1E5)

        celsius.ylabel("alt. / km")

        old_ax = plt.gca()
        plt.colorbar(cax = celsius.make_colorbar_cax(), ticks=[-1E5,0,1E5],format='%.1G')
        plt.ylabel(r"log $\Delta n_e$ / cm$^{-3}$")
        plt.sca(old_ax)