예제 #1
0
파일: hdf.py 프로젝트: cedadev/cis
def read_metadata(data_dict, data_type):
    if data_type == 'VD':
        out = hdf_vd.get_metadata(data_dict[0])
    elif data_type == 'SD':
        out = hdf_sd.get_metadata(data_dict[0])
    else:
        raise ValueError("Invalid data-type: %s, HDF variables must be VD or SD only" % data_type)
    return out
예제 #2
0
def read_metadata(data_dict, data_type):
    if data_type == 'VD':
        out = hdf_vd.get_metadata(data_dict[0])
    elif data_type == 'SD':
        out = hdf_sd.get_metadata(data_dict[0])
    else:
        raise ValueError(
            "Invalid data-type: %s, HDF variables must be VD or SD only" %
            data_type)
    return out
예제 #3
0
def test_that_can_get_variable_metadata():
    vd = hdf_vd.read(valid_hdf_vd_file, 'DEM_elevation')['DEM_elevation']
    metadata = hdf_vd.get_metadata(vd)
    eq_(metadata._name, "DEM_elevation")
    eq_(metadata.long_name, "Digital Elevation Map")
    eq_(metadata.shape, [37081])
    eq_(metadata.units, "meters")
    eq_(metadata.range, [-9999, 8850])
    eq_(metadata.factor, 1.0)
    eq_(metadata.offset, 0.0)
    eq_(metadata.missing_value, 9999)
예제 #4
0
def test_that_can_get_coord_metadata():
    vd = hdf_vd.read(valid_hdf_vd_file, 'Longitude')['Longitude']
    metadata = hdf_vd.get_metadata(vd)
    eq_(metadata._name, "Longitude")
    eq_(metadata.standard_name, "longitude")
    eq_(metadata.long_name, "Spacecraft Longitude")
    eq_(metadata.shape, [37081])
    eq_(metadata.units, "degrees")
    eq_(metadata.range, [-180.0, 180.0])
    eq_(metadata.factor, 1.0)
    eq_(metadata.offset, 0.0)
    eq_(metadata.missing_value, None)
예제 #5
0
def test_that_can_get_variable_metadata():
    vd = hdf_vd.read(escape_colons(valid_hdf_vd_file),
                     'DEM_elevation')['DEM_elevation']
    metadata = hdf_vd.get_metadata(vd)
    eq_(metadata._name, "DEM_elevation")
    eq_(metadata.long_name, "Digital Elevation Map")
    eq_(metadata.shape, [37081])
    eq_(metadata.units, "meters")
    eq_(metadata.factor, 1.0)
    eq_(metadata.offset, 0.0)
    eq_(metadata.missing_value, 9999)
    eq_(metadata.misc['valid_range'], [-9999, 8850])
예제 #6
0
def test_that_can_get_coord_metadata():
    vd = hdf_vd.read(escape_colons(valid_hdf_vd_file),
                     'Longitude')['Longitude']
    metadata = hdf_vd.get_metadata(vd)
    eq_(metadata._name, "Longitude")
    eq_(metadata.standard_name, "longitude")
    eq_(metadata.long_name, "Spacecraft Longitude")
    eq_(metadata.shape, [37081])
    eq_(metadata.units, "degrees")
    eq_(metadata.factor, 1.0)
    eq_(metadata.offset, 0.0)
    eq_(metadata.missing_value, None)
    eq_(metadata.misc['valid_range'], [-180.0, 180.0])