Example #1
0
def scatter_datetime(
    year,
    month,
    day,
    t,
    y,
    colour="C0",
    marcador="o",
    tamanio=1,
    transparencia=1,
):
    timestamps = array_datenums(year, month, day, t)
    t_graph = md.date2num(timestamps)

    plt.subplots_adjust(bottom=0.2)
    plt.xticks(rotation=25)
    ax = plt.gca()
    xfmt = md.DateFormatter("%H:%M:%S")
    ax.xaxis.set_major_formatter(xfmt)
    plt.scatter(
        t_graph,
        y,
        marker=marcador,
        color=colour,
        linewidths=tamanio,
        alpha=transparencia,
    )
Example #2
0
def imshow_UTC(year,
               month,
               day,
               t,
               heatmap,
               eje_y,
               colormap="inferno",
               minimo=0,
               maximo=20):
    """ Le das una fecha en np.datetime64 (UTC) y te grafica el imshow.    """
    timestamps = array_datenums(year, month, day, t)
    t_graph = md.date2num(timestamps)

    plt.subplots_adjust(bottom=0.2)
    plt.xticks(rotation=25)
    ax = plt.gca()
    xfmt = md.DateFormatter("%H:%M:%S")
    ax.xaxis.set_major_formatter(xfmt)
    plt.imshow(
        heatmap,
        aspect="auto",
        origin="lower",
        extent=(t_graph[0], t_graph[-1], eje_y[0], eje_y[-1]),
        cmap=colormap,
        vmin=minimo,
        vmax=maximo,
    )
    plt.colorbar()
Example #3
0
def plot_datetime(
    year,
    month,
    day,
    t,
    y,
    colour="C0",
    estilo_linea="-",
    ancho_linea=1,
    transparencia=1,
):
    timestamps = array_datenums(year, month, day, t)
    t_graph = md.date2num(timestamps)

    plt.subplots_adjust(bottom=0.2)
    plt.xticks(rotation=25)
    ax = plt.gca()
    xfmt = md.DateFormatter("%H:%M:%S")
    ax.xaxis.set_major_formatter(xfmt)
    plt.plot(
        t_graph,
        y,
        linestyle=estilo_linea,
        color=colour,
        linewidth=ancho_linea,
        alpha=transparencia,
    )
Example #4
0
year, month, day, doy = fechas()
hora = input("Hora (HH) \n")

tiempos_txt = np.loadtxt("../outputs/t1t2t3t4.txt")
for i in range(len(tiempos_txt)):
    if (int(year) == int(tiempos_txt[i, 0])
            and int(doy) == int(tiempos_txt[i, 1])
            and int(hora) == int(tiempos_txt[i, 2])):
        tiempos = [
            tiempos_txt[i, 2],
            tiempos_txt[i, 3],
            tiempos_txt[i, 4],
            tiempos_txt[i, 5],
        ]
timestamps = array_datenums(year, month, day,
                            tiempos)  # lo convierto a datenum

# path = '../../../MAVEN/mag_1s/2016/03/' #path a los datos desde la desktop
path = f"../../../datos/clweb/{year}-{month}-{day}/"  # path a los datos desde la laptop
if os.path.isfile(path + "mag_filtrado.txt"):
    mag = np.loadtxt(path + "mag_filtrado.txt", skiprows=2)
    M = len(mag[:, 0])  # el numero de datos
    B = mag[:, :3]

    Bnorm = mag[:, -1]
    mag = np.loadtxt(path + "MAG.asc")
    Bxyz_paraperp = mag[:, 6:9]
else:
    mag = np.loadtxt(path + "MAG.asc")
    M = len(mag[:, 0])  # el numero de datos
    B = mag[:, 6:9]