From 96507bd3f19b96c24ebc5498e250508951b8812b Mon Sep 17 00:00:00 2001 From: Yi-Chia Chang <61452667+yichiac@users.noreply.github.com> Date: Fri, 17 May 2024 11:05:53 -0400 Subject: [PATCH] Fix South America Soybean Filename Glob and Regex (#2062) * fix filename glob and regex * remove unwanted file * update test data * update dataset test * remove zip file * remove additional directory * fix ruff check and format --- .../SouthAmericaSoybean.zip | Bin 7512 -> 0 bytes ...2002.tif => SouthAmerica_Soybean_2002.tif} | Bin ...2021.tif => SouthAmerica_Soybean_2021.tif} | Bin tests/data/south_america_soybean/data.py | 21 +++++------------- tests/datasets/test_south_america_soybean.py | 12 ++-------- torchgeo/datasets/south_america_soybean.py | 4 ++-- 6 files changed, 10 insertions(+), 27 deletions(-) delete mode 100644 tests/data/south_america_soybean/SouthAmericaSoybean.zip rename tests/data/south_america_soybean/{SouthAmericaSoybean/South_America_Soybean_2002.tif => SouthAmerica_Soybean_2002.tif} (100%) rename tests/data/south_america_soybean/{SouthAmericaSoybean/South_America_Soybean_2021.tif => SouthAmerica_Soybean_2021.tif} (100%) diff --git a/tests/data/south_america_soybean/SouthAmericaSoybean.zip b/tests/data/south_america_soybean/SouthAmericaSoybean.zip deleted file mode 100644 index 630cc6c94c9fbd9d70941e3389b1721fde784224..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7512 zcmb_hWl)?;n|%o$f(F;%!QBHP!QCae%;4^Wgd{-l;2JbIgWF((27*IycXxN$-0$A4 zt=-!Fv0K|+-Tm~b>T{}pJ$34+Dj*`^1Ah&UD2VRAihnk_Kc|)}*u|CO9mv$4!_Cpf z+{zN{$l(Tdb#vtanYx*BxH`JKSs9z!gI%o6O^sb0A!cAx2M&$D(06}>8vkIb|Hz>I zOXiHZy(kM{k-1CCJlcQSAV0AKC;&hK0NyB@AQA(BAOZknN}`55 z171lX0vB>MZD0U!$Ta>VkbnTx5CgA1qX4NSPrZQn`y>CGr>(>#sRvgE3A?Awo00nm zW@!L;SmSM##VA&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QiWqrpQY!olGs?K~AI{mN~u6~(rUNUlRa53N6 z`o7z}{<`P0#*Hmk5+)XEt$3+ndBnZh&>v`3Ku!N}S~ZfiBr45Ddg)kmoA!X_Tob)C zpH91Y;KcLBnunVQj`2(KTu;>~tqj#M$`&hCG>Q?5itgkT5U?R?mx^r`RAzfXPv(Qm zFq*Q2@piM0KgbS=&nSz*1WnmdNQUxvg=y_ac%Sop*NE{;c%NSo_R+-m}H1!~&dow2Ohs$8L zo~}@RIDlFX)`JIr*SKv6hMg;KwA*@;Q@IpKviWL6fV_hEGOrtN7FNCvGvppa92r%z zk~8~1w8C&!5E0xYA0xgkt$wyx@{4R%mDGnt|Ejm9nGvOd|4wU8{`L*2^@ClQ>1z{g z&dQ6F7kHbjUCQN(J#Q&~YRXH(H#LwA)-<50x83|VZ+`{m)6`=0vliowr^p|21($b; zON5_!2#XOzz@FuzXDg`M8_~4;Kq2o5{=uFcVbSKJNYs?puk?^db$pP0o;Cx2d((wIhXua*f%14rL$eRVhS*-UMBnZUdcWyQ0k zh{N%)1d3N<^9J84W{@o4|#2LJ_YuIK>{9@6wzE@_SXVlA!18v1;gfiUDdGLDoevobXB)j9| zij{S-gO)F_1?J!PvsN@SeE&M&7kFjH*NoxJi^CH~pxHb}Bg* z__c)fF2yA1a-uQ{QbrdkM{tGkWFKmFB*A7@QK`lWW)M5YL9CHB6wCc(gC&3pa`jC5#;<)o{OS>s>xyp9}Q)81E z;`{E|H?TOzaiy2`yC8B+P SouthAmericaSoybe ) transforms = nn.Identity() url = os.path.join( - 'tests', - 'data', - 'south_america_soybean', - 'SouthAmericaSoybean', - 'South_America_Soybean_{}.tif', + 'tests', 'data', 'south_america_soybean', 'SouthAmerica_Soybean_{}.tif' ) monkeypatch.setattr(SouthAmericaSoybean, 'url', url) @@ -69,11 +65,7 @@ def test_already_extracted(self, dataset: SouthAmericaSoybean) -> None: def test_already_downloaded(self, tmp_path: Path) -> None: pathname = os.path.join( - 'tests', - 'data', - 'south_america_soybean', - 'SouthAmericaSoybean', - 'South_America_Soybean_2002.tif', + 'tests', 'data', 'south_america_soybean', 'SouthAmerica_Soybean_2002.tif' ) root = str(tmp_path) shutil.copy(pathname, root) diff --git a/torchgeo/datasets/south_america_soybean.py b/torchgeo/datasets/south_america_soybean.py index c3aaaddfd7f..fc28c229370 100644 --- a/torchgeo/datasets/south_america_soybean.py +++ b/torchgeo/datasets/south_america_soybean.py @@ -39,8 +39,8 @@ class SouthAmericaSoybean(RasterDataset): .. versionadded:: 0.6 """ - filename_glob = 'South_America_Soybean_*.*' - filename_regex = r'South_America_Soybean_(?P\d{4})' + filename_glob = 'SouthAmerica_Soybean_*.*' + filename_regex = r'SouthAmerica_Soybean_(?P\d{4})' date_format = '%Y' is_image = False