Re: Kernel density

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 29 Jul 2008 11:20:56 -0600 (MDT)

Hi Yuval,

It sounds like you basically want contours over a map, with polymarkers
overlaid?

We don't have a specific example of this, but we have something close.

I've included a full script below that uses dummy data. Let me know
if this is not what you're talking about:

import numpy, Ngl

minlat = 0
maxlat = 90
minlon = -15
maxlon = 180

# Generate some dummy data.
z = Ngl.generate_2d_array ([70,70],15,15,-10.,110.)
mlat = numpy.random.uniform(minlat,maxlat,size=40)
mlon = numpy.random.uniform(minlon,maxlon,size=40)

wks = Ngl.open_wks("x11","Turkey")

res = Ngl.Resources() # Set up plot options

res.mpLimitMode = "LatLon" # Limit the map area by latitude/longitude
res.mpMinLonF = minlon
res.mpMaxLonF = maxlon
res.mpMinLatF = minlat
res.mpMaxLatF = maxlat

res.mpOutlineBoundarySets = "AllBoundaries" # Default is coastal only
res.mpGridAndLimbOn = False # Turn off map grid lines.

res.sfXCStartV = minlon # Area of map in which to overlay contours.
res.sfXCEndV = maxlon
res.sfYCStartV = minlat
res.sfYCEndV = maxlat

res.cnFillOn = True # Turn on contour fill
res.cnLineLabelsOn = False # Turn off contour line labels
res.cnLinesOn = False # Turn off contour lines

res.lbOrientation = "Horizontal" # Default is vertical

res.nglFrame = False # Don't advance frame yet.

plot = Ngl.contour_map(wks,z[:,:],res)

pres = Ngl.Resources() # Set up marker resources
pres.gsMarkerIndex = 16 # Filled dot
id = Ngl.polymarker(wks,plot,mlon,mlat,pres)

Ngl.frame(wks) # Now advance frame
Ngl.end()

--Mary

On Tue, 29 Jul 2008, Yuval Itan wrote:

>
> Hello,
>
> I have a collection of points in Eurasia (just coordinates with no values), and I would like to plot it on the Eurasia map as a kernel density representation, as shown in the following link, but on a map space: http://www.scipy.org/SciPyPackages/Stats
> Is there any way to do something like that using PyNgl?
>
> Thanks,
>
> Yuval
>
> _________________________________________________________________
> News, entertainment and everything you care about at Live.com. Get it now!
> http://www.live.com/getstarted.aspx
_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Tue Jul 29 2008 - 11:20:56 MDT

This archive was generated by hypermail 2.2.0 : Tue Jul 29 2008 - 14:14:18 MDT