예제 #1
0
 def test_make_3d_grid(self):
     maxrange = 50000.
     maxalt = 5000.
     horiz_res = 4000.
     vert_res = 1000.
     outxyz, outshape = vpr.make_3d_grid(self.site, self.proj, maxrange,
                                         maxalt, horiz_res, vert_res)
     self.assertEqual(outshape, (6, 26, 26))
     self.assertEqual(outxyz.shape, (4056, 3))
예제 #2
0
 def test_make_3d_grid(self):
     maxrange = 50000.0
     maxalt = 5000.0
     horiz_res = 4000.0
     vert_res = 1000.0
     outxyz, outshape = vpr.make_3d_grid(self.site, self.proj, maxrange,
                                         maxalt, horiz_res, vert_res)
     assert outshape == (6, 26, 26)
     assert outxyz.shape == (4056, 3)
예제 #3
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)
예제 #4
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