[pyngl-talk] mask ocean

Karin Meier-Fleischer meier-fleischer at dkrz.de
Tue Apr 17 03:37:47 MDT 2018


Hi Xiaoni,

what do you mean with 'there are no figures saved'? If the plot PNG file 
won't be created try adding Ngl.end() at the end of your script.

Or no contour lines are drawn? Are the minimum and maximum contour 
values set with cnres.cnMinLevelValF and cnres.cnMaxLevelValF in the 
data range?

By the way, there are some strange characters in your script.

Bye,
Karin

Am 17.04.18 um 11:25 schrieb Xiaoni Wang via pyngl-talk:
> 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)
>
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk



More information about the pyngl-talk mailing list