0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Trible R10 GNSS rtkファイルから測点と座標情報の行だけを抽出する

Posted at

Trible R10 GNSS 専用のアプリを持ってないので,rtkファイルから測点と座標情報の行だけを抽出するプログラムをつくりました.
以下は,Pycharmのjupyter notebookから持ってきたので,ちょっとおかしな記載がありますが,pyファイルで保存すれば,pythonで動くと思います.

#%% md

# trimble用

#when calculate again, you need
#if you want


#define working directroy
%cd C:\GNSS\data\vrs

#%% md

# まずは,入力ファイルを設定します.

#%%

# inp_file="2021-07-05_10.nmea"
# inp_file="VRS直_2021-07-05-12-48-07.rtk"
inp_file="VRS直_2021-09-10-15-37-24.rtk"

#%% md
# ひとまず,上のところ(ファイルが入っているディレクリトリとファイル名)を入力すれば,
# あとは全実行で進みます(抽出したテキストファイルが出力される.).

#%%
import pandas as pd
import numpy as np
import csv
#%%

#if you want
#check current directory
%pwd

#%%

#check files
%ls


#%% md

# base_nameを取得しておきます.
# 出力ファイル名を自動で作成するため

#%%

type(inp_file)
base_name=inp_file.split('.',1)[0]
base_name
# inp_file="VRS直_2021-07-05-12-48-07_get.rtk"

#%%

# make output filename from input file automatically

# out_file="2021-07-05_10_GNRMC_out_test.csv"
# out_file="VRS直_2021-07-05-12-48-07_get.rtk"
out_file=base_name+"_get.rtk"
out_file
# out_file="VRS直_2021-07-05-12-48-07_get.rtk"

#%% md

# encodeを指定します.
## nmeaはUTF-8か
## trimbleはshift_jisか


#%%

# enc_sty="UTF-8"
enc_sty="shift_jis"

#%%

# with open("2021-07-05_10.nmea", "r", encoding="UTF-8", errors="", newline="" ) as f:
# with open(inp_file, "r", encoding="UTF-8", errors="", newline="" ) as f:
with open(inp_file, "r", encoding=enc_sty, errors="", newline="" ) as f:
    lst = csv.reader(f, delimiter=",")
    df = pd.DataFrame(lst).rename(columns={0:'ID'})
    # df = pd.DataFrame(lst)

#%%

# df.query('cols in ["GG1","GG2"]')
df.query('ID in ["GG1","GG2"]').to_csv(out_file,header=False, index=False)
# df[df[0].str.contains(id)].to_csv(out_file,header=False, index=False)

#%%
df.query('ID in ["GG1","GG2"]')


# !!!!FIN


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?