Ngl.open_wks
Opens a workstation on which to draw graphics.
Prototype
wks = Ngl.open_wks(type, name, res=None)
Arguments
typeThe type of workstation to open.
nameThe name of the workstation.
res=NoneAn (optional) instance of the Resources class having Workstation resources as attributes.
Return value
wksA PlotId representing the workstation created.
Description
This function creates a workstation for drawing graphics, given a workstation type and name.
A workstation type can be an NCGM file ("ncgm"), a PostScript file ("ps", "eps", or "epsi"), a PDF file ("pdf"), or an X11 window ("x11"). The name will be used for the ouput file (if applicable) and with the appropriate extension appended.
In addition, if a resource file name.res exists, it will be loaded. name can have a directory path as part of its string if the resource file you want to load is in a separate directory from where the NCL script resides.
The default color map associated with a workstation is "rainbow". If you want to change this, you can set an attribute of type called wkColorMap to one of the other predefined color maps, or you can create your own.
By default, since nglMaximize is True, the orientation of the plots for PS/PDF output will be whatever orientation best fits the output paper size. If you want to force either portrait or landscape mode, do the following:
wks_res = Ngl.Resources() wks_res.wkOrientation = "landscape" wks = Ngl.open_wks("ps","example",wks_res)
You can have up to fifteen PostScript workstations open at one time, but you can only have one NCGM or PDF workstation open at one time.
See Also
Ngl.frame, Ngl.clear_workstation, Ngl.change_workstation, Ngl.update_workstation, Ngl.draw_colormap, Ngl.retrieve_colormap
special resource: nglAppResFileName
Examples
For examples on how to use Ngl.open_wks, see most any of the PyNGL examples, like ngl01p.py.