Exemple #1
0
def ex_load_hdf5():


    filename = "X:/gpm/level2/2A.GPM.Ku.V620160118.20160327-S004128-E011127.V04A.RT-H5"
    # load rainbow file contents to dict
    rbdict = read_generic_hdf5(filename)#, loaddata=False)

    class DictEditor(HasTraits):
        Object = Instance(object)

        def __init__(self, obj, **traits):
            super(DictEditor, self).__init__(**traits)
            self.Object = obj

        def trait_view(self, name=None, view_elements=None):
            return View(
                VGroup(
                    Item('Object',
                         label='Debug',
                         id='debug',
                         editor=ValueEditor(),  # ValueEditor()
                         style='custom',
                         dock='horizontal',
                         show_label=False), ),
                title='Dictionary Editor',
                width=800,
                height=600,
                resizable=True)

    def dic(my_data):
        b = DictEditor(my_data)
        b.configure_traits()

    dic(rbdict)
Exemple #2
0
class TestKNMIVolume(MeasuredDataVolume):
    if has_data:
        name = "hdf5/knmi_polar_volume.h5"
        format = "ODIM"
        volumes = 1
        sweeps = 14
        moments = ["DBZH"]
        elevations = [
            0.3,
            0.4,
            0.8,
            1.1,
            2.0,
            3.0,
            4.5,
            6.0,
            8.0,
            10.0,
            12.0,
            15.0,
            20.0,
            25.0,
        ]
        azimuths = [360] * sweeps
        ranges = [320, 240, 240, 240, 240, 340, 340, 300, 300, 240, 240, 240, 240, 240]

        data = io.read_generic_hdf5(util.get_wradlib_data_file(name))

        dsdesc = "dataset{}"
        mdesc = "data{}"
Exemple #3
0
class TestGamicVolume(MeasuredDataVolume):
    if has_data:
        name = "hdf5/DWD-Vol-2_99999_20180601054047_00.h5"
        format = "GAMIC"
        volumes = 1
        sweeps = 10
        moments = [
            "DBZH",
            "DBZV",
            "DBTH",
            "DBTV",
            "ZDR",
            "VRADH",
            "VRADV",
            "WRADH",
            "WRADV",
            "PHIDP",
            "KDP",
            "RHOHV",
        ]
        elevations = [28.0, 18.0, 14.0, 11.0, 8.2, 6.0, 4.5, 3.1, 1.7, 0.6]
        azimuths = [361, 361, 361, 360, 361, 360, 360, 361, 360, 360]
        ranges = [360, 500, 620, 800, 1050, 1400, 1000, 1000, 1000, 1000]

        data = io.read_generic_hdf5(util.get_wradlib_data_file(name))

        dsdesc = "scan{}"
        mdesc = "moment_{}"
Exemple #4
0
class TestGamicVolume(MeasuredDataVolume):
    name = 'hdf5/DWD-Vol-2_99999_20180601054047_00.h5'
    format = 'GAMIC'
    volumes = 1
    sweeps = 10
    moments = [
        'DBZH', 'DBZV', 'DBTH', 'DBTV', 'ZDR', 'VRADH', 'VRADV', 'WRADH',
        'WRADV', 'PHIDP', 'KDP', 'RHOHV'
    ]
    elevations = [28.0, 18.0, 14.0, 11.0, 8.2, 6.0, 4.5, 3.1, 1.7, 0.6]
    azimuths = [361, 361, 361, 360, 361, 360, 360, 361, 360, 360]
    ranges = [360, 500, 620, 800, 1050, 1400, 1000, 1000, 1000, 1000]

    data = io.read_generic_hdf5(util.get_wradlib_data_file(name))

    dsdesc = 'scan{}'
    mdesc = 'moment_{}'
Exemple #5
0
    def setUp(self):
        f = 'gpm/2A-CS-151E24S154E30S.GPM.Ku.V7-20170308.20141206-S095002-E095137.004383.V05A.HDF5'  # noqa
        gpm_file = util.get_wradlib_data_file(f)
        pr_data = read_generic_hdf5(gpm_file)
        pr_lon = pr_data['NS/Longitude']['data']
        pr_lat = pr_data['NS/Latitude']['data']
        zenith = pr_data['NS/PRE/localZenithAngle']['data']
        wgs84 = georef.get_default_projection()
        a = wgs84.GetSemiMajor()
        b = wgs84.GetSemiMinor()
        rad = georef.proj4_to_osr(
            ('+proj=aeqd +lon_0={lon:f} ' +
             '+lat_0={lat:f} +a={a:f} +b={b:f}' + '').format(lon=pr_lon[68, 0],
                                                             lat=pr_lat[68, 0],
                                                             a=a,
                                                             b=b))
        pr_x, pr_y = georef.reproject(pr_lon,
                                      pr_lat,
                                      projection_source=wgs84,
                                      projection_target=rad)
        self.re = georef.get_earth_radius(pr_lat[68, 0], wgs84) * 4. / 3.
        self.pr_xy = np.dstack((pr_x, pr_y))
        self.alpha = zenith
        self.zt = 407000.
        self.dr = 125.
        self.bw_pr = 0.71
        self.nbin = 176
        self.nray = pr_lon.shape[1]

        self.pr_out = np.array([[[[-58533.78453556, 124660.60390174],
                                  [-58501.33048429, 124677.58873852]],
                                 [[-53702.13393133, 127251.83656509],
                                  [-53670.98686161, 127268.11882882]]],
                                [[[-56444.00788528, 120205.5374491],
                                  [-56411.55421163, 120222.52300741]],
                                 [[-51612.2360682, 122796.78620764],
                                  [-51581.08938314, 122813.06920719]]]])
        self.r_out = np.array(
            [0., 125., 250., 375., 500., 625., 750., 875., 1000., 1125.])
        self.z_out = np.array([
            0., 119.51255112, 239.02510224, 358.53765337, 478.05020449,
            597.56275561, 717.07530673, 836.58785786, 956.10040898,
            1075.6129601
        ])
Exemple #6
0
class TestKNMIVolume(MeasuredDataVolume):
    name = 'hdf5/knmi_polar_volume.h5'
    format = 'ODIM'
    volumes = 1
    sweeps = 14
    moments = ['DBZH']
    elevations = [
        0.3, 0.4, 0.8, 1.1, 2.0, 3.0, 4.5, 6.0, 8.0, 10.0, 12.0, 15.0, 20.0,
        25.0
    ]
    azimuths = [360] * sweeps
    ranges = [
        320, 240, 240, 240, 240, 340, 340, 300, 300, 240, 240, 240, 240, 240
    ]

    data = io.read_generic_hdf5(util.get_wradlib_data_file(name))

    dsdesc = 'dataset{}'
    mdesc = 'data{}'
Exemple #7
0
    def setUp(self):
        f = 'gpm/2A-CS-151E24S154E30S.GPM.Ku.V7-20170308.20141206-S095002-E095137.004383.V05A.HDF5'  # noqa
        gpm_file = util.get_wradlib_data_file(f)
        pr_data = read_generic_hdf5(gpm_file)
        pr_lon = pr_data['NS/Longitude']['data']
        pr_lat = pr_data['NS/Latitude']['data']
        zenith = pr_data['NS/PRE/localZenithAngle']['data']
        wgs84 = georef.get_default_projection()
        a = wgs84.GetSemiMajor()
        b = wgs84.GetSemiMinor()
        rad = georef.proj4_to_osr(('+proj=aeqd +lon_0={lon:f} ' +
                                   '+lat_0={lat:f} +a={a:f} +b={b:f}' +
                                   '').format(lon=pr_lon[68, 0],
                                              lat=pr_lat[68, 0],
                                              a=a, b=b))
        pr_x, pr_y = georef.reproject(pr_lon, pr_lat,
                                      projection_source=wgs84,
                                      projection_target=rad)
        self.re = georef.get_earth_radius(pr_lat[68, 0], wgs84) * 4. / 3.
        self.pr_xy = np.dstack((pr_x, pr_y))
        self.alpha = zenith
        self.zt = 407000.
        self.dr = 125.
        self.bw_pr = 0.71
        self.nbin = 176
        self.nray = pr_lon.shape[1]

        self.pr_out = np.array([[[[-58533.78453556, 124660.60390174],
                                  [-58501.33048429, 124677.58873852]],
                                 [[-53702.13393133, 127251.83656509],
                                  [-53670.98686161, 127268.11882882]]],
                                [[[-56444.00788528, 120205.5374491],
                                  [-56411.55421163, 120222.52300741]],
                                 [[-51612.2360682, 122796.78620764],
                                  [-51581.08938314, 122813.06920719]]]])
        self.r_out = np.array([0., 125., 250., 375., 500., 625., 750., 875.,
                               1000., 1125.])
        self.z_out = np.array([0., 119.51255112, 239.02510224, 358.53765337,
                               478.05020449, 597.56275561, 717.07530673,
                               836.58785786, 956.10040898, 1075.6129601])
Exemple #8
0
        def trait_view(self, name=None, view_elements=None):
            return View(
                VGroup(
                    Item('Object',
                         label='Debug',
                         id='debug',
                         editor=ValueEditor(),  # ValueEditor()
                         style='custom',
                         dock='horizontal',
                         show_label=False), ),
                title='Dictionary Editor',
                width=800,
                height=600,
                resizable=True)

    def dic(my_data):
        b = DictEditor(my_data)
        b.configure_traits()

    dic(rbdict)

# =======================================================
if __name__ == '__main__':
#    ex_load_hdf5()
    filename = "X:/gpm/level2/2A.GPM.Ku.V620160118.20160327-S004128-E011127.V04A.RT-H5"
    # load rainbow file contents to dict
    out = read_generic_hdf5(filename)#, loaddata=False)
    for key in out.keys():
        print key