반응형

     정보

    • 업무명    : 파이썬 라디오미터 밝기온도 자료를 이용한 시계열 그래프

    • 작성자    : 박진만

    • 작성일    : 2019-09-07

    • 설   명    : 라디오미터 밝기온도 자료를 이용하여 시계열을 그리는 코드

    • 수정이력 :

     

     내용

    [특징]

    • 라디오미터의 14개 채널에 대한 밝기온도 자료를 입력 자료로 받아 월별로 시계열을 그린다.

     

    [기능]

    • 다중 line에 대한 시계열 plot

     

    [활용 자료]

    •  matplotlib, numpy 등 파이썬 라이브러리

     

    [자료 처리 방안 및 활용 분석 기법]

    • 없음

     

    [사용법]

    • INPUT 자료를 이용한 후 아래의 소스코드 실행

     

    [사용 OS]

    • Windows 10

     

    [사용 언어]

    • Python 3.7

     

     소스 코드

     

    [코드 블럭]

    os.chdir("D:/ARTS/RADIOMETERDATA/RADIOMETER/monthly_10mean/")
    
    list = ["201704","201705","201706","201707","201708","201709","201710","201711","201712","201801",
            "201802","201803","201804","201805","201806","201807","201808"]
    
    
    for i in list:
     
        data = pd.read_csv(
            "BRT_" + i + ".csv"
            #, skiprows=[0]
            , sep=","
            , header=0
            )
    
        #print(data)
        data.columns = ["julian","DateTime", "X22_24", "X23_24","X23_84","X25_44","X26_24","X27_84",
                        "X31_40","X51_26","X52_28","X53_86","X54_94","X56_66","X57_30","X58_00"]
    
        data["sDateTime"] = pd.to_datetime(data["DateTime"], format='%Y-%m-%d %H:%M:%S')
    
        dataL1 = (
            data >> 
                mutate(
                    year = X.sDateTime.dt.strftime("%Y")
                    , month = X.sDateTime.dt.strftime("%m")
                    , day = X.sDateTime.dt.strftime("%d")
                    , hour = X.sDateTime.dt.strftime("%H")
                    , minute = X.sDateTime.dt.strftime("%M")
                    , second = X.sDateTime.dt.strftime("%S")
                    , date = X.sDateTime.dt.strftime("%Y-%m-%d")
                ) )
        
    
        #print(dataL1.describe())
    
        # define plot size in inches (width, height) & resolution(DPI)
        plt.figure(figsize=(12, 10))
        #fig, ax = plt.subplots(figsize=(12, 10))
    
        # style
        plt.style.use('seaborn-whitegrid')
    
        # define font size
        plt.rc("font", size=22)
        plt.rcParams['font.family'] = 'sans-serif'
        plt.rcParams["font.weight"] = "bold"
        plt.rcParams['axes.labelsize'] = 22
        plt.rcParams['xtick.labelsize'] = 22
        plt.rcParams['ytick.labelsize'] = 22
        plt.rcParams["axes.labelweight"] = "bold"
        plt.rcParams["axes.titleweight"] = "bold"
    
        x = dataL1.julian.values
        
        y1 = dataL1.X22_24.values
        y2 = dataL1.X23_24.values
        y3 = dataL1.X23_84.values
        y4 = dataL1.X25_44.values
        y5 = dataL1.X26_24.values
        y6 = dataL1.X27_84.values
        y7 = dataL1.X31_40.values
        y8 = dataL1.X51_26.values
        y9 = dataL1.X52_28.values
        y10 = dataL1.X53_86.values
        y11 = dataL1.X54_94.values
        y12 = dataL1.X56_66.values
        y13 = dataL1.X57_30.values
        y14 = dataL1.X58_00.values
        
        xVal = np.unique(dataL1["julian"].to_numpy())
        
        print(xVal.shape)
        #print(yVal.shape)
        #print(zVal.shape)
        
        tick = np.unique(dataL1["julian"].to_numpy())
        tick1 = np.int32(tick)
        tick2 = np.unique(tick1)
        
        
        #BRT TEMP
        plt.plot(x, y1, color="black", label = '22.24Ghz')
        plt.plot(x, y2, color="rosybrown", label = '23.24Ghz')
        plt.plot(x, y3, color="gold", label = '23.84Ghz')
        plt.plot(x, y4, color="forestgreen", label = '25.44Ghz')
        plt.plot(x, y5, color="cyan", label = '26.24Ghz')
        plt.plot(x, y6, color="slategrey", label = '27.84Ghz')
        plt.plot(x, y7, color="blue", label = '31.40Ghz')
        plt.plot(x, y8, color="red", label = '51.26Ghz')
        plt.plot(x, y9, color="pink", label = '52.28Ghz')
        plt.plot(x, y10, color="violet", label = '53.86Ghz')
        plt.plot(x, y11, color="green", label = '54.94Ghz')
        plt.plot(x, y12, color="lightgreen", label = '56.66Ghz')
        plt.plot(x, y13, color="dodgerblue", label = '57.30Ghz')
        plt.plot(x, y14, color="navy", label = '58.00Ghz')
        
        plt.ylim(0, 350)
        #plt.get_position()
        #plt.set_position([box.x0, box.y0, box.width * 0.8, box.height])
        lgd = plt.legend(fontsize=14,bbox_to_anchor=(1.20,1.0),loc = 'upper right')
    
    
        plt.xticks(np.arange(min(tick2), max(tick2)+1,1.0), size = 14, rotation = 90)
        plt.xlim(min(tick2), max(tick2)+1,1.0)
            
    
        
        plt.title("BRT(RADIOSONDE)")
        plt.xlabel("Julianday(" + i[0:4] + "." + i[4:6] + ")")
        plt.ylabel("BRT (K)")
    
        plt.savefig("D:/ARTS/result/BRT_RESULT/BRT(RADIOMETER)_" + i + ".png",bbox_extra_artists=(lgd,), bbox_inches='tight')

     

    [Github]

     

     

     

     결과

    • 라디오미터 밝기온도를 이용한 가시화

    그림. 라디오미터 밝기온도를 이용한 가시화.

     

     참고문헌

    [논문]

    • 없음

    [보고서]

    • 없음

    [URL]

    • 없음

     

    블로그에 대한 궁금하신 점을 문의하시면 자세히 답변드리겠습니다.

    E. ​sangho.lee.1990@gmail.com & ​saimang0804@gmail.com

    반응형
    • 네이버 블러그 공유하기
    • 네이버 밴드에 공유하기
    • 페이스북 공유하기
    • 카카오스토리 공유하기