Exemplo n.º 1
0
 def setUp(self):
     self.site = (7.0, 53.0, 100.)
     self.proj = georef.epsg_to_osr(31467)
     self.az = np.arange(0., 360., 1.)
     self.r = np.arange(0, 100000, 1000)
     self.el = 2.5
     self.coords = vpr.volcoords_from_polar(self.site, self.el, self.az, self.r, self.proj)
Exemplo n.º 2
0
 def test_volcoords_from_polar(self):
     coords = vpr.volcoords_from_polar(
         self.site,
         self.el,
         self.az,
         self.r,  # noqa
         self.proj)
     pass
Exemplo n.º 3
0
    def test_synthetic_polar_volume(self):
        nbins = [320, 240, 340, 300]
        rscale = [1000, 1000, 500, 500]
        elev = [0.3, 0.4, 3., 4.5]

        xyz = np.array([]).reshape((-1, 3))
        for i, vals in enumerate(zip(nbins, rscale, elev)):
            az = np.arange(0., 360., 2.)
            r = np.arange(0, vals[0] * vals[1], vals[1])
            xyz_ = vpr.volcoords_from_polar(self.site, vals[2],
                                            az, r, self.proj)
            xyz = np.vstack((xyz, xyz_))

        vol = vpr.synthetic_polar_volume(xyz)
        self.assertEqual(vol.shape, (216000,))
Exemplo n.º 4
0
 def setUp(self):
     # polar grid settings
     self.site = (7.0, 53.0, 100.)
     self.proj = georef.epsg_to_osr(31467)
     self.az = np.arange(0., 360., 2.) + 1.
     self.r = np.arange(0., 50000., 1000.)
     self.elev = np.array([1., 3., 5., 10.])
     # cartesian grid settings
     self.maxrange = 50000.
     self.minelev = 1.
     self.maxelev = 10.
     self.maxalt = 8000.
     self.horiz_res = 4000.
     self.vert_res = 1000.
     self.xyz = vpr.volcoords_from_polar(self.site, self.elev,
                                         self.az, self.r, self.proj)
     self.data = vpr.synthetic_polar_volume(self.xyz)
     self.trgxyz, self.trgshape = vpr.make_3d_grid(self.site, self.proj,
                                                   self.maxrange,
                                                   self.maxalt,
                                                   self.horiz_res,
                                                   self.vert_res)
Exemplo n.º 5
0
 def test_volcoords_from_polar(self):
     coords = vpr.volcoords_from_polar(self.site, self.el, self.az, self.r,
                                       self.proj)
     self.assertEqual(coords.shape, (9000, 3))
Exemplo n.º 6
0
class TestCartesianVolume:
    # polar grid settings
    site = (7.0, 53.0, 100.0)
    proj = georef.epsg_to_osr(31467)
    az = np.arange(0.0, 360.0, 2.0) + 1.0
    r = np.arange(0.0, 50000.0, 1000.0)
    elev = np.array([1.0, 3.0, 5.0, 10.0])
    # cartesian grid settings
    maxrange = 50000.0
    minelev = 1.0
    maxelev = 10.0
    maxalt = 8000.0
    horiz_res = 4000.0
    vert_res = 1000.0
    xyz = vpr.volcoords_from_polar(site, elev, az, r, proj)
    data = vpr.synthetic_polar_volume(xyz)
    trgxyz, trgshape = vpr.make_3d_grid(
        site,
        proj,
        maxrange,
        maxalt,
        horiz_res,
        vert_res,
    )

    def test_CartesianVolume(self):
        gridder = vpr.CartesianVolume(
            self.xyz,
            self.trgxyz,
            self.trgshape,
            self.maxrange,
            self.minelev,
            self.maxelev,
        )
        out = gridder(self.data)
        assert out.shape == (6084, )
        assert len(np.where(np.isnan(out))[0]) == 0

    def test_CAPPI(self):
        gridder = vpr.CAPPI(
            self.xyz,
            self.trgxyz,
            self.trgshape,
            self.maxrange,
            self.minelev,
            self.maxelev,
        )
        out = gridder(self.data)
        assert out.shape == (6084, )
        # Todo: find out where this discrepancy comes from
        from osgeo import gdal

        if gdal.VersionInfo()[0] >= "3":
            size = 3528
        else:
            size = 3512
        assert len(np.where(np.isnan(out))[0]) == size

    def test_PseudoCAPPI(self):
        # interpolate to Cartesian 3-D volume grid
        gridder = vpr.PseudoCAPPI(
            self.xyz,
            self.trgxyz,
            self.trgshape,
            self.maxrange,
            self.minelev,
            self.maxelev,
        )
        out = gridder(self.data)
        assert out.shape == (6084, )
        assert len(np.where(np.isnan(out))[0]) == 1744
Exemplo n.º 7
0
 def test_volcoords_from_polar(self):
     coords = vpr.volcoords_from_polar(self.site, self.el, self.az, self.r,
                                       self.proj)
     assert coords.shape == (9000, 3)
Exemplo n.º 8
0
 def test_volcoords_from_polar(self):
     coords = vpr.volcoords_from_polar(self.site, self.el, self.az, self.r, self.proj)
     pass