Ejemplo n.º 1
0
udata = mdi.getGridData('U')
vdata = mdi.getGridData('V')

#---- Create wind vector layer from the U/V grid data
layer = DrawMeteoData.createGridVectorLayer(udata, vdata,  'UV_Vector', True)
#layer = DrawMeteoData.createGridBarbLayer(udata, vdata,  'UV_Barb', True)
#layer = DrawMeteoData.createStreamlineLayer(udata, vdata, 'Z_Streamline', True)

#---- Add layer
mapFrame.addLayer(layer)

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

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

#---- Add wind arrow
windArrow = mapLayout.addWindArrow(660, 420)

#---- Zoom layout map
print 'Zoom layout map...'
mapLayout.getActiveLayoutMap().zoomToExtentLonLatEx(Extent(70, 140, 15, 55))

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

frame = JFrame('MeteoInfo Script Sample', size = (800, 600))
frame.add(mapLayout)
frame.visible = True
	else:
		lb.setCaption(str(values[i]) + ' - ' + str(values[i + 1]))
	lb.setDrawOutline(False)
	lbs.add(lb)

#---- Create shaded layer
print 'Create shaded layer...'	
layer = DrawMeteoData.createShadedLayer(gdata, ls, 'Rain_shaded', 'Rain', True)
layer.setMaskout(True)

#---- Add layer
mapFrame.addLayer(layer)
mapFrame.moveLayer(layer, 0)

#---- Add title
title = mapLayout.addText('Precipitation map of China', 280, 40, 'Arial', 18)
stime = stime + timedelta(hours=-6)
subTitle = mapLayout.addText('(' + stime.strftime('%Y-%m-%d %H:00') +
	' to ' + etime.strftime('%Y-%m-%d %H:00') + ')', 280, 60, 'Arial', 16)

#---- Set layout map
print 'Set layout map...'
layoutMap.setDrawGridLine(False)
layoutMap.setDrawNeatLine(False)
layoutMap.setDrawGridLabel(False)
layoutMap.setDrawGridTickLine(False)
layoutMap.setLeft(10)
layoutMap.setTop(10)
layoutMap.setWidth(620)
layoutMap.setHeight(450)
Ejemplo n.º 3
0
ls = LegendManage.createLegendSchemeFromGridData(gdata,
                                                 LegendType.GraduatedColor,
                                                 ShapeTypes.Polygon)

#---- Create pressure shaded layer
print 'Create pressure shaded layer...'
pressLayer = DrawMeteoData.createShadedLayer(gdata, ls, 'Pressure', 'PS', True)

#---- Add layer
mapFrame.addLayer(pressLayer)

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

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

#---- Project mapview
print 'Project mapview...'
projStr = '+proj=moll +lon_0=105'
projInfo = ProjectionInfo(projStr)
mapFrame.getMapView().projectLayers(projInfo)

#---- Set mapframe
mapFrame.setDrawNeatLine(False)
mapFrame.setDrawGridLine(True)
mapFrame.setDrawGridLabel(False)
mapFrame.setGridLabelPosition(GridLabelPosition.All)
mapFrame.setGridXDelt(30)
mapFrame.setGridYDelt(30)
Ejemplo n.º 4
0
#---- Create legend scheme
ls = LegendManage.createLegendSchemeFromGridData(gdata, LegendType.GraduatedColor, ShapeTypes.Polygon)

#---- Create pressure shaded layer
print 'Create pressure shaded layer...'
pressLayer = DrawMeteoData.createShadedLayer(gdata, ls, 'Pressure', 'PS', True)

#---- Add layer
mapFrame.addLayer(pressLayer)

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

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

#---- Project mapview
print 'Project mapview...'
projStr = '+proj=lcc +lat_1=30 +lat_2=60 +lat_0=0 +lon_0=110'
projInfo = ProjectionInfo(projStr)
mapFrame.getMapView().projectLayers(projInfo)
extent = Extent(78, 130, 15, 53)
mapFrame.getMapView().zoomToExtentLonLatEx(extent)

#---- Set mapframe
mapFrame.setDrawNeatLine(True)
mapFrame.setDrawGridLine(True)
mapFrame.setDrawGridLabel(True)
mapFrame.setGridLabelPosition(GridLabelPosition.LeftBottom)
mapFrame.setGridXDelt(10)
Ejemplo n.º 5
0
#---- Create legend scheme
ls = LegendManage.createLegendSchemeFromGridData(gdata, LegendType.GraduatedColor, ShapeTypes.Polygon)

#---- Create pressure shaded layer
print 'Create pressure shaded layer...'
pressLayer = DrawMeteoData.createShadedLayer(gdata, ls, 'Pressure', 'PS', True)

#---- Add layer
mapFrame.addLayer(pressLayer)

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

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

#---- Project mapview
print 'Project mapview...'
projStr = '+proj=moll +lon_0=105'
projInfo = ProjectionInfo(projStr)
mapFrame.getMapView().projectLayers(projInfo)

#---- Set mapframe
mapFrame.setDrawNeatLine(False)
mapFrame.setDrawGridLine(True)
mapFrame.setDrawGridLabel(False)
mapFrame.setGridLabelPosition(GridLabelPosition.All)
mapFrame.setGridXDelt(30)
mapFrame.setGridYDelt(30)
Ejemplo n.º 6
0
plot.setChartPlotMethod(ChartPlotMethod.LINE_POINT)
plot.getXAxis().setLabel('Time')
plot.getYAxis().setLabel('hPa')
plot.getYAxis().setInverse(True)
ls = trajLayer.getLegendScheme()
for i in range(0, dataset.getSeriesCount()):
	plot.setLegendBreak(i, ls.getLegendBreaks().get(i))
chart = Chart(None, plot)
chart.setDrawLegend(False)
layoutChart = mapLayout.addChart(5, 410)
layoutChart.setWidth(600)
layoutChart.setHeight(200)
layoutChart.setChart(chart)

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

#---- Zoom map
print 'Zoom map...'
mapLayout.getActiveLayoutMap().setWidth(550)
mapLayout.getActiveLayoutMap().setHeight(350)
mapFrame.getMapView().zoomToExtent(trajLayer.getExtent().extend(2, 2))

#---- Output figure
print 'Output figure...'
mapLayout.exportToPicture(os.path.join(figDir, 'traj_test.png'))

#---- Set mapframe
mapFrame.setGridXDelt(5)
mapFrame.setGridYDelt(5)
uv = DataMath.magnitude(uwnd, vwnd)
#uv = DataMath.Magnitude(uwnd, vwnd)
uvq = uv.mul(qv).div(9.8*1000)
#uvq = uv*qv/(9.8*1000)

#---- Create data layer
print 'Create data layer...'
dataLayer = DrawMeteoData.createShadedLayer(qhdivg, "WaterVaporFlux", "Flux", False)

#---- Add layer
print 'Add layers...'
mapFrame.addLayer(dataLayer)
mapFrame.moveLayer(dataLayer, 0)
#---- Zoom data
mapLayout.getActiveLayoutMap().zoomToExtentLonLatEx(Extent(0,360,-90.1,90.1))
#---- Set MapLayout
format = SimpleDateFormat('yyyy-MM-dd')
aTime = dataAir.getDataInfo().getTimes().get(tIdx)
mapLayout.addText('Water Vapor Flux Divergence - ' + format.format(aTime), 320, 30, 'Arial', 16)
aLegend = mapLayout.addLegend(650, 100)
aLegend.setLegendStyle(LegendStyles.Bar_Vertical)
aLegend.setLegendLayer(dataLayer)
layoutMap.setGridXDelt(60)
layoutMap.setGridYDelt(30)
layoutMap.setDrawGridLine(False)
mapLayout.paintGraphics()

frame = JFrame('MeteoInfo Script Sample', size = (750, 530))
frame.add(mapLayout)
frame.visible = True
print 'Finished!'