diff --git a/podaac/subsetter/gpm_cleanup.py b/podaac/subsetter/gpm_cleanup.py index 0ec09efa..11e49667 100644 --- a/podaac/subsetter/gpm_cleanup.py +++ b/podaac/subsetter/gpm_cleanup.py @@ -24,7 +24,7 @@ def compute_new_time_data(time_group, nc_dataset): hour=nc_dataset[time_group+'__Hour'][:][i], minute=nc_dataset[time_group+'__Minute'][:][i], second=nc_dataset[time_group+'__Second'][:][i], - microsecond=nc_dataset[time_group+'__Second'][:][i]*1000), + microsecond=nc_dataset[time_group+'__MilliSecond'][:][i]*1000), time_unit_out) for i in range(len(nc_dataset[time_group+'__Year'][:]))] return new_time_list, time_unit_out diff --git a/podaac/subsetter/subset.py b/podaac/subsetter/subset.py index 83864585..ee7ba7a0 100644 --- a/podaac/subsetter/subset.py +++ b/podaac/subsetter/subset.py @@ -1226,6 +1226,9 @@ def subset(file_to_subset: str, bbox: np.ndarray, output_file: str, except AttributeError: pass + if hdf_type == 'GPM': + args['decode_times'] = False + with xr.open_dataset( xr.backends.NetCDF4DataStore(nc_dataset), **args diff --git a/tests/data/GPM/GPM_test_file_2.HDF5 b/tests/data/GPM/GPM_test_file_2.HDF5 new file mode 100644 index 00000000..0ae6fbcb Binary files /dev/null and b/tests/data/GPM/GPM_test_file_2.HDF5 differ diff --git a/tests/data/GPM/GPM_test_file_3.HDF5 b/tests/data/GPM/GPM_test_file_3.HDF5 deleted file mode 100644 index b142ec86..00000000 Binary files a/tests/data/GPM/GPM_test_file_3.HDF5 and /dev/null differ diff --git a/tests/test_subset.py b/tests/test_subset.py index e1485e0b..4141d3ea 100644 --- a/tests/test_subset.py +++ b/tests/test_subset.py @@ -2315,7 +2315,7 @@ def test_gpm_compute_new_var_data(data_dir, subset_output_dir, request): since 1980-01-06""" gpm_dir = join(data_dir, 'GPM') - gpm_file = 'GPM_test_file_3.HDF5' + gpm_file = 'GPM_test_file_2.HDF5' bbox = np.array(((-180, 180), (-90, 90))) shutil.copyfile( os.path.join(gpm_dir, gpm_file), @@ -2324,7 +2324,9 @@ def test_gpm_compute_new_var_data(data_dir, subset_output_dir, request): nc_dataset, has_groups, file_extension = subset.open_as_nc_dataset(join(subset_output_dir, gpm_file)) + del nc_dataset.variables["__FS__ScanTime__timeMidScan"] + del nc_dataset.variables["__HS__ScanTime__timeMidScan"] - time_data, time_unit = gc.compute_new_time_data("__FS__ScanTime", nc_dataset) + nc_dataset = gc.change_var_dims(nc_dataset, variables=None) - assert int(time_data[0]) == 1325120552 + assert int(nc_dataset["__FS__ScanTime__timeMidScan"][:][0]) == 1306403820