24.12.2013 Views

wradlib Documentation - Bitbucket

wradlib Documentation - Bitbucket

wradlib Documentation - Bitbucket

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>wradlib</strong> <strong>Documentation</strong>, Release 0.1.1<br />

3.5.4 <strong>wradlib</strong>.georef.polar2polyvert<br />

<strong>wradlib</strong>.georef.polar2polyvert(r, az, sitecoords)<br />

Generate 2-D polygon vertices directly from polar coordinates.<br />

This is an alternative to centroid2polyvert which does not use centroids, but generates the polygon vertices by<br />

simply connecting the corners of the radar bins.<br />

Both azimuth and range arrays are assumed to be equidistant and to contain only unique values. For further<br />

information refer to the documentation of polar2latlon.<br />

Parameters r : array<br />

array of ranges [m]; r defines the exterior boundaries of the range bins! (not the centroids).<br />

Thus, values must be positive!<br />

az : array<br />

array of azimuth angles containing values between 0° and 360°. The angles are assumed<br />

to describe the pointing direction fo the main beam lobe! The first angle can start at<br />

any values, but make sure the array is sorted continuously positively clockwise and the<br />

angles are equidistant. An angle if 0 degree is pointing north.<br />

sitecoords : a sequence of two floats<br />

the lat / lon coordinates of the radar location<br />

Returns output : a 3-d array of polygon vertices in lon/lat<br />

with shape(num_vertices, num_vertex_nodes, 2). The last dimension carries the longitudes<br />

on the first position, the latitudes on the second (lon: output[:,:,0], lat: output[:,:,1]<br />

Examples<br />

>>> import numpy as pl<br />

>>> import pylab as pl<br />

>>> import matplotlib as mpl<br />

>>> # define the polar coordinates and the site coordinates in lat/lon<br />

>>> r = np.array([50., 100., 150., 200.])<br />

>>> az = np.array([0., 45., 90., 135., 180., 225., 270., 315., 360.])<br />

>>> sitecoords = (48.0, 9.0)<br />

>>> polygons = polar2polyvert(r, az, sitecoords)<br />

>>> # plot the resulting mesh<br />

>>> fig = pl.figure()<br />

>>> ax = fig.add_subplot(111)<br />

>>> polycoll = mpl.collections.PolyCollection(vertices,closed=True, facecolors=None)<br />

>>> ax.add_collection(polycoll, autolim=True)<br />

>>> pl.axis(’tight’)<br />

>>> pl.show()<br />

3.5.5 <strong>wradlib</strong>.georef.centroid2polyvert<br />

<strong>wradlib</strong>.georef.centroid2polyvert(centroid, delta)<br />

Calculates the 2-D Polygon vertices necessary to form a rectangular polygon around the centroid’s coordinates.<br />

The vertices order will be clockwise, as this is the convention used by ESRI’s shapefile format for a polygon.<br />

Parameters centroid : array_like<br />

44 Chapter 3. Library Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!