[pyngl-talk] Updates for using Pyngl

Xiaoni Wang xiaoni.wang at obspm.fr
Tue Oct 25 04:38:04 MDT 2016


Hi Mary
    Thank you very much for all your useful information ! Now my plots work well. Just I have a few more questions to clarify some confusion.

1) In my data, I do not have any data over the ocean. I noticed that there is strong interpolation over ocean in the figure (see any figure attached), which are not necessary. It seems that I could use resources.mpGridMaskMode = "MaskOcean » , but it seems not working.
   PS: I prefer that ocean would be white color for example. What shall I do ?

2) Over small islands, the interpolation method also produced some effects (see large yellow areas on the ocean in figure isccp_19V.00001.png). Again I do not need the ocean around the island, just the results over (small) islands.

3) I would like to increase the figure size of figure. I tried :
resources.vpXF      = 0.1    # Change the size and location of the
    resources.vpYF      = 0.9    # plot on the viewport.
    resources.vpWidthF  = 0.4
    resources.vpHeightF = 0.8

But when I open the figure, it remains the same size, seems to me.

4) I would like to put the larger values in color red, and small values in blue for example. (Now it is the inverse). How to modify it ?

5) Yes, indeed I have several figures to plot. I found that they are named as isccp.000001.png for example. Could I name it as isccp.model.png ?
    In my code, I will loop over several files (current figures from only do 1-time iteration). Do I have to clear something after each iteration is finished ? Actually it does not work for more than 1 iteration (message Invalid workstation).

    I attach the code and also a few figures to you. Thank you in advance for your help !

Best wishes,

Xiaoni



Le 24 oct. 2016 à 19:31, Mary Haley <haley at ucar.edu> a écrit :

> Xiaoni,
> 
> I think the issue is that you are using "resources" to set wsMaximizeSize, and then you also pass this list into the contour_map call. You don't want to do this, so I suggest using a different resource list to set wsMaximizeSize:
> 
> wresources = Ngl.Resources() 
> wresources.wsMaximumSize = 33554432 
> Ngl.set_values(ws_id,wresources)
> 
> Since you have a large grid, I recommend setting res.cnFillMode = "RasterFill" if you haven't already. This may fix the warning as well.
> 
> You can then use "resources" for setting your contour plot options.
> 
> Also, I don't think you need to do all that stuff with calling get_float to retrieve a bunch of values and creating the contours twice.
> 
> See the modified version of your script attached.  It looks like you just sent me a partial script, so what I've modified is just an example of how you can change your original script.
> 
> --Mary
> 
> 
> 
> 
> On Mon, Oct 24, 2016 at 9:52 AM, Xiaoni Wang <xiaoni.wang at obspm.fr> wrote:
> Dear Sir or Madam,
>       Sorry to write to you several emails !  I would like to update the news and questions since I have wrote to you.  I solved the installation problem of Pyngl and Pynio. I can import them without problem.
> 
>      Now I tried to run a python code to plot data on ISCCP grids. As I mentioned to you in my previous email, I have data such as:
>       ISCCP latitude : lat_isccp, 1D, (256915,) 
>       ISCCP longitude: lon_isccp, (1D, (256915,)) 
>       data: emis, (1D , (256915,))  
>       I also have the horizontal width for each grid (in km).
> 
>      I would like to make 2D plot on ISCCP grids. When I launched my program, it has fatal errors:
>         fatal:ContourPlotDraw: Workspace reallocation would exceed maximum size 100000000
>     
>      After reading the FAQ, I added the following lines in my codes:
> 	ws_id = Ngl.get_workspace_id()
>         resources = Ngl.Resources() 
>         resources.wsMaximumSize = 33554432 
>         Ngl.set_values(ws_id,resources)
> 
>     But then I got another error: 
>        fatal:["Error.c":406]:ErrorInitialize:Only one instance of ErrorClass is supported.
> 
> 
>     I do not understand….. I will look again at your tutorial to get more information. The attached is the code that I used. Thank you in advance if you could give some clue.
> 
> Best regards
> 
> Xiaoni
> 
> 
> 
> 
>     
> 
> 
> 
> <test_mod.py>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20161025/55acce96/attachment-0003.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: figure.zip
Type: application/zip
Size: 1719721 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20161025/55acce96/attachment-0001.zip 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20161025/55acce96/attachment-0004.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stat1monthF1_2D_TaF_pyngl.py
Type: text/x-python-script
Size: 4726 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20161025/55acce96/attachment-0001.bin 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20161025/55acce96/attachment-0005.html 


More information about the pyngl-talk mailing list