日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > python >内容正文

python

python台风动图绘制_使用Python绘制台风轨迹图的示例代码

發(fā)布時(shí)間:2023/12/15 python 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python台风动图绘制_使用Python绘制台风轨迹图的示例代码 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

參考:

使用CMA熱帶氣旋最佳路徑數(shù)據(jù)集,對(duì)我國(guó)周邊的臺(tái)風(fēng)進(jìn)行繪制

import re

import os

import numpy as np

import matplotlib.pyplot as plt

from mpl_toolkits.basemap import Basemap

path=r"E:\Computer Science\數(shù)學(xué)建模\第二次模擬賽題\附件"

files= os.listdir(path) #得到文件夾下的所有文件名稱

data=[]

all=[]

for file in files: #遍歷文件夾

if not os.path.isdir(file): # 判斷是否是文件夾,不是文件夾才打開(kāi)

f = open(path + "/" + file) # 打開(kāi)文件

tmp=f.readlines()

for i in tmp:

line=i.split()

if(line[0]=='66666'):

if(len(all)>0):

data.append(all)

# print(line)

all=[]

else:

we=(int(line[2])*0.1,int(line[3])*0.1)

all.append(we)

# print(data)

print(len(data))

CHN='E:\Computer Science\數(shù)學(xué)建模\python_basemap'

plt.figure(figsize=(20,12))

map=Basemap(llcrnrlon=70,llcrnrlat=2,urcrnrlon=170,urcrnrlat=58)

map.drawcoastlines()

map.drawcountries()

#添加河流

# map.drawrivers(color='blue',linewidth=0.3)

#添加大陸

map.readshapefile(CHN+'\gadm36_CHN_shp\gadm36_CHN_1',

'states',color='blue',drawbounds=True)

map.readshapefile(CHN+'\gadm36_TWN_shp\gadm36_TWN_1',

'taiwan',color='blue',drawbounds=True)

#添加經(jīng)緯線

parallels = np.linspace(3,55,5)

# print(parallels)

map.drawparallels(parallels,labels=[False,True,False,False],fontsize=5)

meridians = np.linspace(70,170,5)

# print(meridians)

map.drawmeridians(meridians,labels=[False,False,False,True],fontsize=5)

plt.rcParams['savefig.dpi'] = 300 #圖片像素

plt.rcParams['figure.dpi'] = 300 #分辨率

ans=1

x=[]

y=[]

for typhoon in data:

length=len(typhoon)

print("%d is process!" % ans)

ans += 1

for i in range(length):

x.append(typhoon[i][1])

y.append(typhoon[i][0])

# print(x,y)

# map.plot(x, y, 'c*-', linewidth=2)

map.plot(x, y, color='r',linewidth=1.5)

x = []

y = []

map.fillcontinents()

plt.title(r'$China\ Typhoon$',fontsize=24)

# plt.ylim(70, 170)

# plt.xlim(2, 58)

plt.show()

效果圖:

以上就是使用Python繪制臺(tái)風(fēng)軌跡圖的示例代碼的詳細(xì)內(nèi)容,更多關(guān)于Python繪制軌跡圖的資料請(qǐng)關(guān)注自學(xué)編程網(wǎng)其它相關(guān)文章!

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)

總結(jié)

以上是生活随笔為你收集整理的python台风动图绘制_使用Python绘制台风轨迹图的示例代码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。