Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update add collection test #95

Merged
merged 4 commits into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion add_collection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,15 @@ def verify_variables(merged_group, origin_group, subset_index, both_merged):
merged_data = np.resize(merged_var[subset_index], origin_var.shape)
origin_data = origin_var

equal_nan = True
if merged_data.dtype.kind == 'S':
equal_nan = False

# verify variable data
if isinstance(origin_data, str):
unittest.TestCase().assertEqual(merged_data, origin_data)
else:
unittest.TestCase().assertTrue(np.array_equal(merged_data, origin_data, equal_nan=True))
unittest.TestCase().assertTrue(np.array_equal(merged_data, origin_data, equal_nan=equal_nan))


def verify_groups(merged_group, origin_group, subset_index, file=None, both_merged=False):
Expand Down Expand Up @@ -221,6 +225,7 @@ def test(collection_id, venue):
print('\nDone downloading.')

filename = file_names[0]

# Handle time dimension and variables dropping
merge_dataset = nc.Dataset(filename, 'r')

Expand Down