爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 2794|回复: 2

请教怎么使天气符号图与标注显示在同一界面

[复制链接]

新浪微博达人勋

发表于 2018-12-26 18:30:55 | 显示全部楼层 |阅读模式

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

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

x
各位大神,请教下,我用王老师的天气符号脚本(http://bbs.06climate.com/forum.p ... id=30931&fromuid=27)绘制天气天气符号并给给一些站名备注,可是为什么,天气符号图在meteoinfo script sample 界面,而标注的站名缺在figure界面,怎么使两者在一个界面。
1.png
#-----------------------------------------------------
# Author: Yaqiang Wang
# Date: 2014-12-1
# Purpose: Get and plot station weather phenomenon
# Note: Sample
#-----------------------------------------------------
#---- Import classes
print 'Import classes...'
from org.meteoinfo.layout import MapLayout
from org.meteoinfo.data.mapdata import MapDataManage
from org.meteoinfo.data.meteodata import MeteoDataInfo, DrawMeteoData
from org.meteoinfo.layout import LegendStyles
from org.meteoinfo.layout import PaperSize
from org.meteoinfo.global import Extent
import os
from java.awt import Color
from javax.swing import JFrame

#---- Set directories
print 'Set directories...'
baseDir = 'D:/MeteoInfo_1.6.10/MeteoInfo'
dataDir = os.path.join(baseDir, 'sample')
mapDir = os.path.join(baseDir, 'map')

#---- Create MapLayout object
mapLayout = MapLayout()
mapFrame = mapLayout.getActiveMapFrame()
ps = PaperSize('Custum', 500, 550)
mapLayout.setPaperSize(ps)

#---- Load country layer
print 'Load country layer...'
countryLayer = MapDataManage.loadLayer(os.path.join(mapDir, 'cn_province.shp'))
lb = countryLayer.getLegendScheme().getLegendBreaks().get(0)
lb.setDrawFill(False)
lb.setOutlineColor(Color.black)
mapFrame.addLayer(countryLayer)

#---- Create MeteoDataInfo object
mdi = MeteoDataInfo()

#---- Open a MICAPS data file
fn = os.path.join(dataDir, 'E:/201801/micaps/MicData/Surface/PLOT/18012508.000')
mdi.openMICAPSData(fn)

#---- Get station data
sdata = mdi.getStationData('WeatherNow')


#---- Create station weather layer from the station data
layer = DrawMeteoData.createWeatherSymbolLayer(sdata, 'All Weather', 'WeatherSymbole')
#---- Add layer
mapFrame.addLayer(layer)

#--- Move layer to bottom
mapFrame.moveLayer(layer, 0)

#---- Add title
#title = mapLayout.addText('MeteoInfo script demo', 350, 30, 'Arial', 16)

#Add   station name
geoshow(110.02,27.57, size=14, color='r', marker='S')
axis([107, 116, 24, 32])
text(110.02,27.57, u'怀化',fontname=u'楷体', fontsize=10)

#---- Set layout map
print 'Set layout map...'
mapLayout.getActiveLayoutMap().setWidth(600)
mapLayout.getActiveLayoutMap().zoomToExtentLonLatEx(Extent(107, 116, 24, 32))

#---- Set mapframe
mapFrame.setGridXDelt(2)
mapFrame.setGridYDelt(2)

#---- Add legend
#legend = mapLayout.addLegend(628, 10)
#legend.setLegendStyle(LegendStyles.Normal)
#legend.setLegendLayer(layer)
#legend.setColumnNumber(4)
#legend.setTitle('Weather')

#Plot
#axesm(bgcolor=(204,255,255))
frame = JFrame('MeteoInfo Script Sample', size = (530, 530))
frame.add(mapLayout)
frame.visible = True
figDir = 'E:/201801/micaps'

mapLayout.exportToPicture(os.path.join(figDir, '18012508.png'))
print 'Finished!'

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-12-26 18:41:29 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-12-27 16:58:08 | 显示全部楼层
已解决,谢谢王老师,
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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