爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 16721|回复: 5

[程序设计] 如何使用pythong根据站点的经纬度值画广东省的站点图呢?

[复制链接]

新浪微博达人勋

发表于 2020-2-6 17:26:22 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
我想请问一下,如何使用pythong根据站点的经纬度值画广东省的站点图呢?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2020-3-2 21:18:59 | 显示全部楼层
看了相关的例子还是画不出来
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2021-3-15 20:45:49 | 显示全部楼层
画的40N以上的站点图,文件为csv格式。仅供参考

  1. import pandas as pd
  2. import matplotlib.pyplot as plt
  3. import cartopy.crs as ccrs
  4. import cartopy.feature as cfeature
  5. import cartopy.mpl.ticker as cticker
  6. import cartopy.io.shapereader as shpreader
  7. import numpy as np

  8. data = pd.read_csv("G:/GHCND/ghcnd_all/ghcnd-stations-60E-170W_40-90.csv",sep=',', \
  9.                         header=None, names=['station','lat','lon','altitude','country','number'])  

  10. #建立画布
  11. fig2 = plt.figure(figsize=(10,8))
  12. proj = ccrs.PlateCarree(central_longitude=110)
  13. leftlon, rightlon, lowerlat, upperlat = (60,190,0,90)
  14. #绘制地图
  15. f2_ax1 = fig2.add_subplot(1,1,1,projection = proj)
  16. #在画布的绝对坐标建立子图
  17. f2_ax1.set_extent([leftlon, rightlon, lowerlat, upperlat], crs=ccrs.PlateCarree())
  18. #海岸线,50m精度
  19. f2_ax1.add_feature(cfeature.COASTLINE.with_scale('50m'))

  20. #以下6条语句是定义地理坐标标签格式
  21. f2_ax1.set_xticks(np.arange(leftlon,rightlon,20), crs=ccrs.PlateCarree())
  22. f2_ax1.set_yticks(np.arange(lowerlat,upperlat,20), crs=ccrs.PlateCarree())
  23. lon_formatter = cticker.LongitudeFormatter()
  24. lat_formatter = cticker.LatitudeFormatter()

  25. f2_ax1.xaxis.set_major_formatter(lon_formatter)
  26. f2_ax1.yaxis.set_major_formatter(lat_formatter)

  27. f2_ax1.set_title('Station',loc='center',fontsize =15)

  28. s = f2_ax1.scatter(data.lon,data.lat,s = 5,c='k',transform=ccrs.PlateCarree())

  29. #fig2.savefig('./pic/station40.jpg')
  30. plt.show()
复制代码
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2021-3-16 12:13:06 | 显示全部楼层
谢谢大家!我已经会啦
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2021-4-6 23:13:34 | 显示全部楼层
楼主会了吗,最近要画华南地区的站点图,不知道怎么下手,求解惑
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2021-4-13 09:51:58 | 显示全部楼层
yuyuci 发表于 2021-4-6 23:13
楼主会了吗,最近要画华南地区的站点图,不知道怎么下手,求解惑

先抠出华南地区的shp图,然后使用scatter画就好啦!
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表