Re: 1 pixel artifact when map masking contour plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Sep 27 2010 - 08:53:43 MDT

Hi Daryl,

There definitely seems to be an issue here. I tried all kinds of things, like changing the draw order of various elements, and changing what kind areas are getting drawn or masked, and I still see the artifact.

I did get rid of part of the straight line artifact by adding the following to your code:

pixel.py:resources.mpPerimOn = True
pixel.py:resources.mpPerimLineColor = 0
pixel.py:resources.mpPerimLineThicknessF = 5.0

This causes a white border to be drawn around your map, hiding the line.

I also tried this:

resources.mpFillOn = True
resources.mpFillAreaSpecifiers = ["water","caribbean islands","mexico","canada","nova scotia","newfoundland","new brunswick"]
resources.mpFillBoundarySets = "NoBoundaries"
resources.mpSpecifiedFillColors = [0,0,0,0,0,0,0]

in an attempt to explicitly fill those areas that are still appearing as a faint outline. I think "New Brunswick" is part of the problem, as I still see the faint outline of this.

Are you seeing this?

--Mary

On Sep 23, 2010, at 4:23 PM, daryl herzmann wrote:

> Hi PyNGLers!
>
> Attached you'll find an image that has a 1 pixel wide artifact at the north and south end of grid that I attempt to mask by the map. This situation seems to happen when the viewport shape does not match the map shape (pardon the loose/incorrect terminology).
>
> I've included below a reproducer for me based on the ngl05p example. I know it looks ugly, just wanted something to demonstrate the problem :)
>
> Am I doing something wrong, or is this a bug? I am using PyNGL 1.3.1 on Linux x86_64, python 2.5, redhat 5.5
>
> thanks!
> daryl
>
>
> import numpy, os
> import Nio
>
> #
> import Ngl
> #
> #
> data_dir = Ngl.pynglpath("data")
> cdf_file1 = Nio.open_file(os.path.join(data_dir,"cdf","941110_P.cdf"),"r")
> cdf_file2 = Nio.open_file(os.path.join(data_dir,"cdf","sstdata_netcdf.nc"),"r")
> cdf_file3 = Nio.open_file(os.path.join(data_dir,"cdf","Pstorm.cdf"),"r")
>
> psl = cdf_file1.variables["Psl"]
>
> psl_lon = cdf_file1.variables["lon"][:]
> psl_lat = cdf_file1.variables["lat"][:]
> psl_nlon = len(psl_lon)
> psl_nlat = len(psl_lat)
>
>
> wks_type = "png"
> wks = Ngl.open_wks(wks_type,"ngl05p")
>
>
> resources = Ngl.Resources()
>
> resources.cnFillOn = True
>
> resources.nglMaximize = False
> resources.vpWidthF = 0.8
> resources.vpHeightF = 0.8
> resources.nglPaperOrientation = "landscape"
> resources.vpXF = 0.1
> resources.vpYF = 0.9
>
> resources.mpProjection = "LambertConformal"
> resources.mpLambertParallel1F = 33.0
> resources.mpLambertParallel2F = 45.0
> resources.mpLambertMeridianF = -95.0
> resources.mpLimitMode = "LatLon"
> resources.mpMinLatF = 22.0
> resources.mpMaxLatF = 52.0
> resources.mpMinLonF = -119.0
> resources.mpMaxLonF = -74.0
> resources.pmTickMarkDisplayMode = "Never"
> resources.mpPerimOn = False
> resources.mpDataBaseVersion = "MediumRes"
> resources.mpDataSetName = "Earth..2"
> resources.mpGridAndLimbOn = False
> resources.mpUSStateLineThicknessF = 1
> resources.mpOutlineOn = True
> resources.mpOutlineBoundarySets = "USStates"
> resources.mpFillOn = True
> resources.mpFillAreaSpecifiers = ["land","water"]
> resources.mpFillBoundarySets = "NoBoundaries"
> resources.mpSpecifiedFillColors = [0,0]
> resources.mpAreaMaskingOn = True
> resources.mpMaskAreaSpecifiers = ["Conterminous US",]
> resources.cnFillDrawOrder = "Predraw"
>
>
> resources.sfXCStartV = float(min(psl_lon))
> resources.sfXCEndV = float(max(psl_lon))
> resources.sfYCStartV = float(min(psl_lat))
> resources.sfYCEndV = float(max(psl_lat))
>
> map = Ngl.contour_map(wks,psl,resources)
>
> del map
> del resources
>
> Ngl.end()<pyngl_example.png>_______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Mon Sep 27 08:53:52 2010

This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 09:57:00 MDT