[pyngl-talk] mask ocean

Xiaoni Wang xiaoni.wang at obspm.fr
Tue Apr 17 03:25:54 MDT 2018


Hi Dear all,
     I tried to mask ocean with the color gray in my figure. The code works, but there are no figures saved finally. I do not know why. Thanks in advance if you have any idea !

Best ragards,

Xiaoni

--------------------------------------------------------------------------------------------

     wks_type = "png"
     wks = Ngl.open_wks(wks_type,output_dir + "swv")

     cnres                 = Ngl.Resources()

       cnres.sfXArray        = xx
       cnres.sfYArray        = yy

       
       cmap = Ngl.read_colormap_file("BlAqGrYeOrReVi200")[::-1,:]
        cnres.nglSpreadColorStart = 176
        cnres.nglSpreadColorEnd   = 2
        cnres.mpFillOn               = True
        cnres.cnFillMode          = "RasterFill"
        cnres.mpDataBaseVersion   = « MediumRes"

        cnres.mpFillDrawOrder        = "PostDraw"
        cnres.mpOceanFillColor        = "Gray"
        cnres.mpLandFillColor       = "Transparent"
        cnres.mpInlandWaterFillColor = "Transparent"
        cnres.mpGridMaskMode         = "MaskOcean"

        
        cnres.cnFillPalette       = cmap
        cnres.cnLinesOn           = False
        cnres.cnLineLabelsOn      = False
        cnres.lbBoxLinesOn        = False
        cnres.lbLabelFontHeightF  = 0.015

        cnres.cnLevelSelectionMode = "ManualLevels"
        cnres.cnMinLevelValF       = -0.05
        cnres.cnMaxLevelValF       = 0.05
        cnres.cnLevelSpacingF      = 0.01

        cnres.tiMainString           = ‘aaa'
        contour = Ngl.contour_map(wks,data,cnres)



More information about the pyngl-talk mailing list