Problem with resource files with PyNGL/PyNio

908 Views Asked by At

I am trying to translate code from NCL to PyNGL/PyNio. As I have read on the transition guide, the handling of resource files for the plotting routines should work the same way as in NCL. However, in my scripts, python does not include any resources from the resource files, even if I follow the basic examples from the transition guide. Could this be due to the fact that I work in an conda environment? Or is there a bug in PyNGL?

I am using Python 3.7 in a Conda environment. I have tried it with my own code as well as with a very simple example code which I include below.

#THIS IS THE CODE IN THE MAIN FILE: 
import Ngl

wks = Ngl.open_wks("png","title_app")

plot = Ngl.text_ndc(wks,"Hello, World",0.5,0.5)

Ngl.frame(wks)
Ngl.end()

#THIS IS TE CODE IN THE FILE IN THE SAME FOLDER NAMED title_app.res

*txFontColor   : red
*txFont        : helvetica-bold
*txFontHeightF : 0.06

The text appearing in the file title_app.png does neither appear red nor bold.

1

There are 1 best solutions below

0
On

You have to install the packages first. Creating a new conda environment is recommended. Have you tried conda create --name pyn_env --channel conda-forge pyngl followed by conda activate pyn_env? check their own documentation on this matter.