thanks once more for your infos. (Comment aside, maybe it would be good to have a subforum about MeteoInfo things if MeteoInfo is used more frequently with hysplit)?
1. jd-gui is great, thanks for the hint.
2. Yes, I have seen your chinese blog, but there is more IronPython than Jython examples which did rather confuse me .
3. But where is this miapp to be fount in the MetoInfo class/function tree? For example, "miapp.getMapDocument().getMapLayout().getTexts()[0]" is not working for me, it says AttributeError: 'org.meteoinfo.layout.MapLayout' object has no attribute 'getTexts', so I guess I have not loaded all what I would have needed, but I can't find this getMapDocument() in the class-tree.
4. So far I have
Code: Select all
mdi = MeteoDataInfo()
mdm = MapDataManage()
mf = miapp.getMapDocument().getActiveMapFrame()
backFile = 'country1.shp'
backn1 = os.path.join(mapDir, backFile)
backlayer = mdm.loadLayer(backn1)
mf.addLayer(backlayer)
5. It' not my favorite solution, but that would of course work. However, for the moment it doesn't work for the legend: If I save a project file with 3 legend entries and I reopen the project again, there is still 3 legend entries, but 3 times the same and not those that I had chosen!
6. I'm still haveing troubles with the loop over figures since I do have another loop inside my time-loop. So I think I'd need somehow an array of trajectory layers or a something like "remove all layers".
Code: Select all
for day in days:
# Add the layers into the MeteoInfo application (miapp)
mf = miapp.getMapDocument().getActiveMapFrame()
for point in points:
# Open trajectory data file
trajFile = 'CFSR_'+point+'_'+day
trajfn1 = os.path.join(workingDir, trajFile)
print 'Trajectory file: ' + trajfn1
mdi.openHYSPLITTrajData(trajfn1)
# Create trajectory layer
trajLayer1 = mdi.getDataInfo().createTrajLineLayer()
trajLayer1.setLayerName('CFSR')
# Load a legend scheme from the previous saved legend file
aLS = LegendScheme(ShapeTypes.Polyline)
legendfn = os.path.join(legendDir, 'blue.lgs')
aLS.importFromXMLFile(legendfn)
trajLayer1.setLegendScheme(aLS)
mf.addLayer(trajLayer1)
figfile='Traj_figure_day'+day+'.png'
if os.path.isfile(figfile):
os.remove(figfile)
figurefn = os.path.join(outDir,figfile)
miapp.getMapDocument().getMapLayout().exportToPicture(figurefn)
mf.removeLayer(trajLayer1)#this removes now only the layer for my last point, but not for the others!
Martina