If you want to update the tutorial, here is how it is working:
Extract bin values from a polar radar data set at rain gage locations
Suppose you already have the following radar data:
nbins: number of bins in each azimuthal angle;
range_resolution (a.k.a.: range step): distance in radius between bins (in meters);
radar_Lon, radar_Lat: radar site longitude and latitude;
azi: azimuth angles in a scan (degrees);
The azimuth angles are a numpy.ndarray object cointaining the angles in the order the file provides them; like the way it results from this tutorial.
The projection used in this case is WGS84.
This projection allows to input the point location straight as decimal degrees. Although it might not be the more appropriate.
projec = wradlib.georef.epsg_to_osr(4326)
If needed, point location can be inserted at a different projection through this process:
- Use the following pyproj library function to create the desired “transformer” (in this case a PROJ string is used to create WGS84, check this doc, there are many ways to do it):
import pyproj
from pyproj import Proj
transf = Proj("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
- Insert longitude and latitude of desired point in decimal °, save values in variables:
point_Lon, point_Lat = transf(-1.23456789, 9.87654321)
These values must enter as numpy.ndarrays:
point_Lon = numpy.array([point_Lon])
point_Lat = numpy.array([point_Lat])
Now we can enter all this and get our results:
polarNeighs = wradlib.verify.PolarNeighbours(r=numpy.arange(1,nbins+1)*range_resolution,
az=azi,
sitecoords=[radar_Lon, radar_Lat],
proj=projec,
x=point_Lon, y=point_Lat,
nnear=9)
From now on the tutorial (at step 6) can be continued normally.
Steps 1 and 2 are the whole point of my question, that escalated quickly!