From 54d1bf159b7eda11fdd0285c8152b886112451fc Mon Sep 17 00:00:00 2001 From: Nate Kean <14845347+garlic-os@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:37:46 -0500 Subject: [PATCH 1/6] Fix test name collision Renamed the writeArrayToRaster series of tests so that none are overridden by any of the others by having the same name. --- test/test_util.py | 71 +++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/test/test_util.py b/test/test_util.py index db538aa86..043a79f22 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -137,11 +137,45 @@ def test_writeArrayToRaster(tmp_path): band = src.read(1) noval = src.nodatavals[0] - assert noval == 0 assert np.allclose(band, array) +def test_writeArrayToRaster_2(): + test = np.random.randn(10,10,10) + with pytest.raises(RuntimeError): + writeArrayToRaster(test, 'dummy_file') + + +def test_writeArrayToRaster_3(tmp_path): + test = np.random.randn(10,10) + test = test + test * 1j + with pushd(tmp_path): + fname = os.path.join(tmp_path, 'tmp_file.tif') + writeArrayToRaster(test, fname) + tmp = rio_profile(fname) + assert tmp['dtype'] == np.complex64 + + +def test_writeArrayToRaster_4(tmp_path): + SCENARIO0_DIR = os.path.join(TEST_DIR, "scenario_0") + geotif = os.path.join(SCENARIO0_DIR, 'small_dem.tif') + profile = rio_profile(geotif) + data = rio_open(geotif) + with pushd(tmp_path): + fname = os.path.join(tmp_path, 'tmp_file.nc') + writeArrayToRaster( + data, + fname, + proj=profile['crs'], + gt=profile['transform'], + fmt='nc', + ) + new_fname = os.path.join(tmp_path, 'tmp_file.tif') + prof = rio_profile(new_fname) + assert prof['driver'] == 'GTiff' + + def test_makePoints0D_cython(make_points_0d_data): from RAiDER.makePoints import makePoints0D @@ -516,41 +550,6 @@ def test_rio_4(): assert len(hd.shape) == 2 -def test_writeArrayToRaster_2(): - test = np.random.randn(10,10,10) - with pytest.raises(RuntimeError): - writeArrayToRaster(test, 'dummy_file') - - -def test_writeArrayToRaster_3(tmp_path): - test = np.random.randn(10,10) - test = test + test * 1j - with pushd(tmp_path): - fname = os.path.join(tmp_path, 'tmp_file.tif') - writeArrayToRaster(test, fname) - tmp = rio_profile(fname) - assert tmp['dtype'] == np.complex64 - - -def test_writeArrayToRaster_3(tmp_path): - SCENARIO0_DIR = os.path.join(TEST_DIR, "scenario_0") - geotif = os.path.join(SCENARIO0_DIR, 'small_dem.tif') - profile = rio_profile(geotif) - data = rio_open(geotif) - with pushd(tmp_path): - fname = os.path.join(tmp_path, 'tmp_file.nc') - writeArrayToRaster( - data, - fname, - proj=profile['crs'], - gt=profile['transform'], - fmt='nc', - ) - new_fname = os.path.join(tmp_path, 'tmp_file.tif') - prof = rio_profile(new_fname) - assert prof['driver'] == 'GTiff' - - def test_robs(): assert robmin([1, 2, 3, np.nan])==1 assert robmin([1,2,3])==1 From 46cd20d204031db39013ea665196fd409ee9a18d Mon Sep 17 00:00:00 2001 From: Nate Kean <14845347+garlic-os@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:33:15 -0500 Subject: [PATCH 2/6] Fix code typo --- test/test_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_util.py b/test/test_util.py index 043a79f22..eae32a734 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -154,7 +154,7 @@ def test_writeArrayToRaster_3(tmp_path): fname = os.path.join(tmp_path, 'tmp_file.tif') writeArrayToRaster(test, fname) tmp = rio_profile(fname) - assert tmp['dtype'] == np.complex64 + assert tmp['dtype'] == 'complex64' def test_writeArrayToRaster_4(tmp_path): From ea82a1b4a751f97bc11229356ca2636ee01036a5 Mon Sep 17 00:00:00 2001 From: Nate Kean <14845347+garlic-os@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:03:03 -0500 Subject: [PATCH 3/6] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bc8d2491..04bd09590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). * [657](https://github.com/dbekaert/RAiDER/pull/657) - Fixed a few typos in `README.md`. * [658](https://github.com/dbekaert/RAiDER/pull/658) - Fixed opaque error message if a GUNW file is not produced while HyP3 independently against a previous INSAR_ISCE. * [661](https://github.com/dbekaert/RAiDER/pull/661) - Fixed bug in raiderDownloadGNSS, removed call to scipy.sum, and added unit tests. +* [669](https://github.com/dbekaert/RAiDER/pull/669) - Fixed test name collision (test_writeArrayToRaster). ## [0.5.1] ### Changed From 0168630f5070a2edb00d40be7fcc73e374af2805 Mon Sep 17 00:00:00 2001 From: Charlie Marshak Date: Mon, 29 Jul 2024 13:23:47 -0700 Subject: [PATCH 4/6] Update environment.yml for dem-stitcher --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 1a4c7085b..3a89f8ee0 100644 --- a/environment.yml +++ b/environment.yml @@ -17,7 +17,7 @@ dependencies: - cdsapi - cfgrib - dask - - dem_stitcher>=2.5.6 + - dem_stitcher>=2.5.8 - ecmwf-api-client - h5netcdf - h5py From 3dac1f135a9e7eb7bd8ffed06e1c5d7396d3b980 Mon Sep 17 00:00:00 2001 From: Charlie Marshak Date: Mon, 29 Jul 2024 13:45:12 -0700 Subject: [PATCH 5/6] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b3f7395b..9db732bf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +##[0.5.3] +## Fixed +* Updates dem-stitcher to 2.5.8 to ensure new (ARIA-managed) url for reading the Geoid EGM 2008. See this [issue](https://github.com/ACCESS-Cloud-Based-InSAR/dem-stitcher/issues/96). + ## [0.5.2] ### Changed * [627](https://github.com/dbekaert/RAiDER/pull/627) - Made Python datetimes timezone-aware and added unit tests and bug fixes. From 253e02a4e2e1dc7c40ab11da1218d37524d0fade Mon Sep 17 00:00:00 2001 From: Charlie Marshak Date: Mon, 29 Jul 2024 13:45:29 -0700 Subject: [PATCH 6/6] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9db732bf0..09a0bb9a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -##[0.5.3] -## Fixed +## [0.5.3] +### Fixed * Updates dem-stitcher to 2.5.8 to ensure new (ARIA-managed) url for reading the Geoid EGM 2008. See this [issue](https://github.com/ACCESS-Cloud-Based-InSAR/dem-stitcher/issues/96). ## [0.5.2]