[pyngl-talk] Problems with plotting in Jupyter notebook cells

Karin Meier-Fleischer meier-fleischer at dkrz.de
Wed Jul 10 15:31:03 MDT 2019


Hi Danielle,

maybe you have to delete the workstation to close the PDF file (see also 
http://www.pyngl.ucar.edu/Functions/Ngl.delete_wks.shtml)

...
Ngl.delete_wks(wks)
Ngl.end()

-Karin


Am 09.07.19 um 22:44 schrieb Danielle Touma:
> Hi Karin,
>
> I am a new user of PyNGL (though a long-time user of NCL), and I 
> really appreciate how straightforward you have made the transition! 
> Well done.
>
> This may not be helpful to solve Mark's problem, but I would like to 
> add that I have a similar issue with using Ngl.end() in the python 
> command line. If I don't run Ngl.end() then my pdf does not complete 
> the plotting (even though I run Ngl.frame(wks) ) and I am unable to 
> open the pdf. If I do run Ngl.end(), the plotting works and I am able 
> to open the pdf. However, I have to exit python and reopen it so that 
> I can open a new workstation. It seems that the Ngl.end() command 
> causes a disconnect from the plotting/graphics for the session.
>
> It might be something to do with the computing environment we are 
> working on, since I tend to have some issues with Casper (UCAR) and 
> graphics (XQuartz) in general.
>
> Does this help you understand the issue more? If so, do you have any 
> ideas how to overcome this?
>
> Best,
> Danielle
>
>
>
>
> On Tue, Jul 9, 2019 at 11:56 AM Karin Meier-Fleischer via pyngl-talk 
> <pyngl-talk at ucar.edu <mailto:pyngl-talk at ucar.edu>> wrote:
>
>     I'm not able to reproduce the error, I was able to rerun it
>     without restarting the kernel. Maybe it would be a good idea to
>     delete those lines which are not needed like import of modules you
>     are not using. Start with a short clean script and use more code
>     cells. If you want to display the plot inline you can produce a
>     PNG file, see attached notebook.
>
>     -Karin
>
>     Am 09.07.19 um 19:18 schrieb Mark England:
>>     Hi Karin,
>>
>>     Attached. It is very simple and doesn’t need any data (just map
>>     plotting).
>>     If you run it once, it should work, however if you rerun the
>>     plotting cell (perhaps try to change the latitude or something)
>>     it will give you that error.
>>
>>     Mark
>>
>>
>>>     On 9 Jul 2019, at 10:02, Karin Meier-Fleischer
>>>     <meier-fleischer at dkrz.de <mailto:meier-fleischer at dkrz.de>> wrote:
>>>
>>>     Hi Mark,
>>>
>>>     sometimes I have similar problems using notebook and PyNGL
>>>     running with the same preconditions and have to restart the
>>>     kernel. I don’t know if it is caused by PyNGL because I get
>>>     other error messages. Is it possible to send the .ipynb file
>>>     with test data to try to reproduce your errors?
>>>
>>>     -Karin
>>>
>>>>     Am 09.07.2019 um 18:52 schrieb Mark England via pyngl-talk
>>>>     <pyngl-talk at ucar.edu <mailto:pyngl-talk at ucar.edu>>:
>>>>
>>>>     Hi there,
>>>>
>>>>     I am trying to transition to using PyNGL (using Jupiter
>>>>     Notebook, Python v3.7.3) on my Mac (Mojave 10.14.5).
>>>>     I am just trying to create simple plots (code below, mostly
>>>>     taken from the examples online. When I run the script first, it
>>>>     works fine and the pdf is created exactly as advertised. All
>>>>     the relevant modules are loaded.
>>>>     However if I re-run the plotting section of code in the
>>>>     Notebook, I get this error:
>>>>
>>>>     fatal:["Error.c":406]:ErrorInitialize:Only one instance of
>>>>     ErrorClass is supported
>>>>     fatal:Unable to initialize layer-Can't Create
>>>>     fatal:Error Creating ErrorClass object
>>>>     fatal:Unable to initialize layer-Can't Create
>>>>     fatal:Unable to initialize layer-Can't Create
>>>>     fatal:_NhlCreate:Unable to access "default" App object
>>>>     fatal:_NhlCreate:Invalid Parent id #-4
>>>>     fatal:NhlGetValues:PID #-4 is invalid
>>>>     fatal:PID #-4 can't be found in NhlSetValues
>>>>     warning:maximize_plots: Invalid workstation. No plot
>>>>     maximization can take place.
>>>>     fatal:NhlDraw: Invalid Layer Id: -4
>>>>     fatal:Unable to update Workstation with PID#-4
>>>>     fatal:Unable to clear Workstation with PID#-4
>>>>     fatal:NhlDraw: Invalid Layer Id: -4
>>>>     fatal:Unable to update Workstation with PID#-4
>>>>     fatal:Unable to clear Workstation with PID#-4
>>>>     fatal:Unable to Destroy (Bad PID#0)
>>>>
>>>>     I can only get the figure again, if, in the Kernel menu, I
>>>>     ‘restart and run all’. It seems to be a problem with the
>>>>     graphics? I have xQuartz installed. From a similar topic I
>>>>     found online, they removed Ngl.end() at the end, however that
>>>>     doesn’t work for me.
>>>>
>>>>     Thanks,
>>>>
>>>>     Mark
>>>>     _______________________________________________
>>>>     pyngl-talk mailing list
>>>>     List instructions, subscriber options, unsubscribe:
>>>>     http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>>
>>>
>>
>>     Mark England, PhD.
>>     Columbia University,
>>     /Bakhmeteff Research Fellow in Fluid Mechanics, /
>>     Email: mre2126 at columbia.edu <mailto:mre2126 at columba.edu>,
>>     markengland20 at gmail.com <mailto:markengland20 at gmail.com>
>>     Website: markrossengland.com <http://markrossengland.com>
>>
>
>     -- 
>     Dipl. Geophys. Karin Meier-Fleischer
>     Visualization, NCL, CDO, PyNGL
>     Application Support
>
>     Deutsches Klimarechenzentrum GmbH (DKRZ)
>     Bundesstrasse 45a - D20146 Hamburg - Germany
>
>     Phone:    +49 (0)40 460094 126
>     Fax:      +49 (0)40 460094 270
>     E-Mail:meier-fleischer at dkrz.de  <mailto:meier-fleischer at dkrz.de>
>     URL:www.dkrz.de  <http://www.dkrz.de>
>
>     Geschäftsführer: Prof. Dr. Thomas Ludwig
>     Sitz der Gesellschaft: Hamburg
>     Amtsgericht Hamburg HRB 39784
>
>     _______________________________________________
>     pyngl-talk mailing list
>     List instructions, subscriber options, unsubscribe:
>     http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>
>
>
> -- 
> *Danielle Touma*
> Postdoctoral Scholar
> Bren School of Environmental Science & Management
> University of California, Santa Barbara
> touma at ucsb.edu <mailto:touma at ucsb.edu>
> (919) 449-6377

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20190710/93bd7159/attachment-0001.html>


More information about the pyngl-talk mailing list