Ejemplo n.º 1
0
def test_remove_attr():
    r'Test removing an attribute'
    ds = Dataset()
    ds.maker = 'me'
    assert 'maker' in ds.ncattrs()

    del ds.maker
    assert not hasattr(ds, 'maker')
    assert 'maker' not in ds.ncattrs()
Ejemplo n.º 2
0
def test_remove_attr():
    """Test removing an attribute."""
    ds = Dataset()
    ds.maker = 'me'
    assert 'maker' in ds.ncattrs()

    del ds.maker
    assert not hasattr(ds, 'maker')
    assert 'maker' not in ds.ncattrs()
Ejemplo n.º 3
0
def test_remove_attr():
    """Test removing an attribute."""
    ds = Dataset()
    ds.maker = "me"
    assert "maker" in ds.ncattrs()

    del ds.maker
    assert not hasattr(ds, "maker")
    assert "maker" not in ds.ncattrs()
Ejemplo n.º 4
0
def test_group():
    """Test `Group`/`Dataset` behavior."""
    ds = Dataset()
    ds.createDimension('x', 5)
    ds.createVariable('data', 'f4', ('x',), 5)
    ds.conventions = 'CF-1.5'

    assert 'x' in ds.dimensions
    assert 'data' in ds.variables
    assert 'conventions' in ds.ncattrs()

    assert str(ds) == ('root\n\nDimensions:\n'
                       "<class 'metpy.io.cdm.Dimension'>: name = x, size = 5\n\n"
                       "Variables:\n<class 'metpy.io.cdm.Variable'>: float32 data(x)\n\t"
                       'shape = 5\n\nAttributes:\n\tconventions: CF-1.5')
Ejemplo n.º 5
0
def test_group():
    """Test `Group`/`Dataset` behavior."""
    ds = Dataset()
    ds.createDimension('x', 5)
    ds.createVariable('data', 'f4', ('x',), 5)
    ds.conventions = 'CF-1.5'

    assert 'x' in ds.dimensions
    assert 'data' in ds.variables
    assert 'conventions' in ds.ncattrs()

    assert str(ds) == ('root\n\nDimensions:\n'
                       "<class 'metpy.io.cdm.Dimension'>: name = x, size = 5\n\n"
                       "Variables:\n<class 'metpy.io.cdm.Variable'>: float32 data(x)\n\t"
                       'shape = 5\n\nAttributes:\n\tconventions: CF-1.5')
Ejemplo n.º 6
0
def test_group():
    """Test `Group`/`Dataset` behavior."""
    ds = Dataset()
    ds.createDimension("x", 5)
    ds.createVariable("data", "f4", ("x",), 5)
    ds.conventions = "CF-1.5"

    assert "x" in ds.dimensions
    assert "data" in ds.variables
    assert "conventions" in ds.ncattrs()

    assert str(ds) == (
        "root\n\nDimensions:\n"
        "<class 'metpy.io.cdm.Dimension'>: name = x, size = 5\n\n"
        "Variables:\n<class 'metpy.io.cdm.Variable'>: float32 data(x)\n\t"
        "shape = 5\n\nAttributes:\n\tconventions: CF-1.5"
    )