• 时间序列流速剖面图


    import numpy as np
    import pandas as pd
    import datetime
    import re
    import time
    import glob
    import copy
    import matplotlib.dates as mdate
    from scipy.interpolate import make_interp_spline
    from scipy.interpolate import interp1d
    from matplotlib import pyplot as plt
    time_parse = lambda date: datetime.datetime.strptime(date, '%Y-%m-%d %H:%M:%S')
    df = pd.read_csv(r'.20200713_0_000_20-07-13_194858_ASCt.csv',encoding='utf-8', parse_dates=['date'], date_parser=time_parse)
    z = np.array(df['value'])
    b = df.groupby('date')
    pt = []
    # 获得值
    for date,b1 in b:
    pt.append(np.array(b1['value']).reshape(len(b1['value']),1))
    c= pt[0]
    c= np.hstack((c,pt[1]))
    z= c
    df.set_index(df['date'],inplace=True)
    print(z)
    ## 获得时间
    a = df.groupby(['hb'])
    o1 = a.get_group(2.18)

    s= o1.index
    # print(s)
    c = []
    x=np.array(s)
    #
    #
    for et,val in a:
    c.append(et)
    y = np.array(c)*-1
    print(x)
    print(y)
    # X,Y =np.meshgrid(x,y)
    # print(X)
    # print(Y)
    plt.rcParams['font.sans-serif'] = 'Microsoft YaHei'
    plt.gca().xaxis.set_major_formatter(mdate.DateFormatter('%Y-%m-%d %H:%M:%S'))
    plt.xticks(pd.date_range(o1.index[0],o1.index[-1],freq='H'),rotation=45)
    SC = plt.contourf(x,y,z,50,cmap = 'rainbow') # 200代表了等高线的数量
    plt.colorbar()
    C = plt.contour(x,y,z,5,colors = 'black') # 画出等值线
    plt.clabel(C,inline = True,fontsize = 10) #标明等值线的大小
    plt.show()
  • 相关阅读:
    P3224 [HNOI2012]永无乡(平衡树合并)
    jquery的队列问题
    值得以后看的东西
    js的>>>
    js的set和get
    js数组的操作方法
    中文冒号检查了两个小时
    setintervalue传参数的三种方法
    js轮训
    npm全局安装
  • 原文地址:https://www.cnblogs.com/chenyun-delft3d/p/13652204.html
Copyright © 2020-2023  润新知