def test_convert_tiles_to_faces(llc_mds_datadirs, mydir, fname, nk, nl, skip, use_xmitgcm): """Read in tiles data, convert to faces. Verify this equals reading in face data """ if mydir == 'xmitgcm': mydir, _ = llc_mds_datadirs data_tiles = ecco.read_llc_to_tiles(fdir=mydir, fname=fname, llc=90, nk=nk, nl=nl, skip=skip, filetype='>f4', less_output=False, use_xmitgcm=False) data_faces = ecco.read_llc_to_faces(fdir=mydir, fname=fname, llc=90, nk=nk, nl=nl, skip=skip, filetype='>f4', less_output=False) data_converted = ecco.llc_tiles_to_faces(data_tiles) for f in range(1, len(data_faces) + 1): assert np.all(np.equal(data_converted[f], data_faces[f]))
def test_convert_compact_to_faces(): """Read in compact data, convert to faces. Verify this equals reading in face data """ # Loop through 2D, 3D, 4D cases for fname, nk, nl in zip(_TEST_FILES, _TEST_NK, _TEST_RECS): data_compact = ecco.read_llc_to_compact(fdir=_DATA_DIR, fname=fname, llc=90, nk=nk, nl=nl, filetype='>f4', less_output=False) data_faces = ecco.read_llc_to_faces(fdir=_DATA_DIR, fname=fname, llc=90, nk=nk, nl=nl, filetype='>f4', less_output=False) data_converted = ecco.llc_compact_to_faces(data_compact) for f in range(1, len(data_faces) + 1): assert np.all(np.equal(data_converted[f], data_faces[f]))
def test_convert_faces_to_compact(llc_mds_datadirs, mydir, fname, nk, nl, skip): """Read in faces data, convert to compact. Verify this equals reading in compact data """ if mydir == 'xmitgcm': mydir, _ = llc_mds_datadirs data_faces = ecco.read_llc_to_faces(fdir=mydir, fname=fname, llc=90, nk=nk, nl=nl, filetype='>f4', skip=skip, less_output=False) data_compact = ecco.read_llc_to_compact(fdir=mydir, fname=fname, skip=skip, llc=90, nk=nk, nl=nl, filetype='>f4', less_output=False) data_converted = ecco.llc_faces_to_compact(data_faces) assert np.all(np.equal(data_converted, data_compact))
def test_convert_faces_to_tiles(): """Read in faces data, convert to tiles. Verify this equals reading in face data """ # Loop through 2D, 3D, 4D cases for fname, nk, nl in zip(_TEST_FILES, _TEST_NK, _TEST_RECS): data_faces = ecco.read_llc_to_faces(fdir=_DATA_DIR, fname=fname, llc=90, nk=nk, nl=nl, filetype='>f4', less_output=False) data_tiles = ecco.read_llc_to_tiles(fdir=_DATA_DIR, fname=fname, llc=90, nk=nk, nl=nl, filetype='>f4', less_output=False) data_converted = ecco.llc_faces_to_tiles(data_faces) assert np.all(np.equal(data_converted, data_tiles))