Beispiel #1
0
def test_read_variable_attributes():
    with chdir(test_data_dir):
        ds = Dataset('UGRIDv0.9_eleven_points.nc')
    print(ds.variables['Mesh2_depth'].attributes)
    assert (ds.variables['Mesh2_depth'].attributes['standard_name'] ==
            'sea_floor_depth_below_geoid')
    assert ds.variables['Mesh2_depth'].attributes['units'] == 'm'
Beispiel #2
0
def test_read_TAMU():
    with chdir(test_data_dir):
        if os.path.exists('TAMU.nc'):
            ds = Dataset('TAMU.nc')
            print("TAMU variables are:", ds.variables.keys())
            assert isinstance(ds, Dataset)
            assert isinstance(ds.grid, SGrid)
            assert isinstance(ds.variables, dict)
            assert 'water_u' in ds.variables.keys()
            assert 'water_v' in ds.variables.keys()
Beispiel #3
0
def test_read_FVCOM():
    '''Optional test to make sure that files from TAMU and NGOFS are read correctly.'''
    with chdir(test_data_dir):
        if os.path.exists('COOPS_NGOFS.nc'):
            ds = Dataset('COOPS_NGOFS.nc')
            print("COOPS_NGOFS variables are:", ds.variables.keys())
            assert isinstance(ds, Dataset)
            assert isinstance(ds.grid, UGrid)
            assert isinstance(ds.variables, dict)
            assert 'u' in ds.variables.keys()
            assert 'v' in ds.variables.keys()
Beispiel #4
0
def test_read_variables():
    """
    It should get the test_read_variables
    """
    with chdir(test_data_dir):
        ds = Dataset('UGRIDv0.9_eleven_points.nc')
    varnames = list(ds.variables.keys())
    varnames.sort()
    print("variables are:", varnames)
    assert varnames == ['Mesh2_depth', 'Mesh2_face_u', 'Mesh2_face_v']
    for v in ds.variables.values():
        assert isinstance(v, Variable)
Beispiel #5
0
def test_simple_read():
    """Can it be read at all?"""
    with chdir(test_data_dir):
        ds = Dataset('UGRIDv0.9_eleven_points.nc')
    assert isinstance(ds, Dataset)
    assert isinstance(ds.grid, UGrid)