Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_merge_datasets__res():
dem_test = os.path.join(
TEST_INPUT_DATA_DIR, "MOD09GA.A2008296.h14v17.006.2015181011753.hdf"
)
with open_rasterio(dem_test, group="MODIS_Grid_500m_2D") as rds:
datasets = [
rds.isel(x=slice(1200), y=slice(1200)),
rds.isel(x=slice(1200, None), y=slice(1200, None)),
rds.isel(x=slice(1200), y=slice(1200, None)),
rds.isel(x=slice(1200, None), y=slice(1200)),
]
merged = merge_datasets(datasets, res=1000)
data_vars = sorted(merged.data_vars)
assert data_vars == [
"QC_500m_1",
"iobs_res_1",
"num_observations_500m",
"obscov_500m_1",
"sur_refl_b01_1",
"sur_refl_b02_1",
"sur_refl_b03_1",
"sur_refl_b04_1",
"sur_refl_b05_1",
"sur_refl_b06_1",
"sur_refl_b07_1",
]
data_var = data_vars[0]
assert_almost_equal(
def test_merge_datasets():
dem_test = os.path.join(
TEST_INPUT_DATA_DIR, "MOD09GA.A2008296.h14v17.006.2015181011753.hdf"
)
with open_rasterio(dem_test, group="MODIS_Grid_500m_2D") as rds:
datasets = [
rds.isel(x=slice(600), y=slice(600)),
rds.isel(x=slice(600, None), y=slice(600, None)),
rds.isel(x=slice(600), y=slice(600, None)),
rds.isel(x=slice(600, None), y=slice(600)),
]
merged = merge_datasets(datasets)
data_vars = sorted(merged.data_vars)
assert data_vars == [
"QC_500m_1",
"iobs_res_1",
"num_observations_500m",
"obscov_500m_1",
"sur_refl_b01_1",
"sur_refl_b02_1",
"sur_refl_b03_1",
"sur_refl_b04_1",
"sur_refl_b05_1",
"sur_refl_b06_1",
"sur_refl_b07_1",
]
data_var = data_vars[0]
assert_almost_equal(