Python根据IGS测站信息绘制测站全球分布图

  • Post author:
  • Post category:python




环境准备



软件

系统:Windows 10

版本:Python 3.8.1

需要安装三方库:Basemap,安装方法参照:

Basemap库安装



数据

IGS官网全球测站信息文件IGSNetwork.json,格式为json,下载网址为:

IGS测站列表


所需绘制测站列表,可存储于文本文件,格式参照如下:

测站格式



代码实现

'''
 @ This script is used for drawing the distribution map of ground stations
 @ 2021.01.15
 @ By ZWzgtx
'''

import os
import sys
import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import json

def main(argv):
	'''
	argv[0]: The script file(draw_station_map.py)
	argv[1]: The working directory
	argv[2]: The name of IGS file containing all station information with json format(IGSNetwork.json, from https://www.igs.org/maps/#station-map)
	argv[3]: The station list for drawing(Optional, draw all stations if not given)
	'''
	##arg setting
	nargv = len(sys.argv)
	if nargv < 3:
		print("Wrong inputs!")
		print("Usage: python draw_station_map.py /home/data IGSNetwork.json")
		print("Usage: python draw_station_map.py /home/data IGSNetwork.json site_list")
		sys.exit()
	work_dir = sys.argv[1]
	sta_file_all = sys.argv[2]
	if nargv > 3:
		sta_file_inp = sys.argv[3]
	if not os.path.exists(work_dir):
		print("The path: " + work_dir + " does not exist!")
		print("Please check!")
		sys.exit()
	os.chdir(work_dir)
	if not os.path.exists(sta_file_all



版权声明:本文为ZWzgtx原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。