How to use the wradlib.georef.projection.reproject function in wradlib

To help you get started, we’ve selected a few wradlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wradlib / wradlib / wradlib / georef / polar.py View on Github external
Here, the coordinates of the east and west directions won't come to lie on
    the latitude of the site because the beam doesn't travel along the latitude
    circle but along a great circle.

    See :ref:`/notebooks/basics/wradlib_workflow.ipynb#\
Georeferencing-and-Projection`.
    """
    if proj is None:
        proj = projection.get_default_projection()

    xyz, rad = spherical_to_xyz(r, phi, theta, sitecoords, re=re, ke=ke,
                                squeeze=True)

    # reproject aeqd to destination projection
    coords = projection.reproject(xyz, projection_source=rad,
                                  projection_target=proj)

    return coords
github wradlib / wradlib / wradlib / georef / polar.py View on Github external
"""
    # prepare the range and azimuth array so they describe the boundaries of
    # a bin, not the centroid
    r, phi = _check_polar_coords(r, phi)
    r = np.insert(r, 0, r[0] - _get_range_resolution(r))
    phi = phi - 0.5 * _get_azimuth_resolution(phi)
    phi = np.append(phi, phi[0])
    phi = np.where(phi < 0, phi + 360., phi)

    # generate a grid of polar coordinates of bin corners
    r, phi = np.meshgrid(r, phi)

    coords, rad = spherical_to_xyz(r, phi, theta, sitecoords, squeeze=True,
                                   strict_dims=True)
    if proj is not None:
        coords = projection.reproject(coords, projection_source=rad,
                                      projection_target=proj)

    llc = coords[:-1, :-1]
    ulc = coords[:-1, 1:]
    urc = coords[1:, 1:]
    lrc = coords[1:, :-1]

    vertices = np.stack((llc, ulc, urc, lrc, llc), axis=-2).reshape((-1, 5, 3))

    if proj is None:
        return vertices, rad
    else:
        return vertices
github wradlib / wradlib / wradlib / georef / polar.py View on Github external
"""
    # make sure the range and azimuth angles have the right properties
    r, phi = _check_polar_coords(r, phi)

    r = r - 0.5 * _get_range_resolution(r)

    # generate a polar grid and convert to lat/lon
    r, phi = np.meshgrid(r, phi)

    coords, rad = spherical_to_xyz(r, phi, theta, sitecoords, squeeze=True)

    if proj is None:
        return coords, rad
    else:
        return projection.reproject(coords, projection_source=rad,
                                    projection_target=proj)
github wradlib / wradlib / wradlib / georef / rect.py View on Github external
sinlat0 = np.sin(np.radians(lat0))

            fac = (6370.040 ** 2.) * ((1. + sinlat0) ** 2.)
            lon = np.degrees(np.arctan((-x / y))) + lon0
            lat = np.degrees(np.arcsin((fac - (x ** 2. + y ** 2.)) /
                                       (fac + (x ** 2. + y ** 2.))))
            radolan_grid = np.dstack((lon, lat))
        else:
            # create radolan projection osr object
            proj_stereo = projection.create_osr("dwd-radolan")

            # create wgs84 projection osr object
            proj_wgs = projection.get_default_projection()

            radolan_grid = projection.reproject(radolan_grid,
                                                projection_source=proj_stereo,
                                                projection_target=proj_wgs)

    return radolan_grid