[pyngl-talk] Shading over a given value

Jérôme Servonnat jerome.servonnat at lsce.ipsl.fr
Thu Jan 21 11:09:15 MST 2021


Dear pyngl-talk members,

I have a simple need that I can’t manage to do by myself: on a map, I want to hatch values greater than 0.9 with pattern number 3 (diagonal black lines).

My data is a mask field, with 0 and 1 values.

Here is the portion of my code associated with it:
------
    f    = Nio.open_file(mask_file)
    dat  = f.variables["mask"][:,:]
    lat  = f.variables["lat"][:]
    lon  = f.variables["lon"][:]

    cnres                 = Ngl.Resources()
    cnres.nglDraw  = False
    cnres.nglFrame = False
    cnres.nglMaximize = False

    # Contour resources
    cnres.cnFillOn        = True
        
    cnres.cnMonoFillPattern = False
———
What should I give to those resources to get hatching only for values above 0.9 (i.e. where the mask == 1)? How would you do that?
—— 
    cnres.cnFillPatterns = ?
    cnres.cnFillColors      = ?
    cnres.cnMinLevelValF = ?
    cnres.cnMaxLevelValF = ?

    Ngl.contour_map(wks,dat,cnres)
------

I’ve been struggling for a little bit too long now :), and I would be very happy to get some help. 

All the best,

J.


Jérôme Servonnat
IPSL Coupled Model evaluation - Climate Impacts 
LSCE – IPSL, MERMAID team
Orme des Merisiers, Bat 714, P1137
91191 Gif sur Yvette Cedex – France
Phone : 00 33 1 69 08 77 30

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20210121/d63c2e86/attachment.html>


More information about the pyngl-talk mailing list