最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python根據(jù)站點列表繪制站坐標全球分布圖的示例

 更新時間:2021年12月15日 12:11:08   作者:LZ_CUMT  
這篇文章主要介紹了Python根據(jù)站點列表繪制站坐標全球分布圖,輸入站點列表文件、snx全球站點坐標文件,本文通過示例代碼給大家介紹的非常詳細,需要的朋友可以參考下

根據(jù)站點列表繪制站坐標全球分布圖
輸入:站點列表文件、SNX全球站點坐標文件
站點列表文件示例(可手動創(chuàng)建):

SNX全球站點坐標文件下載地址:
ftp://igs.gnsswhu.cn/pub/whu/pub/gps/products/YYYY/igsyyPwwww.snx.Z
結果輸出:

代碼:

# coding=utf-8
# !/usr/bin/env python
'''
 Program:plot_global_sitemap.py 
 Function:根據(jù)站點列表繪制站坐標全球分布圖
 Author:LZ_CUMT
 Version:1.0
 Date:2021/12/10
 '''
from math import pi, sqrt, atan, atan2, sin, cos
import matplotlib.pyplot as plt
import matplotlib as mpl
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter

# xyz轉換為llh(經緯度)
def xyz2llh(ecef, site):
    aell = 6378137.0
    fell = 1.0 / 298.257223563
    deg = pi / 180
    u = ecef[0]
    v = ecef[1]
    w = ecef[2]
    esq = 2*fell-fell*fell
    lat = 0
    N = 0
    if w == 0:
        lat = 0
    else:
        lat0 = atan(w/(1-esq)*sqrt(u*u+v*v))
        j = 0
        delta = 10 ^ 6
        limit = 0.000001/3600*deg
        while delta > limit:
            N = aell / sqrt(1 - esq * sin(lat0)*sin(lat0))
            lat = atan((w / sqrt(u*u + v*v)) * (1 + (esq * N * sin(lat0) / w)))
            delta = abs(lat0 - lat)
            lat0 = lat
            j = j + 1
            if j > 10:
                break
    long = atan2(v, u)
    h = (sqrt(u*u+v*v)/cos(lat))-N
    llh = [site, long * 180 / pi, lat * 180 / pi, h]
    return llh

# 由站點文件獲取站點列表存入sitelist
def getSite(listfile):
    sitelist = []
    f = open(listfile)
    ln = f.readline()
    while ln:
        sitelist.append(ln[0:4].upper())
        ln = f.readline()
    return sitelist

# 根據(jù)站點名在snx文件中搜索XYZ坐標轉化為經緯度并輸出
def getBLH_single(site,snxlines):
    xyz = [0, 0, 0]
    for ln in snxlines:
        if site in ln:
            if 'STAX   ' in ln:
                xyz[0] = float(ln[47:68])
            if 'STAY   ' in ln:
                xyz[1] = float(ln[47:68])
            if 'STAZ   ' in ln:
                xyz[2] = float(ln[47:68])
    blh = xyz2llh(xyz, site)
    if len(blh) != 4:
        print('[INFO] Sitecrd for', site, 'is not found in the snxfile')
    return blh

def getBLH(listfile, snxfile):
    siteBLH = []
    sitelist = getSite(listfile)
    f = open(snxfile)
    lns = f.readlines()
    for site in sitelist:
        siteBLH.append(getBLH_single(site, lns))
    return siteBLH

def plotsite(siteBLH):
    # mpl.rcParams['font.sans-serif'] = ['Helvetical']
    mpl.rcParams['axes.unicode_minus'] = False
    mpl.rc('xtick', labelsize=9)
    mpl.rc('ytick', labelsize=9)
    mpl.rcParams['xtick.direction'] = 'in'
    mpl.rcParams['ytick.direction'] = 'in'

    fig = plt.figure(figsize=(14, 7))
    ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=150))
    ax.set_extent([-180, 180, -90, 90], crs=ccrs.PlateCarree())
    ax.set_xticks([0, 60, 120, 180, 240, 300, 360], crs=ccrs.PlateCarree())
    ax.set_yticks([-90, -60, -30, 0, 30, 60, 90], crs=ccrs.PlateCarree())
    ax.add_feature(cfeature.LAND)
    ax.add_feature(cfeature.OCEAN)
    ax.add_feature(cfeature.COASTLINE, linewidth=0.1)

    for site in siteBLH:
        ax.plot(site[1], site[2], 'o', color='r', mec='k', mew=0.5, transform=ccrs.Geodetic(), ms=13.0)
        plt.text(site[1] + 1.5, site[2] + 1.5, site[0], transform=ccrs.Geodetic(),fontsize='x-large')  # 添加站名標注
    plt.xticks(fontsize='x-large')
    plt.yticks(fontsize='x-large')
    lon_formatter = LongitudeFormatter(zero_direction_label=True)
    lat_formatter = LatitudeFormatter()
    ax.xaxis.set_major_formatter(lon_formatter)
    ax.yaxis.set_major_formatter(lat_formatter)

    fig.savefig('global_sitemap.png', bbox_inches='tight', dpi=400)
    plt.show()


if __name__ == '__main__':
    listfile = r'site.info'               # 輸入要畫的站點列表文件
    snxfile = r'igs21P2177.snx'              # 輸入IGS站坐標文件
    siteBLH = getBLH(listfile, snxfile)   # 獲取所有站點的經緯度
    plotsite(siteBLH)           # 畫圖
    print('[INFO] Plot complete!')        # 完成

到此這篇關于Python根據(jù)站點列表繪制站坐標全球分布圖的文章就介紹到這了,更多相關python繪制站坐標全球分布圖內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

最新評論

客服| 海门市| 武安市| 县级市| 玉龙| 枞阳县| 玉龙| 焦作市| 聊城市| 东兰县| 安远县| 隆子县| 和顺县| 乐清市| 平湖市| 西峡县| 广河县| 修武县| 望城县| 汝州市| 唐河县| 济宁市| 固始县| 原阳县| 宝清县| 新野县| 清流县| 巴林左旗| 玉树县| 长武县| 怀集县| 堆龙德庆县| 将乐县| 固安县| 溆浦县| 文水县| 彭州市| 遵化市| 武汉市| 盐亭县| 滦南县|