Exemple #1
0
def test_multiple_dim_coords(gfdl_datadir):
    ds = xr.open_dataset(os.path.join(gfdl_datadir, 'test_gfdl.nc'), decode_times=False)
    dom = GCMDataset(ds)
    ds['single_height'] = ds.pfull * 100.0
    assert dom.get_primary_dim_coord_name('z', ds.single_height) == 'pfull'

    ds['double_height'] = (ds.pfull + ds.phalf)
    with pytest.raises(ValueError):
        dom.get_primary_dim_coord_name('z', ds.double_height)

    ds['no_height'] = ds.lat * 30.0
    with pytest.raises(ValueError):
        dom.get_primary_dim_coord_name('z', ds.no_height)