欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python根據(jù)站點(diǎn)列表繪制站坐標(biāo)全球分布圖的示例

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

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

SNX全球站點(diǎn)坐標(biāo)文件下載地址:
ftp://igs.gnsswhu.cn/pub/whu/pub/gps/products/YYYY/igsyyPwwww.snx.Z
結(jié)果輸出:

代碼:

# coding=utf-8
# !/usr/bin/env python
'''
 Program:plot_global_sitemap.py 
 Function:根據(jù)站點(diǎn)列表繪制站坐標(biāo)全球分布圖
 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轉(zhuǎn)換為llh(經(jīng)緯度)
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

# 由站點(diǎn)文件獲取站點(diǎn)列表存入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ù)站點(diǎn)名在snx文件中搜索XYZ坐標(biāo)轉(zhuǎn)化為經(jīng)緯度并輸出
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')  # 添加站名標(biāo)注
    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'               # 輸入要畫(huà)的站點(diǎn)列表文件
    snxfile = r'igs21P2177.snx'              # 輸入IGS站坐標(biāo)文件
    siteBLH = getBLH(listfile, snxfile)   # 獲取所有站點(diǎn)的經(jīng)緯度
    plotsite(siteBLH)           # 畫(huà)圖
    print('[INFO] Plot complete!')        # 完成

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

相關(guān)文章

  • 在python中使用xlrd獲取合并單元格的方法

    在python中使用xlrd獲取合并單元格的方法

    今天小編就為大家分享一篇在python中使用xlrd獲取合并單元格的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-12-12
  • Python基于LightGBM進(jìn)行時(shí)間序列預(yù)測(cè)

    Python基于LightGBM進(jìn)行時(shí)間序列預(yù)測(cè)

    LightGBM是擴(kuò)展機(jī)器學(xué)習(xí)系統(tǒng)。是一款基于GBDT(梯度提升決策樹(shù))算法的分布梯度提升框架。其設(shè)計(jì)思路主要集中在減少數(shù)據(jù)對(duì)內(nèi)存與計(jì)算性能的使用上,以及減少多機(jī)器并行計(jì)算時(shí)的通訊代價(jià)。本文將通過(guò)LightGBM進(jìn)行時(shí)間序列預(yù)測(cè),感興趣的可以了解一下
    2022-03-03
  • 如何在Win10系統(tǒng)使用Python3連接Hive

    如何在Win10系統(tǒng)使用Python3連接Hive

    這篇文章主要介紹了如何在Win10系統(tǒng)使用Python3連接Hive,幫助大家更好的利用python讀取數(shù)據(jù),進(jìn)行探索、分析和挖掘工作。感興趣的朋友可以了解下
    2020-10-10
  • Python中使用語(yǔ)句導(dǎo)入模塊或包的機(jī)制研究

    Python中使用語(yǔ)句導(dǎo)入模塊或包的機(jī)制研究

    這篇文章主要介紹了Python中使用語(yǔ)句導(dǎo)入模塊或包的機(jī)制研究,同時(shí)對(duì)比了幾種導(dǎo)入包或模塊的語(yǔ)句并簡(jiǎn)要說(shuō)明了這幾種方法之間的幾點(diǎn)優(yōu)劣,需要的朋友可以參考下
    2015-03-03
  • Python實(shí)現(xiàn)矩陣運(yùn)算的方法代碼實(shí)例

    Python實(shí)現(xiàn)矩陣運(yùn)算的方法代碼實(shí)例

    這篇文章主要介紹了Python實(shí)現(xiàn)矩陣運(yùn)算的方法代碼實(shí)例,想用python實(shí)現(xiàn)一個(gè)矩陣類(lèi),它可以像matlab或者numpy中的矩陣一樣進(jìn)行運(yùn)算,生成一個(gè)矩陣類(lèi)Matrix之后,他接收一個(gè)二維列表作為輸入,然后將對(duì)應(yīng)的值寫(xiě)到矩陣對(duì)應(yīng)的位置,需要的朋友可以參考下
    2023-08-08
  • Pandas加速代碼之避免使用for循環(huán)

    Pandas加速代碼之避免使用for循環(huán)

    如果你使用Python和Pandas進(jìn)行數(shù)據(jù)分析,循環(huán)是不可避免要使用的。這篇文章主要給大家介紹了關(guān)于Pandas加速代碼之避免使用for循環(huán)的相關(guān)資料,需要的朋友可以參考下
    2021-05-05
  • 教你python 中如何取出colomap部分的顏色范圍

    教你python 中如何取出colomap部分的顏色范圍

    這篇文章主要介紹了python 中如何取出colomap部分的顏色范圍,本文以以jet為例給大家提供一種方法,可以提取colormap色標(biāo)中的一部分,取出我們滿意的色標(biāo)區(qū)域,感興趣的朋友跟隨小編一起看看吧
    2022-02-02
  • Python網(wǎng)絡(luò)爬蟲(chóng)實(shí)例講解

    Python網(wǎng)絡(luò)爬蟲(chóng)實(shí)例講解

    這篇文章主要為大家詳細(xì)介紹了Python網(wǎng)絡(luò)爬蟲(chóng)實(shí)例,爬蟲(chóng)的定義、主要框架等基礎(chǔ)概念,感興趣的小伙伴們可以參考一下
    2016-04-04
  • 在pytorch中為Module和Tensor指定GPU的例子

    在pytorch中為Module和Tensor指定GPU的例子

    今天小編就為大家分享一篇在pytorch中為Module和Tensor指定GPU的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-08-08
  • 使用 prometheus python 庫(kù)編寫(xiě)自定義指標(biāo)的方法(完整代碼)

    使用 prometheus python 庫(kù)編寫(xiě)自定義指標(biāo)的方法(完整代碼)

    這篇文章主要介紹了使用 prometheus python 庫(kù)編寫(xiě)自定義指標(biāo)的方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-06-06

最新評(píng)論